// TODO: IActiveLock.vb - Function GenerateShortKey - Update Comment /// <summary> /// GenerateShortKey ? Undocumented... /// </summary> /// <param name="SoftwareCode"></param> /// <param name="SerialNumber"></param> /// <param name="LicenseeAndRegisteredLevel"></param> /// <param name="Expiration"></param> /// <param name="LicType"></param> /// <param name="RegisteredLevel"></param> /// <param name="MaxUsers"></param> /// <returns></returns> /// <remarks></remarks> public string GenerateShortKey( string SoftwareCode, string SerialNumber, string LicenseeAndRegisteredLevel, string Expiration, ProductLicense.ALLicType LicType, int RegisteredLevel, [ System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute(1) ] ref short MaxUsers) { return(null); }
//=============================================================================== // Name: Function GetLicTypeString // Input: // LicType As ALLicType - License type object // Output: // String - License type, such as Period, Permanent, Timed Expiry or None // Purpose: Returns a string version of LicType // Remarks: None //=============================================================================== private string GetLicTypeString(ref ProductLicense.ALLicType LicType) { string functionReturnValue = null; //TODO: Implement this properly. if (LicType == ProductLicense.ALLicType.allicPeriodic) { functionReturnValue = "Periodic"; } else if (LicType == ProductLicense.ALLicType.allicPermanent) { functionReturnValue = "Permanent"; } else if (LicType == ProductLicense.ALLicType.allicTimeLocked) { functionReturnValue = "Timed Expiry"; } // default else { functionReturnValue = "None"; } return(functionReturnValue); }
//=============================================================================== // Name: Function CreateProductLicense // Input: // ByVal name As String - Product/Software Name // ByVal Ver As String - Product version // ByVal Code As String - Product/Software Code // ByVal Flags As ActiveLock3.LicFlags - License Flag // ByVal LicType As ActiveLock3.ALLicType - License type // ByVal Licensee As String - Registered party for which the license has been issued // ByVal RegisteredLevel As String - Registered level // ByVal Expiration As String - Expiration date // ByVal LicKey As String - License key // ByVal RegisteredDate As String - Date on which the product is registered // ByVal Hash1 As String - Hash-1 code // ByVal MaxUsers As Integer - Maximum number of users allowed to use this license // Output: // ProductLicense - License object // Purpose: Instantiates a new ProductLicense object from the specified parameters. // <p>If <code>LicType</code> is <i>Permanent</i>, then <code>Expiration</code> date parameter will be ignored. // Remarks: None //=============================================================================== public ProductLicense CreateProductLicense(string Name, string Ver, string Code, ProductLicense.LicFlags Flags, ProductLicense.ALLicType LicType, string Licensee, string RegisteredLevel, string Expiration, [System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute("")] // ERROR: Optional parameters aren't supported in C# string LicKey, [System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute("")] // ERROR: Optional parameters aren't supported in C# string RegisteredDate, [System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute("")] // ERROR: Optional parameters aren't supported in C# string Hash1, [System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute(1)] // ERROR: Optional parameters aren't supported in C# short MaxUsers, [System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute("")] // ERROR: Optional parameters aren't supported in C# string LicCode) { ProductLicense NewLic = new ProductLicense(); { NewLic.ProductName = Name; NewLic.ProductKey = Code; NewLic.ProductVer = Ver; //If LicType = allicNetwork Then // .LicenseClass = alfMulti //Else NewLic.LicenseClass = GetClassString(ref Flags); //End If NewLic.LicenseType = LicType; NewLic.Licensee = Licensee; NewLic.RegisteredLevel = RegisteredLevel; NewLic.MaxCount = MaxUsers; // ignore expiration date if license type is "permanent" if (LicType != ProductLicense.ALLicType.allicPermanent) { NewLic.Expiration = Expiration; } //IsMissing() was changed to IsNothing() if ((LicKey != null)) { NewLic.LicenseKey = LicKey; } //IsMissing() was changed to IsNothing() if ((RegisteredDate != null)) { NewLic.RegisteredDate = RegisteredDate; } //IsMissing() was changed to IsNothing() if ((Hash1 != null)) { NewLic.Hash1 = Hash1; } // New in v3.1 // LicenseCode is appended to the end so that we can know // Alugen specified the hardware keys, and LockType // was not specified by the protected app //IsMissing() was changed to IsNothing() if ((LicCode != null)) { if (!string.IsNullOrEmpty(LicCode)) { NewLic.LicenseCode = LicCode; } } } return(NewLic); }