From 653e04bc3fb600e4e78a9a07cb8e044eef09ff24 Mon Sep 17 00:00:00 2001 From: RenzoL Date: Wed, 23 Mar 2022 11:20:36 +0100 Subject: [PATCH] =?UTF-8?q?LicenceManager=202.4c2=20:=20-=20Correzione=20c?= =?UTF-8?q?reazione=20nuova=20licenza=20quando=20simile=20=C3=A8=20gi?= =?UTF-8?q?=C3=A0=20esistente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- My Project/AssemblyInfo.vb | 4 ++-- NewLicencePage/NewLicencePageVM.vb | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 2ea0873..4464d4b 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -59,5 +59,5 @@ Imports System.Windows ' usando l'asterisco '*' come illustrato di seguito: ' - - + + diff --git a/NewLicencePage/NewLicencePageVM.vb b/NewLicencePage/NewLicencePageVM.vb index 0e08624..db22d0f 100644 --- a/NewLicencePage/NewLicencePageVM.vb +++ b/NewLicencePage/NewLicencePageVM.vb @@ -549,10 +549,12 @@ Public Class NewLicencePageVM ' Nome licenza Dim sCliName As String = If(String.IsNullOrWhiteSpace(m_ClientName), "", "-" & m_ClientName) Dim sLicName As String = If(GetSelIsDongle(), "Key-", "Soft-") & SelNumber.Number.ToString("D6") & "-" & SelProduct.ProductName & sCliName - ' Nome file Dim fileName As String = Map.refMainWindowVM.MainWindowM.sKeygenDataDir & "\" & sLicName & ".Kge" fileName = ManageFile.ComputeFileName(fileName, Path.GetFileNameWithoutExtension(fileName)) + ' Aggiorno nome licenza col nuovo nome calcolato del file + sLicName = Path.GetFileNameWithoutExtension(fileName) + ' Scrivo il file Dim StringFile As New List(Of String) StringFile.Add(";") @@ -621,9 +623,16 @@ Public Class NewLicencePageVM Return End Try - ' Ora aggiungo la licenza al DB + ' Ora leggo il contenuto del file .lic generato e aggiungo la licenza al DB + Dim textLic As String = String.Empty + Try + textLic = File.ReadAllText(Path.ChangeExtension(fileName.Replace("\", "\\"), ".lic")) + Catch ex As Exception + MessageBox.Show("File .lic non trovato", "LicenceManager Error") + Return + End Try + Try - Dim textLic As String = File.ReadAllText(Path.ChangeExtension(fileName.Replace("\", "\\"), ".lic")) If String.IsNullOrEmpty(NestKey) Or String.IsNullOrWhiteSpace(NestKey) Then Query = "INSERT INTO " & DB_LICENCE & " (" & DB_PRODUCTID & ", " & DB_PRODUCTVERSION & ", " & DB_PRODUCTLEVEL & ", " &