From adeaec38e68ceaf5c1abbae47725d8547329e109 Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Thu, 4 Mar 2021 09:14:17 +0100 Subject: [PATCH] License --- app/DD_Clipboard_Searcher/ClassLicense.vb | 38 +++++++++++++++---- .../My Project/AssemblyInfo.vb | 2 +- app/DD_Clipboard_Searcher/frmLicense.vb | 7 +++- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/app/DD_Clipboard_Searcher/ClassLicense.vb b/app/DD_Clipboard_Searcher/ClassLicense.vb index 59ee1c6..3cf21a1 100644 --- a/app/DD_Clipboard_Searcher/ClassLicense.vb +++ b/app/DD_Clipboard_Searcher/ClassLicense.vb @@ -32,15 +32,39 @@ Public Class ClassLicense If lic_string <> "" Then LICENSE_COUNT = split(0) - LICENSE_DATE = CDate(split(1)) - End If + Try + Dim cultureInfo As System.Globalization.CultureInfo + cultureInfo = New System.Globalization.CultureInfo("de-DE") + cultureInfo.DateTimeFormat.ShortDatePattern = "dd.MM.yyyy" + Try + Dim oLicDate As Date = Convert.ToDateTime(split(1), cultureInfo) + LICENSE_DATE = oLicDate + Catch ex As Exception + Logger.Warn($"Error in Convert Licdate1 [{split(1)}] {ex.Message}") + End Try + + Catch ex As Exception + LICENSE_DATE = split(1) + Logger.Warn($"Error in Convert Licdate1 [{split(1)}] {ex.Message}") + End Try - If CDate(split(1)) < CDate(Now.ToShortDateString) Then - MsgBox("Your license evaluated!" & vbNewLine & "Last valid date: " & split(1) & vbNewLine & "Please contact Digital Data.", MsgBoxStyle.Exclamation) - LICENSE_EXPIRED = True - LICENSE_COUNT = 0 - ERROR_INIT = "NO LICENSE" End If + + Try + If Not IsNothing(LICENSE_DATE) Then + If CDate(LICENSE_DATE.ToShortDateString) < CDate(Now.ToShortDateString) Then + MsgBox("Your license evaluated!" & vbNewLine & "Last valid date: " & LICENSE_DATE.ToString & vbNewLine & "Please contact Digital Data.", MsgBoxStyle.Exclamation) + LICENSE_EXPIRED = True + LICENSE_COUNT = 0 + ERROR_INIT = "NO LICENSE" + End If + End If + + + Catch ex As Exception + Logger.Warn($"Error in Convert Licdate2 [{split(1)}] {ex.Message}") + End Try + Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in licensemanager:") End Try diff --git a/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb b/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb index d5fffcd..009409b 100644 --- a/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb +++ b/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/app/DD_Clipboard_Searcher/frmLicense.vb b/app/DD_Clipboard_Searcher/frmLicense.vb index e497a98..5b12606 100644 --- a/app/DD_Clipboard_Searcher/frmLicense.vb +++ b/app/DD_Clipboard_Searcher/frmLicense.vb @@ -1,4 +1,5 @@ -Imports DD_LIB_Standards +Imports System.Globalization +Imports DD_LIB_Standards Public Class frmLicense Dim CLIENT_ID As Integer Public _lizenzManager As clsLicenseManager @@ -49,7 +50,9 @@ Public Class frmLicense _lizenzManager = New clsLicenseManager("#DigitalData35452!#", "") If Me.txtNewlicences.Text <> "" Then 'Encode the license - Dim result As String = Me._lizenzManager.EncodeLicenseKey(txtNewlicences.Text & "#" & dtpGueltig_GI.Text, "#DigitalData35452!#") + Dim oDate = CDate(dtpGueltig_GI.Value) + Dim oDateddMMyyyy = oDate.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture) + Dim result As String = Me._lizenzManager.EncodeLicenseKey(txtNewlicences.Text & "#" & oDate, "#DigitalData35452!#") Dim sql As String = String.Format("UPDATE TBDD_CLIENT SET LICENSE_CBSEARCHER = '" & result & "' WHERE GUID = {0}", CLIENT_ID) If Database.ExecuteNonQuery(sql) = False Then