Class LicenseKey
This class describes a License Key object. You can use it to verify a license,
store it in a file, or use some of its methods to update it.
Inheritance
System.Object
LicenseKey
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Cryptolens.Licensing.dll
Syntax
Properties
ActivatedMachines
Declaration
public List<ActivationData> ActivatedMachines { get; set; }
Property Value
AllowedMachines
Declaration
public string AllowedMachines { get; set; }
Property Value
Type |
Description |
System.String |
|
Block
Declaration
public bool Block { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Created
Declaration
public DateTime Created { get; set; }
Property Value
Type |
Description |
System.DateTime |
|
Customer
Declaration
public Customer Customer { get; set; }
Property Value
DataObjects
Declaration
public List<DataObject> DataObjects { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.List<DataObject> |
|
Expires
Declaration
public DateTime Expires { get; set; }
Property Value
Type |
Description |
System.DateTime |
|
F1
Declaration
public bool F1 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
F2
Declaration
public bool F2 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
F3
Declaration
public bool F3 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
F4
Declaration
public bool F4 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
F5
Declaration
public bool F5 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
F6
Declaration
public bool F6 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
F7
Declaration
public bool F7 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
F8
Declaration
public bool F8 { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
GlobalId
Declaration
public long GlobalId { get; set; }
Property Value
Type |
Description |
System.Int64 |
|
ID
Declaration
public int ID { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Key
Declaration
public string Key { get; set; }
Property Value
Type |
Description |
System.String |
|
MaxNoOfMachines
Declaration
public int MaxNoOfMachines { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Notes
Declaration
public string Notes { get; set; }
Property Value
Type |
Description |
System.String |
|
Period
Declaration
public int Period { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
ProductId
Declaration
public int ProductId { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
RawResponse
Declaration
public RawResponse RawResponse { get; set; }
Property Value
Reseller
Declaration
public Reseller Reseller { get; set; }
Property Value
Signature
Declaration
public string Signature { get; set; }
Property Value
Type |
Description |
System.String |
|
SignDate
Declaration
public DateTime SignDate { get; set; }
Property Value
Type |
Description |
System.DateTime |
|
TrialActivation
Declaration
public bool TrialActivation { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
AddDataObject(String, DataObject)
Declaration
public long AddDataObject(string token, DataObject dataObject)
Parameters
Returns
Type |
Description |
System.Int64 |
Returns the id of the data object (and updates the DataObjects) if successful, or -1 otherwise.
|
AddFeature(String, Int32)
Gets the new version of this license from SKM. Note, you need to manually assign the new value to this object, eg,
by license = license.Refresh("token");
Declaration
public bool AddFeature(string token, int feature)
Parameters
Returns
Type |
Description |
System.Boolean |
Returns a true if successful and false otherwise.
|
Exceptions
Type |
Condition |
System.ArgumentException |
If the feature value is incorrect.
|
DaysLeft(Boolean)
Returns the number of days left for a given license (time left). This method is particularly useful
when KeyInfo is not updated regularly, because TimeLeft will not be affected (stay constant).
If your implementation checks the license with the server periodically, this method should be used instead of TimeLeft.
Declaration
public int DaysLeft(bool zeroIfExpired = false)
Parameters
Type |
Name |
Description |
System.Boolean |
zeroIfExpired |
If true, when a license has expired, zero will be returned.
|
Returns
Type |
Description |
System.Int32 |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
FromResponse(String, RawResponse)
Creates a license key from a RawResponse object that can be obtained when calling
.
Declaration
public static LicenseKey FromResponse(string RSAPubKey, RawResponse response)
Parameters
Type |
Name |
Description |
System.String |
RSAPubKey |
|
RawResponse |
response |
|
Returns
Refresh(String)
Gets the new version of this license from SKM. By default, if the Signature field
ís not null and not empty, SKM will sign the new data too. You can also require this explicitly
by calling Refresh(String, Boolean), and setting the second parameter to 'true'.
Declaration
public bool Refresh(string token)
Parameters
Returns
Type |
Description |
System.Boolean |
Returns true if successful or false otherwise.
|
Refresh(String, Boolean)
Gets the new version of this license from SKM.
Declaration
public bool Refresh(string token, bool sign)
Parameters
Returns
Type |
Description |
System.Boolean |
Returns true if successful or false otherwise.
|
RemoveDataObject(String, Int32)
This method will remove an existing data object.
Declaration
public bool RemoveDataObject(string token, int dataObjectId)
Parameters
Returns
Type |
Description |
System.Boolean |
Returns true if successful or false otherwise.
|
Extension Methods