Overview

The LicenseSpot Framework is a client library that goes along with your app and allows you to easily add protection and integrate with LicenseSpot. The library is a .NET component that is available for free as a NuGet package. All communication between the library and LicenseSpot is made via SSL and a secure channel. Essential methods like Activation and IsGenuineEx are also digitally signed to prevent spoofing. Below you can find information about the classes, methods and properties.

ExtendedLicense

The ExtendedLicense class contains all the main methods to manage and activate a license. It's the class you'll be interacting the most during the integration process.

string Activate()

The Activate method will activate a license with LicenseSpot and automatically download the license file and save it locally in the default location. The default location is c:\ProgramData\IPManager. The serial number used to activate the license is taken from the property SerialNumber. The default file name is license.lic. The contents of the license file will also be returned.

Activate(string serialNumber)

The Activate method will activate a license with LicenseSpot and automatically download the license file and save it locally in the default location. The default location is c:\ProgramData\IPManager. The serial number used to activate the license is taken from the serialNumber parameter. The default file name is license.lic. The contents of the license file will also be returned.

Activate(string serialNumber, bool saveFile)

The Activate method will activate a license with LicenseSpot and automatically download the license file. The file will be saved if the saveFile parameter is set to true. If it's false, the file won't be saved. The default location is c:\ProgramData\IPManager. The serial number used to activate the license is taken from the serialNumber parameter. The default file name is license.lic. The contents of the license file will also be returned.

Activate(string serialNumber, bool saveFile, string fileName)

The Activate method will activate a license with LicenseSpot and automatically download the license file. The file will be saved if the saveFile parameter is set to true. If it's false, the file won't be saved. The default location is c:\ProgramData\IPManager. The serial number used to activate the license is taken from the serialNumber parameter. The filename is take from the fileName parameter. The contents of the license file will also be returned.

void Call()

The Call method generates a tracking log in LicenseSpot that allows to view statistics about how many times your app has been opened by the customer. This method is in beta.

string CheckIn()

The CheckIn method frees a connection on the license. This method is used when a network license limit is configured and only works in scenarios for floating licenses. It returns the contents of the license.

string CheckOut()

The CheckOut method takes a free connection from the license to allow your app to run. It checks out the connection using today's date. This method is used when a network license limit is configured and only works in scenarios for floating licenses. It returns the contents of the license.

string CheckOut(DateTime checkoutDate)

The CheckOut method takes a free connection from the license to allow your app to run. It checks out the connection using the date provided in the checkoutDate parameter. This method is used when a network license limit is configured and only works in scenarios for floating licenses. It returns the contents of the license.

DateTime CreatedDate

Gets the date when the license was created.

bool Deactivate()

Deactivates a license activation. This method will automatically get the Hardware ID of the current computer and deactivate the activation that has that hardware ID. If more than one exists, then all of the activations related to the same hardware ID will deactivated. It returns wether the license still IsGenuine.

void DisableSecureStorage()

Will disable the usage of the local secure storage. The local secure storage have information about the last time a license was checked against the server and other parameters that help preventing from the user tampering with the system clock to extends trials and other information.

void FromXmlString(string xml)

Reads a license given the xml provided in the xml parameter. It'll replace any currently loaded license.

string GetProperty(string name)

Gets the value of a property or custom field defined on the license. The property is configured in LicenseSpot as part of the license creation.

LimitTime GetTimeLimit()

Gets a reference of the time limit if one has been configured on the license. In here you can access configuration about the limit.

LimitTrial GetTrialLimit()

Gets a reference of the trial limit if one has been configured on the license. In here you can access configuration about the limit.

string HardwareID

Gets the hardware ID of the local computer. This is the same hardware ID used in the Activate() method as is the hardware ID that's used to create an offline activation.

string Heartbeat()

The heartbeat method sends a signal to the LicenseSpot to let it know that current connection that is checked out is still activate and that it shouldn't invoke the timeout action. It basically prevents LicenseSpot from timing out the connection. This method is used when a network license limit is configured and only works in scenarios for floating licenses. It returns the contents of the license.

string InvalidReason

Returns a string containing a message describing why an error or exception ocurred. It's usually and friendly message for the user. It contains the last error that happened.

bool IsActivated

Returns true if an activation is found on the license. Returns false if the license has never been activated.

bool IsActivation

Returns true if the license supports activation, in essence, has the activation limit configured.

bool IsBeta

Returns true if the license has the beta limit configured.

bool IsEmpty

Returns true if there's no license loaded on the ExtendedLicense class.

bool IsGenuine()

The IsGenuine method checks the license is valid on the LicenseSpot server. It checks it hasn't been revoked, that the local hardware ID of the computer matches the hardware ID on the activation on the server, that the activation is active on the server and if there's a network limit, verifies the connection is still activate and hasn't timed out. By default, it doesn't validate the local license is valid. Returns true if all of the previous checks are valid.

bool IsGenuine(bool validate, string publicKey)

 The IsGenuine method checks the license is valid on the LicenseSpot server. It checks it hasn't been revoked, that the local hardware ID of the computer matches the hardware ID on the activation on the server, that the activation is active on the server and if there's a network limit, verifies the connection is still activate and hasn't timed out. If the validate parameter is set to true, then it'll also validate the local license is valid and that it hasn't been tampered. If validate is set to true, you'll also need to pass the publicKey parameter to use to validate the local license signature. Returns true if all of the previous checks are valid.

GenuineResult IsGenuineEx()

The IsGenuineEx method checks the license is valid on the LicenseSpot server. It checks it hasn't been revoked, that the local hardware ID of the computer matches the hardware ID on the activation on the server, that the activation is active on the server and if there's a network limit, verifies the connection is still activate and hasn't timed out. It'll also validate the local license is valid and that it hasn't been tampered. By default, it'll check with the server every 90 days (even if it's called multiple times during the 90 days). Returns a GenuineResult enum with any of the three options:

  • Genuine: means the license is valid, on the server and the local license file.
  • NotGenuine: means the license validation fail, either on the server or locally.
  • InternetError: there was an error connecting to the LicenseSpot server.

GenuineResult IsGenuineEx(int days)

The IsGenuineEx method checks the license is valid on the LicenseSpot server. It checks it hasn't been revoked, that the local hardware ID of the computer matches the hardware ID on the activation on the server, that the activation is active on the server and if there's a network limit, verifies the connection is still activate and hasn't timed out. It'll also validate the local license is valid and that it hasn't been tampered. The days parameter indicates how often to check witg the LicenseSpot server. If set to zero, it'll check every time the method is called. Returns a GenuineResult enum with any of the three options:

  • Genuine: means the license is valid, on the server and the local license file.
  • NotGenuine: means the license validation fail, either on the server or locally.
  • InternetError: there was an error connecting to the LicenseSpot server.

bool IsNetwork

Returns true if the license has the network limit configured.

bool IsSubscription

Returns true if the license has the subscription limit configured.

bool IsSubscriptionActive

Validates with the LicenseSpot server if the subscription limit is active.

bool IsSubscriptionActiveSerial(string serialNumber)

Validates with the LicenseSpot server if the subscription limit is active for the specified serial number.

bool IsSubscriptionActiveSerial(string serialNumber, bool validate, string publicKey)

Validates with the LicenseSpot server if the subscription limit is active for the specified serial number. It'll also validate the local license file is ok if the validate parameter is true. If a publicKey is specified, it'll validate the local license using the public key.

bool IsTrial

Returns true if the license has a trial limit configured.

Type LicensedType

Returns the object type of the class being licensed.

LicenseFile LicenseFile

Returns an instance of LicenseFile containing information about the local license file.

List<Limit> Limits

Gets a list of the currently configured limits on the license.

List<Propertty> Properties

Gets a list of the currently configured custom properties on the license.

IWebProxy Proxy

Allows you to configure a proxy that will be used to connect to the LicenseSpot server. Only use this if your customers are behind a proxy and can't connect directly to the Internet.

string PublicKey

Gets or sets the public key to be used to validate the local license.

void Refresh()

Gets the license from the LicenseSpot server with any updated values. It'll replace the current license file automatically.

string SerialNumber

Gets the serial number of the license file.

int TrialDaysRemaining()

Gets the number of trial days remaining in the license. It needs to have a trial limit for it to work.

bool Validate()

Validates the local license file is valid and that it hasn't been tampered with. It does the validation using the public key and verifying the signature on the local license file is still valid. It doesn't check the license is genuine with the LicenseSpot server.

ExtendedLicenseManager

ExtendedLicenseManager manages the license file and automatically tries to figure out where the license is located. It can also look for a license file given a specified path.

ExtendedLicense GetLicense(string publicKey)

The GetLicense method automatically tries to locate the local license file in the computer is running on. It'll try to locate it in the same directory that the application is running, in the ProgramData\IPManager folder or if it's an ASP.NET application, it'll try to locate the file in the App_Data folder. The public key parameter will be used to validate the license signature for tampering. It returns an ExtendedLicense object.

ExtendedLicense GetLicense(Type type, object instance)

The GetLicense method automatically tries to locate the local license file in the computer is running on. It'll try to locate it in the same directory that the application is running, in the ProgramData\IPManager folder or if it's an ASP.NET application, it'll try to locate the file in the App_Data folder. The type and the instance parameter will be used to try to locate the public key in the executing assembly (for this to work, it needs to be embedded and the file needs to be named runtime.lic). It returns an ExtendedLicense object.

ExtendedLicense GetLicense(Type type, object instance, LicenseValidationInfo info)

The GetLicense method automatically tries to locate the local license file in the computer is running on. It'll try to locate it in the same directory that the application is running, in the ProgramData\IPManager folder or if it's an ASP.NET application, it'll try to locate the file in the App_Data folder. The type and the instance parameter will be used to try to locate the public key in the executing assembly (for this to work, it needs to be embedded and the file needs to be named runtime.lic). The info parameter is used to locate the license file in the given path on the LicenseValidationInfo object. It returns an ExtendedLicense object.

ExtendedLicense GetLicense(Type type, object instance, string publicKey)

The GetLicense method automatically tries to locate the local license file in the computer is running on. It'll try to locate it in the same directory that the application is running, in the ProgramData\IPManager folder or if it's an ASP.NET application, it'll try to locate the file in the App_Data folder. The type and the instance parameter will be used to try to locate the public key in the executing assembly (for this to work, it needs to be embedded and the file needs to be named runtime.lic). The public key parameter will be used to validate the license signature for tampering. It returns an ExtendedLicense object.

ExtendedLicense GetLicense(Type type, object instance, LicenseValidationInfo info, string publicKey)

The GetLicense method automatically tries to locate the local license file in the computer is running on. It'll try to locate it in the same directory that the application is running, in the ProgramData\IPManager folder or if it's an ASP.NET application, it'll try to locate the file in the App_Data folder. The type and the instance parameter will be used to try to locate the public key in the executing assembly (for this to work, it needs to be embedded and the file needs to be named runtime.lic). The info parameter is used to locate the license file in the given path on the LicenseValidationInfo object. The public key parameter will be used to validate the license signature for tampering. It returns an ExtendedLicense object.

SaveNewFile(string content)

Saves the a local license file in the same folder the application is installed. The content parameter contains the content of the license file.

SaveNewFile(string content, string path)

Saves the a local license file in the same folder the application is installed. The content parameter contains the content of the license file.T The path parameter indicates where to save the license file.