Imports DigitalData.Modules.Logging
Public Class LicensesLegacy
Private _licenses() As LicenseLegacy
Private _WDLizenz As String
Private _Logger As Logger
' ++++++++++++++++++++++++++++++++++++++++++++++ Methoden ++++++++++++++++++++++++++++++++++++++++++++++
'''
''' Konstruktor für die Lizenzen-Sammlung
'''
''' In Array übertragene Lizenzinformationen
Sub New(LogConfig As LogConfig, ByVal licenseStringArray(,) As String)
Try
_Logger = LogConfig.GetLogger()
If licenseStringArray IsNot Nothing Then
Dim license1() As String = licenseStringArray(0, 1).Split("#")
If license1.Length > 1 Then
Me.machine = license1(1)
Else
Me.machine = "all"
End If
Me.Company = license1(0) 'licenseStringArray(0, 1)
Dim i As Integer
For i = 1 To licenseStringArray.GetLength(0) - 2 ' minus 2, weil GetLength nicht null-basiert ist und das erste Element Firma ist
Dim anzprof As String = licenseStringArray(i, 3)
If anzprof.ToLower = "unlimited" Then
anzprof = 99
End If
Me.Add(licenseStringArray(i, 0), licenseStringArray(i, 1), licenseStringArray(i, 2), anzprof)
Next
End If
Catch ex As Exception
_Logger.Error(ex)
End Try
End Sub
'''
''' Fügt der Lizenz-Sammlung eine Lizenz hinzu
'''
''' Name des Moduls, für das eine Lizenz angelegt werden soll
''' Datum der Gültigkeit der Lizenz
Public Sub Add(ByVal modulename As String, ByVal expires As Date, ByVal type As String, ByVal anzprof As String)
If _licenses IsNot Nothing Then
ReDim Preserve _licenses(_licenses.Length)
Else
ReDim Preserve _licenses(0)
End If
_licenses(_licenses.Length - 1) = New LicenseLegacy(modulename, expires, type, anzprof)
End Sub
'''
''' Liefert eine Lizenz an Hand des Modulnamens
'''
''' Name des zu suchenden Moduls
''' liefert ein Lizenzobjekt
Public Function GetLicense(ByVal modulename As String) As LicenseLegacy
If _licenses IsNot Nothing Then
For Each license As LicenseLegacy In _licenses
If license.Modulename = modulename Then
Return license
End If
Next
End If
Return Nothing
End Function
' ++++++++++++++++++++++++++++++++++++++++++++++ Properties ++++++++++++++++++++++++++++++++++++++++++++++
'''
''' liefert eine Sammlung von Lizenzobjekten
'''
Public ReadOnly Property Licenses() As LicenseLegacy()
Get
Return _licenses
End Get
End Property
'''
''' liefert eine Lizenz an Hand des Modulnamens
'''
''' Name des zu suchenden Moduls
Public ReadOnly Property License(ByVal modulename As String) As LicenseLegacy
Get
Return GetLicense(modulename)
End Get
End Property
'''
''' Liefert oder setzt den Firmennamen des Lizenzeigentümers
'''
Public Property Company() As String
Public Property machine() As String
End Class