EasyLic.NET

EasyLic Documentation

Here you will find the EasyLic documentation intended for developers to implement EasyLic into their software.

Using the library


The EasyLicManager is the class managing the license and providing your application with the information it needs.

Methods

Name Description
EasyLicManager(string SoftwareId) This will create an instance of the EasyLicManager for the software ID you received when registering
LoadLicenseFromFile(string Path) This will load a License file from the given path into EasyLicManager
LicenseResult RequestTrialLicense() Requests and loads a trial license from the EasyLic servers
LicenseResult RequestLicense(string ActivationKey) Requests and loads a full license from the EasyLic servers
string KeyValue(string Key) Returns the Value corresponding to the Key in the parameters set in the control panel

Properties

Name Description
LicenseType LicenseType The licensetype of the currently loaded license
Validity LicenseValidity The validity of the currently loaded license
int? DaysLeft Number of days remaining on this license. Null when no license loaded or no expiry date set on the license
DateTime? ExpiryDate DateTime indicating the expiry date of the license. Null when no license loaded or no expiry date set on the license
string MachineId The machine ID associated with the system running your software

Enumerations

LicenseType

The license type of the currently loaded license
LicenseType.None No license loaded
LicenseType.Trial Trial license loaded
LicenseType.Full Full license loaded

Validity

The validity of the currently loaded license
Validity.None No license loaded
Validity.InvalidSoftwareId The loaded license belongs to another software ID
Validity.InvalidMachineId The loaded license belongs to another machine ID
Validity.Expired The loaded license is expired
Validity.Valid The loaded license is valid

LicenseResult

This indicates the availability of the license (given the ActivationKey)
LicenseResult.UnknownKey The given activationkey is not known on the server
LicenseResult.LicenseExpired The license exists, but is expired (trial or full)
LicenseResult.NoTrialLicense A trial license was requested, but the subscription has no trial license available
LicenseResult.UniqueActivationsReached The license exists, but there are no more unique activations available
LicenseResult.Succes A valid license is available and has been loaded.

Examples

Initializing

        
                
//Initialize with the SoftwareId you received when registering
EasyLicManager licenseManager = new EasyLicManager("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
			
          

Checking for a valid license

        
                
//Check if a valid license is present
if(licenseManager.LicenseValidity == Validity.Valid)
{
    //Determine the type of license
    if(licenseManager.LicenseType == License.Full)
    {
        //Run full software
    }
    else if(licenseManager.LicenseType == License.Trial)
    {
        //Run trial software
    }
}
			
          

Requesting a trial license

        
                
//Check with the server if a valid trial license is available for this system
LicenseResult licenseResult = licenseManager.RequestTrialLicense(key);
if(licenseResult == LicenseResult.Succes)
{
    //A License is succesfully downloaded. Still, the Validity needs te be checked (as in the example above)
}
else
{
    //No valid license is available at the server. You can use the LicenseResult to give a
    //more detailed explanation to your end-user
}
			
          

Requesting a full license

        
                
string key = "xxxx-xxxx-xxxx-xxxx"; //The activationkey as entered by your end user
LicenseResult licenseResult = licenseManager.RequestLicense(key);
if(licenseResult == LicenseResult.Succes)
{
    //A License is succesfully downloaded. Still, the Validity needs te be checked (as in the example above)
}
else
{
    //No valid license is available at the server. You can use the LicenseResult to give a
    //more detailed explanation to your end-user
}