LicenseSpring .Net SDK 7.32.1
Easily add Software Licensing to your application
Loading...
Searching...
No Matches
LicenseSpring.License Class Reference

License class, implements ILicense interface. More...

Inheritance diagram for LicenseSpring.License:
LicenseSpring.ILicense

Public Member Functions

void AddDeviceVariable (DeviceVariable variable)
 Add new or update existing device variable to license data.Variable will be stored in local license, in order to send device variables to the backend see License.SendDeviceVariables
 
void AddDeviceVariable (string name, string value)
 Add new or update existing device variable to license data.Variable will be stored in local license, in order to send device variables to the backend see License.SendDeviceVariables
 
void AddDeviceVariables (DeviceVariable[] variables)
 Add new or update existing device variables to license data.Variables will be stored in local license, in order to send device variables to the backend see License.SendDeviceVariables
 
void Borrow (DateTime endDateTime)
 Borrow floating license till provided end date time.Meaningful only for floating licenses.
 
void Borrow (string borrowEndDateTime=null)
 Borrow floating license till provided end date time string.Meaningful only for floating licenses. During borrow period there is no need to register floating license to keep it alive. Sets AutoRelease to false so the license won't automatically Release before the borrow period ends.
 
void Borrow (uint hours, uint days=0)
 Borrow floating license for provided time interval.Meaningful only for floating licenses. During borrow period there is no need to register floating license to keep it alive. Sets AutoRelease to false so the license won't automatically Release before the borrow period ends.
 
bool CanBorrow ()
 Is this license can be borrowed or not.Equivalent to check MaxBorrowTime() > 0. Meaningful only for floating licenses.
 
bool ChangePassword (string password, string newPassword)
 Change password for user-based license.Does the same as LicenseManager.ChangePassword
 
InstallationFile Check (IInstallationFileOptions options=null, bool includeExpiredFeatures=false)
 Check current license for validity on the LicenseSpring platform.
Parameters
optionsOptional, using options you can filter install files by channel and environment.
includeExpiredFeaturesOptional, default false. If set to true updates local license data to include expired license features.
Returns
The most recent InstallationFile available for the license (useful for managing software updates). Returns null in case request failed and grace period started.
Exceptions
LicenseSpring.LicenseInactiveExceptionThrown when license is inactive
LicenseSpring.LicenseDisabledExceptionThrown when license is disabled
LicenseSpring.LicenseExpiredExceptionThrown when license is expired
LicenseSpring.MaxFloatingReachedExceptionIn case all floating slots are busy.
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

 
ConsumptionPeriod ConsumptionPeriod ()
 Period of time after which consumption is reset.Meaningful only for Consumption license.
 
CustomField[] CustomFields ()
 Custom data fields available for the license.
Returns
Array of CustomField objects available for the license

 
int DaysPassedSinceLastCheck ()
 How many days passed since last online check.
Returns
Days count since license was checked online

 
int DaysRemaining ()
 How many days remaining till license expires in current time zone.Days counter will be changed in local midnight.
 
int DaysRemainingUTC ()
 How many days remaining till license expires.Days counter will be changed in midnight by UTC. 0 means license expires today. For Subscription license it also counts grace period if set.
 
bool Deactivate (bool removeLocalData=false)
 Deactivate current license.
Parameters
removeLocalDataShould local license files and folders created by the SDK be removed after deactivation, default false.Equivalent to call LicenseManager.ClearLocalStorage after deactivation.
If you are going to uninstall your application you probably should call LicenseManager.ClearLocalStorage afterwards or just set removeLocalData param to true.
 
void DeactivateAirGap (string code)
 Verify Confirmation code and deactivate air gap license.Available only in .NET Framework 4.7 or greater, .NET Standard, .NET 5.0 and later versions.
 
string DeactivateOffline (string deactivationRequestFile=null)
 Deactivate license locally and create offline deactivation file request.If you are going to uninstall your application you probably should call LicenseManager.ClearLocalStorage afterwards.
 
DeviceVariable DeviceVariable (string name)
 Get device variable by name.Returns empty device variable if the variable does not exist
 
string DeviceVariableValue (string name)
 Get device variable value by name.
Parameters
nameDevice variable name
Returns
Device variable value or empty string if variable does not exist

 
LicenseFeature Feature (string featureCode)
 Get product (license) feature by feature code.
Returns
LicenseFeature objects or throws exception if there is no such feature
Parameters
featureCodeFeature identifier (code)

 
LicenseFeature[] Features ()
 Product features available for the license.
Returns
Array of LicenseFeature objects available for the license

 
string FloatingClientId ()
 Floating user (client) or instance id.Meaningful only for offline floating license.
 
DateTime FloatingEndDateTime ()
 Floating license validity end date time in local time zone.Meaningful only for floating licenses, if license is borrowed this method returns borrowedUntil date time.
 
DateTime FloatingEndDateTimeUtc ()
 Floating license validity end date time in UTC.Meaningful only for floating licenses, if license is borrowed this method returns borrowedUntil date time in UTC.
 
uint FloatingSlotsCount ()
 Overall Floating slots or users count. Amount of simultaneous users (instances) allowed for this license.Meaningful only for Floating license.
 
uint FloatingSlotsInUse ()
 Current floatings slots in use count, including this user (instance).Meaningful only for Floating license, please query this value only after online license check or registration (for Offline floating).
 
uint FloatingTimeout ()
 Floating timeout in minutes.Meaningful only for Floating license.
 
string GetAirGapDeactivationCode (string initializationCode)
 Get air gap Deactivation code.Available only in .NET Framework 4.7 or greater, .NET Standard, .NET 5.0 and later versions.
 
DeviceVariable[] GetDeviceVariables (bool getFromBackend=false)
 Get device variables from the local license or from the backend.This method does not throw exceptions if you getting variables list from local license.
 
ProductDetails GetProductDetails ()
 Get information about a product this license belongs to.ProductDetails is always available for offline activated license. This method does not perform any network requests and does not throw exceptions.
 
DateTime GracePeriodEndDateTime ()
 Getter for grace period end date time in local time.
Returns
The DateTime when grace period expires in local time

 
DateTime GracePeriodEndDateTimeUTC ()
 Getter for grace period end date time in UTC.
Returns
The DateTime when grace period expires in UTC

 
double GracePeriodHoursRemaining ()
 How many hours remaining till grace period ends.
Returns
Double value representing hours remaining till grace period ends

 
LicenseID Id ()
 License ID.
Returns
License ID, license key or email and password

 
bool IsAirGapped ()
 Was this license activated using air-gap activation.
Returns
Boolean value indicating whether license was activated air-gap

 
bool IsBorrowed ()
 Checker for whether the license is borrowed.Meaningful only for Floating license, see License.Borrow
 
bool IsConsumptionOverageAllowed ()
 Is it allowed to exceed consumption for this license.Meaningful only for Consumption based license.
 
bool IsConsumptionResetEnabled ()
 Indicates whether consumption resets after a certain period of time.Meaningful only for Consumption license.
 
bool IsDeviceTransferAllowed ()
 Checks if license can be transfered between devices.
Returns
True if license is transferable between devices, otherwise returns false.

 
bool IsDeviceTransferLimited ()
 Checks if the license allows only limited number of transfers between devices.
Returns
True if license device transfers are limited, otherwise returns false.

 
bool IsExpired ()
 Is license expired.
Returns
Boolean value indicating whether license have been expired

 
bool IsFloating ()
 Is this license floating.
Returns
Boolean value indicating whether license is floating

 
bool IsGracePeriodStarted ()
 Check if grace period started for a license.
Returns
Returns true if grace period started and false otherwise.

 
bool IsMaintenancePeriodExpired ()
 Is maintenance period expired.
Returns
Boolean value indicating whether maintenance period have been expired for current license

 
bool IsNegativeConsumptionAllowed ()
 Is negative consumption allowed for the license.Meaningful only for Consumption based license.
 
bool IsOfflineActivated ()
 Was this license activated offline.
Returns
Boolean value indicating whether license was activated offline

 
bool IsSubscriptionGracePeriodStarted ()
 Check if grace period started for subscription license.Meaningful only for Subscription licenses
 
bool IsTrial ()
 Is this license trial.
Returns
Boolean value indicating whether license is trial

 
bool IsUnlimitedConsumptionAllowed ()
 Is unlimited consumption allowed for the license.Meaningful only for Consumption based license.
 
bool IsValid ()
 Fast and simple way to check current local state of the license.Equivalent to Status().IsOk() and !IsExpired()
 
string Key ()
 License key.
Returns
License key as string or null if not available (in case of user-based product)

 
DateTime LastCheckDate ()
 The DateTime of the last sync with the LicenseSpring platform.In other words - DateTime of the last online license check.
 
DateTime LastCheckDateUTC ()
 The DateTime of the last sync with the LicenseSpring platform.In other words - DateTime of the last online license check.
 
 License ()
 Default constructor, creates invalid license.
 
LicenseUser LicenseUser ()
 License user.
Returns
License user or null if not available

 
void LocalCheck ()
 Perform check for license validity locally.Local check do not establish any connections to the LicenseSpring platform, so it can be used in offline mode.
 
int MaintenanceDaysRemaining ()
 How many days remaining till maintenance period expires in current time zone.Days counter will be changed in local midnight. Returns int.MaxValue in case maintenance period unlimited or not specified.
 
DateTime MaintenancePeriod ()
 Maintenance period for the license.
Returns
The DateTime when maintenance expires in local time

 
DateTime MaintenancePeriodUTC ()
 Maintenance period for the license.
Returns
The DateTime when maintenance expires in UTC

 
uint MaxActivations ()
 How many times license can be activated.
Returns
Maximum number of activations for the license.

 
uint MaxBorrowTime ()
 Maximum borrowing period in hours.Meaningful only for floating license.
 
int MaxConsumption ()
 Maximum consumption of the license.Meaningful only for Consumption based license.
 
int MaxConsumptionOverage ()
 Extra amount of consumption that allows to go over MaxConsumption.Meaningful only for Consumption based license.
 
string Metadata ()
 License metadata.
Returns
Json with license metadata

 
string OrderStoreId ()
 Order store id.
Returns
Order store id that can be found on the LicenseSpring portal.

 
Customer Owner ()
 Gets the information about license owner, commonly it's a person or organization associated with the license.Please note some fields of the Customer object can be empty or null(unavailable)
 
uint PolicyId ()
 License Policy id.Currently meaningful only for air-gap activated license.
 
void Register ()
 Register floating license and occupy floating slot.This is equivalent to check license online. See also SetupLicenseWatchdog. In order to keep floating license alive you should check in (register) it periodically.
 
void RegisterFloatingFeature (ILicenseFeature licenseFeature)
 Register a floating feature and occupy a floating slot.Meaningful only for floating features. In order to keep the floating feature alive, you should register it periodically.
 
void Release (bool throwExceptions=false)
 Stop license watchdog thread and revoke floating license so other user can use it.It's important to call this function if you use floating license or watchdog.
 
void ReleaseFloatingFeature (ILicenseFeature licenseFeature)
 Release a floating feature and free a license slot.Meaningful only for floating features.
 
void ResumeLicenseWatchdog ()
 Restart background thread, you can call this within you callback in order to resume periodic license checks.Using this function is a little faster than running new watchdog. Does nothing if watchdog was not set up.
 
bool SendDeviceVariables ()
 Send current device variables list to the backend (see device variables on the platform)Please note this data will be linked to the current running device ID.
 
void SetupFloatingFeatureWatchdog (LicenseWatchdogCallback callback, bool runCallbackOnEveryCheck=false)
 Initialize and run the floating feature watchdog, a background thread that periodically checks registered floating features and by doing so keeps them alive.
Parameters
callbackFuncion called when an exception is thrown or after every feature check if runCallbackOnEveryCheck is set to true.
runCallbackOnEveryCheckIf true callback will be called after every feature check, if false only in case of exceptions. Default value is false.

 
void SetupLicenseWatchdog (LicenseWatchdogCallback callback, uint timeout=0)
 Setup and run license watchdog, a background thread which periodically checks the license, by so keeping it alive.This is especially useful for floating licenses, but can be used for any.
 
void SetupLicenseWatchdog (LicenseWatchdogSettings settings)
 Setup and run license watchdog, a background thread which periodically checks the license, by so keeping it alive.This is especially useful for floating licenses, but can be used for any.
 
void SetWatchdogTimeout (uint timeout=0)
 Set new timout for license watchdog.This method does not restart the watchdog, it sets a new timeout for the running watchdog or before calling ResumeLicenseWatchdog.
 
DateTime StartDate ()
 License start date.
Returns
The DateTime when license can be activated

 
void StartFloatingFeatureWatchdog ()
 Starts the floating feature watchdog by unpausing the background thread. Does nothing if the floating feature watchdog wasn't previously initialized or is already running.Watchdog will stop automatically in case an exception other than a LicenseServerException or NetworkException is thrown or it can be stoped manually by calling StopFloatingFeatureWatchdog.
 
LicenseStatus Status ()
 Method for getting local license status, see LicenseStatus documentation.
Returns
LicenseStatus object for this license

 
void StopFloatingFeatureWatchdog ()
 Stops the floating feature watchdog by pausing the background thread. Does nothing if the floating feature watchdog wasn't previously initialized or is already stoped.Watchdog will stop automatically in case an exception other than a LicenseServerException or NetworkException is thrown
 
void StopLicenseWatchdog ()
 Stops license watchdog background thread.This method does not revoke floating license, just stops the watchdog.
 
uint SubscriptionGracePeriod ()
 Grace period in hours.Meaningful only for Subscription license.
 
bool SyncConsumption (OverageRequest overageRequest=null)
 Sync Consumption license with the LicenseSpring platform.Meaningful only for Consumption based license.
 
bool SyncFeatureConsumption (string featureCode=null)
 Sync Consumption feature with the LicenseSpring platform.Meaningful only for Consumption features.
 
uint TimesActivated ()
 How many times license already been activated.
Returns
Current number of activations for the license.

 
int TotalConsumption ()
 Current total consumption of the license.Meaningful only for Consumption based license.
 
uint TransferCount ()
 How many times license has been transferred between devices.
Returns
Transfer count of the license.

 
uint TransferLimit ()
 Maximum number of allowed license transfers between devices.
Returns
Maximum device transfer limit of the license, uint.MaxValue for unlimited device transfers, 0 if device transfers are not allowed.

 
LicenseType Type ()
 Type of license.
Returns
LicenseType

 
void UpdateConsumption (int value=1)
 Increase local consumption counter for consumption license.Meaningful only for Consumption based license.
 
void UpdateFeatureConsumption (string featureCode, int value=1)
 Increase local consumption counter for consumption product feature.Meaningful only for Consumption product features.
 
bool UpdateOffline (string path)
 Update license data accordingly to provided file.
Parameters
pathUpdate file path
Returns
True if license successfully updated and false otherwise
Exceptions
System.IO.FileNotFoundExceptionIf file cannot be found
System.IO.InvalidDataExceptionIf file content is empty or invalid
LicenseSpring.SignatureMismatchExceptionIn case signature in the file is not valid or missing

 
string User ()
 Email of the License user.
Returns
Email or null if not available (in case of key-based product)

 
DateTime ValidityPeriod ()
 The DateTime until the license is valid.
Returns
The DateTime when license expires in local time

 
DateTime ValidityPeriodUTC ()
 The DateTime until the license is valid.
Returns
The DateTime when license expires in UTC

 
DateTime ValidityWithGracePeriod ()
 The DateTime until the license is valid including grace period.Currently grace period meaningful only for Subscription licenses
 
DateTime ValidityWithGracePeriodUTC ()
 The DateTime until the license is valid including grace period.Currently grace period meaningful only for Subscription licenses
 

Static Public Attributes

const int MaxDaysRemainingValue = int.MaxValue
 Maximum value that can be returned by DaysRemaining, it equals to int.MaxValue
 

Properties

bool AutoRelease = false [get, set]
 Meaningful only for floating licenses, if set to true the License object will call Release(bool) in it's destructor, if false user must manually release the license. Will be set to false automatically when borrowing or releasing a license.Default value is false.
 
- Properties inherited from LicenseSpring.ILicense

Detailed Description

License class, implements ILicense interface.

Used for checking, editing, and deleting characteristics of a license.

Member Function Documentation

◆ AddDeviceVariable() [1/2]

void LicenseSpring.License.AddDeviceVariable ( DeviceVariable  variable)

Add new or update existing device variable to license data.Variable will be stored in local license, in order to send device variables to the backend see License.SendDeviceVariables

Implements LicenseSpring.ILicense.

◆ AddDeviceVariable() [2/2]

void LicenseSpring.License.AddDeviceVariable ( string  name,
string  value 
)

Add new or update existing device variable to license data.Variable will be stored in local license, in order to send device variables to the backend see License.SendDeviceVariables

Implements LicenseSpring.ILicense.

◆ AddDeviceVariables()

void LicenseSpring.License.AddDeviceVariables ( DeviceVariable[]  variables)

Add new or update existing device variables to license data.Variables will be stored in local license, in order to send device variables to the backend see License.SendDeviceVariables

Implements LicenseSpring.ILicense.

◆ Borrow() [1/3]

void LicenseSpring.License.Borrow ( DateTime  endDateTime)

Borrow floating license till provided end date time.Meaningful only for floating licenses.

Implements LicenseSpring.ILicense.

◆ Borrow() [2/3]

void LicenseSpring.License.Borrow ( string  borrowEndDateTime = null)

Borrow floating license till provided end date time string.Meaningful only for floating licenses. During borrow period there is no need to register floating license to keep it alive. Sets AutoRelease to false so the license won't automatically Release before the borrow period ends.

Implements LicenseSpring.ILicense.

◆ Borrow() [3/3]

void LicenseSpring.License.Borrow ( uint  hours,
uint  days = 0 
)

Borrow floating license for provided time interval.Meaningful only for floating licenses. During borrow period there is no need to register floating license to keep it alive. Sets AutoRelease to false so the license won't automatically Release before the borrow period ends.

Implements LicenseSpring.ILicense.

◆ CanBorrow()

bool LicenseSpring.License.CanBorrow ( )

Is this license can be borrowed or not.Equivalent to check MaxBorrowTime() > 0. Meaningful only for floating licenses.

Implements LicenseSpring.ILicense.

◆ ChangePassword()

bool LicenseSpring.License.ChangePassword ( string  password,
string  newPassword 
)

Change password for user-based license.Does the same as LicenseManager.ChangePassword

Implements LicenseSpring.ILicense.

◆ Check()

InstallationFile LicenseSpring.License.Check ( IInstallationFileOptions  options = null,
bool  includeExpiredFeatures = false 
)

Check current license for validity on the LicenseSpring platform.

Parameters
optionsOptional, using options you can filter install files by channel and environment.
includeExpiredFeaturesOptional, default false. If set to true updates local license data to include expired license features.
Returns
The most recent InstallationFile available for the license (useful for managing software updates). Returns null in case request failed and grace period started.
Exceptions
LicenseSpring.LicenseInactiveExceptionThrown when license is inactive
LicenseSpring.LicenseDisabledExceptionThrown when license is disabled
LicenseSpring.LicenseExpiredExceptionThrown when license is expired
LicenseSpring.MaxFloatingReachedExceptionIn case all floating slots are busy.
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implements LicenseSpring.ILicense.

◆ ConsumptionPeriod()

ConsumptionPeriod LicenseSpring.License.ConsumptionPeriod ( )

Period of time after which consumption is reset.Meaningful only for Consumption license.

Implements LicenseSpring.ILicense.

◆ CustomFields()

CustomField[] LicenseSpring.License.CustomFields ( )

Custom data fields available for the license.

Returns
Array of CustomField objects available for the license

Implements LicenseSpring.ILicense.

◆ DaysPassedSinceLastCheck()

int LicenseSpring.License.DaysPassedSinceLastCheck ( )

How many days passed since last online check.

Returns
Days count since license was checked online

Implements LicenseSpring.ILicense.

◆ DaysRemaining()

int LicenseSpring.License.DaysRemaining ( )

How many days remaining till license expires in current time zone.Days counter will be changed in local midnight.

Implements LicenseSpring.ILicense.

◆ DaysRemainingUTC()

int LicenseSpring.License.DaysRemainingUTC ( )

How many days remaining till license expires.Days counter will be changed in midnight by UTC. 0 means license expires today. For Subscription license it also counts grace period if set.

Implements LicenseSpring.ILicense.

◆ Deactivate()

bool LicenseSpring.License.Deactivate ( bool  removeLocalData = false)

Deactivate current license.

Parameters
removeLocalDataShould local license files and folders created by the SDK be removed after deactivation, default false.Equivalent to call LicenseManager.ClearLocalStorage after deactivation.
If you are going to uninstall your application you probably should call LicenseManager.ClearLocalStorage afterwards or just set removeLocalData param to true.

Implements LicenseSpring.ILicense.

◆ DeactivateAirGap()

void LicenseSpring.License.DeactivateAirGap ( string  code)

Verify Confirmation code and deactivate air gap license.Available only in .NET Framework 4.7 or greater, .NET Standard, .NET 5.0 and later versions.

Implements LicenseSpring.ILicense.

◆ DeactivateOffline()

string LicenseSpring.License.DeactivateOffline ( string  deactivationRequestFile = null)

Deactivate license locally and create offline deactivation file request.If you are going to uninstall your application you probably should call LicenseManager.ClearLocalStorage afterwards.

Implements LicenseSpring.ILicense.

◆ DeviceVariable()

DeviceVariable LicenseSpring.License.DeviceVariable ( string  name)

Get device variable by name.Returns empty device variable if the variable does not exist

Implements LicenseSpring.ILicense.

◆ DeviceVariableValue()

string LicenseSpring.License.DeviceVariableValue ( string  name)

Get device variable value by name.

Parameters
nameDevice variable name
Returns
Device variable value or empty string if variable does not exist

Implements LicenseSpring.ILicense.

◆ Feature()

LicenseFeature LicenseSpring.License.Feature ( string  featureCode)

Get product (license) feature by feature code.

Returns
LicenseFeature objects or throws exception if there is no such feature
Parameters
featureCodeFeature identifier (code)

Implements LicenseSpring.ILicense.

◆ Features()

LicenseFeature[] LicenseSpring.License.Features ( )

Product features available for the license.

Returns
Array of LicenseFeature objects available for the license

Implements LicenseSpring.ILicense.

◆ FloatingClientId()

string LicenseSpring.License.FloatingClientId ( )

Floating user (client) or instance id.Meaningful only for offline floating license.

Implements LicenseSpring.ILicense.

◆ FloatingEndDateTime()

DateTime LicenseSpring.License.FloatingEndDateTime ( )

Floating license validity end date time in local time zone.Meaningful only for floating licenses, if license is borrowed this method returns borrowedUntil date time.

Implements LicenseSpring.ILicense.

◆ FloatingEndDateTimeUtc()

DateTime LicenseSpring.License.FloatingEndDateTimeUtc ( )

Floating license validity end date time in UTC.Meaningful only for floating licenses, if license is borrowed this method returns borrowedUntil date time in UTC.

Implements LicenseSpring.ILicense.

◆ FloatingSlotsCount()

uint LicenseSpring.License.FloatingSlotsCount ( )

Overall Floating slots or users count. Amount of simultaneous users (instances) allowed for this license.Meaningful only for Floating license.

Implements LicenseSpring.ILicense.

◆ FloatingSlotsInUse()

uint LicenseSpring.License.FloatingSlotsInUse ( )

Current floatings slots in use count, including this user (instance).Meaningful only for Floating license, please query this value only after online license check or registration (for Offline floating).

Implements LicenseSpring.ILicense.

◆ FloatingTimeout()

uint LicenseSpring.License.FloatingTimeout ( )

Floating timeout in minutes.Meaningful only for Floating license.

Implements LicenseSpring.ILicense.

◆ GetAirGapDeactivationCode()

string LicenseSpring.License.GetAirGapDeactivationCode ( string  initializationCode)

Get air gap Deactivation code.Available only in .NET Framework 4.7 or greater, .NET Standard, .NET 5.0 and later versions.

Implements LicenseSpring.ILicense.

◆ GetDeviceVariables()

DeviceVariable[] LicenseSpring.License.GetDeviceVariables ( bool  getFromBackend = false)

Get device variables from the local license or from the backend.This method does not throw exceptions if you getting variables list from local license.

Implements LicenseSpring.ILicense.

◆ GetProductDetails()

ProductDetails LicenseSpring.License.GetProductDetails ( )

Get information about a product this license belongs to.ProductDetails is always available for offline activated license. This method does not perform any network requests and does not throw exceptions.

Implements LicenseSpring.ILicense.

◆ GracePeriodEndDateTime()

DateTime LicenseSpring.License.GracePeriodEndDateTime ( )

Getter for grace period end date time in local time.

Returns
The DateTime when grace period expires in local time

Implements LicenseSpring.ILicense.

◆ GracePeriodEndDateTimeUTC()

DateTime LicenseSpring.License.GracePeriodEndDateTimeUTC ( )

Getter for grace period end date time in UTC.

Returns
The DateTime when grace period expires in UTC

Implements LicenseSpring.ILicense.

◆ GracePeriodHoursRemaining()

double LicenseSpring.License.GracePeriodHoursRemaining ( )

How many hours remaining till grace period ends.

Returns
Double value representing hours remaining till grace period ends

Implements LicenseSpring.ILicense.

◆ Id()

LicenseID LicenseSpring.License.Id ( )

License ID.

Returns
License ID, license key or email and password

Implements LicenseSpring.ILicense.

◆ IsAirGapped()

bool LicenseSpring.License.IsAirGapped ( )

Was this license activated using air-gap activation.

Returns
Boolean value indicating whether license was activated air-gap

Implements LicenseSpring.ILicense.

◆ IsBorrowed()

bool LicenseSpring.License.IsBorrowed ( )

Checker for whether the license is borrowed.Meaningful only for Floating license, see License.Borrow

Implements LicenseSpring.ILicense.

◆ IsConsumptionOverageAllowed()

bool LicenseSpring.License.IsConsumptionOverageAllowed ( )

Is it allowed to exceed consumption for this license.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ IsConsumptionResetEnabled()

bool LicenseSpring.License.IsConsumptionResetEnabled ( )

Indicates whether consumption resets after a certain period of time.Meaningful only for Consumption license.

Implements LicenseSpring.ILicense.

◆ IsDeviceTransferAllowed()

bool LicenseSpring.License.IsDeviceTransferAllowed ( )

Checks if license can be transfered between devices.

Returns
True if license is transferable between devices, otherwise returns false.

Implements LicenseSpring.ILicense.

◆ IsDeviceTransferLimited()

bool LicenseSpring.License.IsDeviceTransferLimited ( )

Checks if the license allows only limited number of transfers between devices.

Returns
True if license device transfers are limited, otherwise returns false.

Implements LicenseSpring.ILicense.

◆ IsExpired()

bool LicenseSpring.License.IsExpired ( )

Is license expired.

Returns
Boolean value indicating whether license have been expired

Implements LicenseSpring.ILicense.

◆ IsFloating()

bool LicenseSpring.License.IsFloating ( )

Is this license floating.

Returns
Boolean value indicating whether license is floating

Implements LicenseSpring.ILicense.

◆ IsGracePeriodStarted()

bool LicenseSpring.License.IsGracePeriodStarted ( )

Check if grace period started for a license.

Returns
Returns true if grace period started and false otherwise.

Implements LicenseSpring.ILicense.

◆ IsMaintenancePeriodExpired()

bool LicenseSpring.License.IsMaintenancePeriodExpired ( )

Is maintenance period expired.

Returns
Boolean value indicating whether maintenance period have been expired for current license

Implements LicenseSpring.ILicense.

◆ IsNegativeConsumptionAllowed()

bool LicenseSpring.License.IsNegativeConsumptionAllowed ( )

Is negative consumption allowed for the license.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ IsOfflineActivated()

bool LicenseSpring.License.IsOfflineActivated ( )

Was this license activated offline.

Returns
Boolean value indicating whether license was activated offline

Implements LicenseSpring.ILicense.

◆ IsSubscriptionGracePeriodStarted()

bool LicenseSpring.License.IsSubscriptionGracePeriodStarted ( )

Check if grace period started for subscription license.Meaningful only for Subscription licenses

Implements LicenseSpring.ILicense.

◆ IsTrial()

bool LicenseSpring.License.IsTrial ( )

Is this license trial.

Returns
Boolean value indicating whether license is trial

Implements LicenseSpring.ILicense.

◆ IsUnlimitedConsumptionAllowed()

bool LicenseSpring.License.IsUnlimitedConsumptionAllowed ( )

Is unlimited consumption allowed for the license.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ IsValid()

bool LicenseSpring.License.IsValid ( )

Fast and simple way to check current local state of the license.Equivalent to Status().IsOk() and !IsExpired()

Implements LicenseSpring.ILicense.

◆ Key()

string LicenseSpring.License.Key ( )

License key.

Returns
License key as string or null if not available (in case of user-based product)

Implements LicenseSpring.ILicense.

◆ LastCheckDate()

DateTime LicenseSpring.License.LastCheckDate ( )

The DateTime of the last sync with the LicenseSpring platform.In other words - DateTime of the last online license check.

Implements LicenseSpring.ILicense.

◆ LastCheckDateUTC()

DateTime LicenseSpring.License.LastCheckDateUTC ( )

The DateTime of the last sync with the LicenseSpring platform.In other words - DateTime of the last online license check.

Implements LicenseSpring.ILicense.

◆ LicenseUser()

LicenseUser LicenseSpring.License.LicenseUser ( )

License user.

Returns
License user or null if not available

Implements LicenseSpring.ILicense.

◆ LocalCheck()

void LicenseSpring.License.LocalCheck ( )

Perform check for license validity locally.Local check do not establish any connections to the LicenseSpring platform, so it can be used in offline mode.

Implements LicenseSpring.ILicense.

◆ MaintenanceDaysRemaining()

int LicenseSpring.License.MaintenanceDaysRemaining ( )

How many days remaining till maintenance period expires in current time zone.Days counter will be changed in local midnight. Returns int.MaxValue in case maintenance period unlimited or not specified.

Implements LicenseSpring.ILicense.

◆ MaintenancePeriod()

DateTime LicenseSpring.License.MaintenancePeriod ( )

Maintenance period for the license.

Returns
The DateTime when maintenance expires in local time

Implements LicenseSpring.ILicense.

◆ MaintenancePeriodUTC()

DateTime LicenseSpring.License.MaintenancePeriodUTC ( )

Maintenance period for the license.

Returns
The DateTime when maintenance expires in UTC

Implements LicenseSpring.ILicense.

◆ MaxActivations()

uint LicenseSpring.License.MaxActivations ( )

How many times license can be activated.

Returns
Maximum number of activations for the license.

Implements LicenseSpring.ILicense.

◆ MaxBorrowTime()

uint LicenseSpring.License.MaxBorrowTime ( )

Maximum borrowing period in hours.Meaningful only for floating license.

Implements LicenseSpring.ILicense.

◆ MaxConsumption()

int LicenseSpring.License.MaxConsumption ( )

Maximum consumption of the license.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ MaxConsumptionOverage()

int LicenseSpring.License.MaxConsumptionOverage ( )

Extra amount of consumption that allows to go over MaxConsumption.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ Metadata()

string LicenseSpring.License.Metadata ( )

License metadata.

Returns
Json with license metadata

Implements LicenseSpring.ILicense.

◆ OrderStoreId()

string LicenseSpring.License.OrderStoreId ( )

Order store id.

Returns
Order store id that can be found on the LicenseSpring portal.

Implements LicenseSpring.ILicense.

◆ Owner()

Customer LicenseSpring.License.Owner ( )

Gets the information about license owner, commonly it's a person or organization associated with the license.Please note some fields of the Customer object can be empty or null(unavailable)

Implements LicenseSpring.ILicense.

◆ PolicyId()

uint LicenseSpring.License.PolicyId ( )

License Policy id.Currently meaningful only for air-gap activated license.

Implements LicenseSpring.ILicense.

◆ Register()

void LicenseSpring.License.Register ( )

Register floating license and occupy floating slot.This is equivalent to check license online. See also SetupLicenseWatchdog. In order to keep floating license alive you should check in (register) it periodically.

Implements LicenseSpring.ILicense.

◆ RegisterFloatingFeature()

void LicenseSpring.License.RegisterFloatingFeature ( ILicenseFeature  licenseFeature)

Register a floating feature and occupy a floating slot.Meaningful only for floating features. In order to keep the floating feature alive, you should register it periodically.

Implements LicenseSpring.ILicense.

◆ Release()

void LicenseSpring.License.Release ( bool  throwExceptions = false)

Stop license watchdog thread and revoke floating license so other user can use it.It's important to call this function if you use floating license or watchdog.

Implements LicenseSpring.ILicense.

◆ ReleaseFloatingFeature()

void LicenseSpring.License.ReleaseFloatingFeature ( ILicenseFeature  licenseFeature)

Release a floating feature and free a license slot.Meaningful only for floating features.

Implements LicenseSpring.ILicense.

◆ ResumeLicenseWatchdog()

void LicenseSpring.License.ResumeLicenseWatchdog ( )

Restart background thread, you can call this within you callback in order to resume periodic license checks.Using this function is a little faster than running new watchdog. Does nothing if watchdog was not set up.

Implements LicenseSpring.ILicense.

◆ SendDeviceVariables()

bool LicenseSpring.License.SendDeviceVariables ( )

Send current device variables list to the backend (see device variables on the platform)Please note this data will be linked to the current running device ID.

Implements LicenseSpring.ILicense.

◆ SetupFloatingFeatureWatchdog()

void LicenseSpring.License.SetupFloatingFeatureWatchdog ( LicenseWatchdogCallback  callback,
bool  runCallbackOnEveryCheck = false 
)

Initialize and run the floating feature watchdog, a background thread that periodically checks registered floating features and by doing so keeps them alive.

Parameters
callbackFuncion called when an exception is thrown or after every feature check if runCallbackOnEveryCheck is set to true.
runCallbackOnEveryCheckIf true callback will be called after every feature check, if false only in case of exceptions. Default value is false.

Implements LicenseSpring.ILicense.

◆ SetupLicenseWatchdog() [1/2]

void LicenseSpring.License.SetupLicenseWatchdog ( LicenseWatchdogCallback  callback,
uint  timeout = 0 
)

Setup and run license watchdog, a background thread which periodically checks the license, by so keeping it alive.This is especially useful for floating licenses, but can be used for any.

Implements LicenseSpring.ILicense.

◆ SetupLicenseWatchdog() [2/2]

void LicenseSpring.License.SetupLicenseWatchdog ( LicenseWatchdogSettings  settings)

Setup and run license watchdog, a background thread which periodically checks the license, by so keeping it alive.This is especially useful for floating licenses, but can be used for any.

Implements LicenseSpring.ILicense.

◆ SetWatchdogTimeout()

void LicenseSpring.License.SetWatchdogTimeout ( uint  timeout = 0)

Set new timout for license watchdog.This method does not restart the watchdog, it sets a new timeout for the running watchdog or before calling ResumeLicenseWatchdog.

Implements LicenseSpring.ILicense.

◆ StartDate()

DateTime LicenseSpring.License.StartDate ( )

License start date.

Returns
The DateTime when license can be activated

Implements LicenseSpring.ILicense.

◆ StartFloatingFeatureWatchdog()

void LicenseSpring.License.StartFloatingFeatureWatchdog ( )

Starts the floating feature watchdog by unpausing the background thread. Does nothing if the floating feature watchdog wasn't previously initialized or is already running.Watchdog will stop automatically in case an exception other than a LicenseServerException or NetworkException is thrown or it can be stoped manually by calling StopFloatingFeatureWatchdog.

Implements LicenseSpring.ILicense.

◆ Status()

LicenseStatus LicenseSpring.License.Status ( )

Method for getting local license status, see LicenseStatus documentation.

Returns
LicenseStatus object for this license

Implements LicenseSpring.ILicense.

◆ StopFloatingFeatureWatchdog()

void LicenseSpring.License.StopFloatingFeatureWatchdog ( )

Stops the floating feature watchdog by pausing the background thread. Does nothing if the floating feature watchdog wasn't previously initialized or is already stoped.Watchdog will stop automatically in case an exception other than a LicenseServerException or NetworkException is thrown

Implements LicenseSpring.ILicense.

◆ StopLicenseWatchdog()

void LicenseSpring.License.StopLicenseWatchdog ( )

Stops license watchdog background thread.This method does not revoke floating license, just stops the watchdog.

Implements LicenseSpring.ILicense.

◆ SubscriptionGracePeriod()

uint LicenseSpring.License.SubscriptionGracePeriod ( )

Grace period in hours.Meaningful only for Subscription license.

Implements LicenseSpring.ILicense.

◆ SyncConsumption()

bool LicenseSpring.License.SyncConsumption ( OverageRequest  overageRequest = null)

Sync Consumption license with the LicenseSpring platform.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ SyncFeatureConsumption()

bool LicenseSpring.License.SyncFeatureConsumption ( string  featureCode = null)

Sync Consumption feature with the LicenseSpring platform.Meaningful only for Consumption features.

Implements LicenseSpring.ILicense.

◆ TimesActivated()

uint LicenseSpring.License.TimesActivated ( )

How many times license already been activated.

Returns
Current number of activations for the license.

Implements LicenseSpring.ILicense.

◆ TotalConsumption()

int LicenseSpring.License.TotalConsumption ( )

Current total consumption of the license.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ TransferCount()

uint LicenseSpring.License.TransferCount ( )

How many times license has been transferred between devices.

Returns
Transfer count of the license.

Implements LicenseSpring.ILicense.

◆ TransferLimit()

uint LicenseSpring.License.TransferLimit ( )

Maximum number of allowed license transfers between devices.

Returns
Maximum device transfer limit of the license, uint.MaxValue for unlimited device transfers, 0 if device transfers are not allowed.

Implements LicenseSpring.ILicense.

◆ Type()

LicenseType LicenseSpring.License.Type ( )

Type of license.

Returns
LicenseType

Implements LicenseSpring.ILicense.

◆ UpdateConsumption()

void LicenseSpring.License.UpdateConsumption ( int  value = 1)

Increase local consumption counter for consumption license.Meaningful only for Consumption based license.

Implements LicenseSpring.ILicense.

◆ UpdateFeatureConsumption()

void LicenseSpring.License.UpdateFeatureConsumption ( string  featureCode,
int  value = 1 
)

Increase local consumption counter for consumption product feature.Meaningful only for Consumption product features.

Implements LicenseSpring.ILicense.

◆ UpdateOffline()

bool LicenseSpring.License.UpdateOffline ( string  path)

Update license data accordingly to provided file.

Parameters
pathUpdate file path
Returns
True if license successfully updated and false otherwise
Exceptions
System.IO.FileNotFoundExceptionIf file cannot be found
System.IO.InvalidDataExceptionIf file content is empty or invalid
LicenseSpring.SignatureMismatchExceptionIn case signature in the file is not valid or missing

Implements LicenseSpring.ILicense.

◆ User()

string LicenseSpring.License.User ( )

Email of the License user.

Returns
Email or null if not available (in case of key-based product)

Implements LicenseSpring.ILicense.

◆ ValidityPeriod()

DateTime LicenseSpring.License.ValidityPeriod ( )

The DateTime until the license is valid.

Returns
The DateTime when license expires in local time

Implements LicenseSpring.ILicense.

◆ ValidityPeriodUTC()

DateTime LicenseSpring.License.ValidityPeriodUTC ( )

The DateTime until the license is valid.

Returns
The DateTime when license expires in UTC

Implements LicenseSpring.ILicense.

◆ ValidityWithGracePeriod()

DateTime LicenseSpring.License.ValidityWithGracePeriod ( )

The DateTime until the license is valid including grace period.Currently grace period meaningful only for Subscription licenses

Implements LicenseSpring.ILicense.

◆ ValidityWithGracePeriodUTC()

DateTime LicenseSpring.License.ValidityWithGracePeriodUTC ( )

The DateTime until the license is valid including grace period.Currently grace period meaningful only for Subscription licenses

Implements LicenseSpring.ILicense.

Property Documentation

◆ AutoRelease

bool LicenseSpring.License.AutoRelease = false
getset

Meaningful only for floating licenses, if set to true the License object will call Release(bool) in it's destructor, if false user must manually release the license. Will be set to false automatically when borrowing or releasing a license.Default value is false.

Implements LicenseSpring.ILicense.


The documentation for this class was generated from the following file: