[ActiveLock-Development] CVS: activelock/src ProductLicense.cls,1.2,1.3
Brought to you by:
ialkan
From: Thanh H. T. <th...@us...> - 2003-10-13 08:42:00
|
Update of /cvsroot/activelock/activelock/src In directory sc8-pr-cvs1:/tmp/cvs-serv29374 Modified Files: ProductLicense.cls Log Message: Handle CRLF within liberation key. Index: ProductLicense.cls =================================================================== RCS file: /cvsroot/activelock/activelock/src/ProductLicense.cls,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ProductLicense.cls 13 Oct 2003 04:49:03 -0000 1.2 +++ ProductLicense.cls 13 Oct 2003 08:41:56 -0000 1.3 @@ -65,6 +65,9 @@ ' 07.07.03 - mecrute - Updated the header comments for this file. ' 08.03.03 - th2tran - VBDox'ed this class. ' 10.12.03 - th2tran - Added VB doc Attributes for showing in VB Object Browser +' - Load() now drops CRLF chars from the liberation key. +' This allows users to format the key into nice 64-byte +' for better readability. ' </pre> @@ -103,8 +106,8 @@ '' ' [INTERNAL] Specifies product name. ' -Friend Property Let ProductName(name As String) - mstrProductName = name +Friend Property Let ProductName(ByVal Name As String) + mstrProductName = Name End Property '' @@ -119,7 +122,7 @@ '' ' [INTERNAL] Specified product version. ' -Friend Property Let ProductVer(Ver As String) +Friend Property Let ProductVer(ByVal Ver As String) mstrProductVer = Ver End Property @@ -139,7 +142,7 @@ ' if you call this method without knowing what you are doing. ' @param Key Product Key ' -Public Property Let ProductKey(Key As String) +Public Property Let ProductKey(ByVal Key As String) Attribute ProductKey.VB_Description = "Product Key." mstrProductKey = Key End Property @@ -155,7 +158,7 @@ '' ' [INTERNAL] Specifies license type. ' -Friend Property Let LicenseType(LicType As String) +Friend Property Let LicenseType(ByVal LicType As String) mstrType = LicType End Property @@ -171,7 +174,7 @@ '' ' [INTERNAL] Specifies the license class string. ' -Friend Property Let LicenseClass(LicClass As String) +Friend Property Let LicenseClass(ByVal LicClass As String) mstrLicenseClass = LicClass End Property @@ -187,8 +190,8 @@ '' ' [INTERNAL] Specifies the licensed user. ' -Friend Property Let Licensee(name As String) - mstrLicensee = name +Friend Property Let Licensee(ByVal Name As String) + mstrLicensee = Name End Property '' @@ -207,7 +210,7 @@ ' ' @param Key New license key to be updated. ' -Public Property Let LicenseKey(Key As String) +Public Property Let LicenseKey(ByVal Key As String) Attribute LicenseKey.VB_Description = "License key." mstrLicenseKey = Key End Property @@ -224,7 +227,7 @@ ' [INTERNAL] Specifies expiration data. ' @param strData expiration date string ' -Friend Property Let Expiration(strDate As String) +Friend Property Let Expiration(ByVal strDate As String) mstrExpiration = strDate End Property @@ -249,7 +252,7 @@ '' ' [INTERNAL] Specifies the registered date. ' @param strDate registered date -Friend Property Let RegisteredDate(strDate As String) +Friend Property Let RegisteredDate(ByVal strDate As String) mstrRegisteredDate = strDate End Property @@ -266,7 +269,7 @@ ' [INTERNAL] Sets the last used date. ' @param strDateTime DateTime string ' -Friend Property Let LastUsed(strDateTime As String) +Friend Property Let LastUsed(ByVal strDateTime As String) mstrLastUsed = strDateTime End Property @@ -282,7 +285,7 @@ '' ' [INTERNAL] Sets the Hash-1 code. ' -Friend Property Let Hash1(hcode As String) +Friend Property Let Hash1(ByVal hcode As String) mstrHash1 = hcode End Property @@ -308,12 +311,15 @@ ' Loads the license from a formatted string created from <a href="ProductLicense.Save.html">Save()</a>. ' @param strLic Formatted license string, delimited by CrLf characters. ' -Public Sub Load(strLic As String) +Public Sub Load(ByVal strLic As String) Attribute Load.VB_Description = "Loads the license from a formatted string created by Save() method." - ' First, base64-decode it + ' First, take out all crlf characters + strLic = Replace(strLic, vbCrLf, "") + ' base64-decode it strLic = modBase64.Base64_Decode(strLic) Dim arrParts() As String arrParts = Split(strLic, vbCrLf) + ' Initialize appropriate properties ProductName = arrParts(0) ProductVer = arrParts(1) ProductKey = arrParts(2) @@ -329,7 +335,7 @@ ' Saves the license into a formatted string. ' @param strOut [out] Formatted license string will be saved into this parameter when the routine returns. ' -Public Sub Save(strOut As String) +Public Sub Save(ByRef strOut As String) Attribute Save.VB_Description = "Saves the license into a formatted string." strOut = ToString() & vbCrLf & LicenseKey 'add License Key at the end strOut = modBase64.Base64_Encode(strOut) |