Table of contents

LicenseManager

The LicenseManager class provides a set of APIs to manage SDK licensing.

Definition

Namespace: Dynamsoft.License

Assembly: Dynamsoft.License.dll

public class LicenseManager 

Methods

Method Description
InitLicense Initializes the license using a license key.
SetDeviceFriendlyName Sets the friendly name of the device.
SetMaxConcurrentInstanceCount Sets the maximum number of allowed instances for the given device and process.
GetDeviceUUID Gets the unique identifier of the device.
SetLicenseCachePath Sets the directory path for the license cache.

InitLicense

Initializes the license using a license key.

static int InitLicense(string pLicense, out string errorMsg)

Parameters

[in] pLicense The license key as a string.

[out] errorMsg The detailed error message.

Return Value

Returns 0 if the license is initialized successfully, a negative value indicating an error otherwise.

See Also

EnumErrorCode

SetDeviceFriendlyName

Sets the friendly name of the device.

static int SetDeviceFriendlyName(string name)

Parameters

[in] name The friendly name of the device.

Return Value

Returns 0 if the friendly name is set successfully, a negative value indicating an error otherwise.

Remarks

This function must be called before function InitLicense to ensure correct functionality.

See Also

EnumErrorCode

SetMaxConcurrentInstanceCount

Sets the maximum number of allowed instances for the given device.

static int SetMaxConcurrentInstanceCount(int countForThisDevice)

Parameters

[in] countForThisDevice The maximum number of allowed instances for the device.

Return Value

Returns error code (returns 0 if the function operates successfully).

Remarks

This function must be called before function InitLicense to ensure correct functionality.

See Also

EnumErrorCode

GetDeviceUUID

Gets the unique identifier of the device.

static int GetDeviceUUID(int uuidGenerationMethod, out string uuidBuffer)

Parameters

[in] uuidGenerationMethod The method to generate the UUID.

  • 1: Generates UUID with random values.
  • 2: Generates UUID based on hardware info.

[out] uuidBuffer The unique identifier of the device.

Return Value

Returns 0 if the UUID is generated successfully, a negative value indicating an error otherwise.

Remarks

This function must be called before function InitLicense to ensure correct functionality.

SetLicenseCachePath

Sets the directory path for the license cache.

static int SetLicenseCachePath(string directoryPath)

Parameters

[in] directoryPath The directory path for the license cache.

Return Value

Returns 0 if the directory path is set successfully, a negative value indicating an error otherwise.

Remarks

This function must be called before function InitLicense to ensure correct functionality.

See Also

EnumErrorCode

Code Snippet

int errorCode = 0;
string deviceUUID;
string errorMsg;
LicenseManager.SetLicenseCachePath("DIRECTORY-PATH-FOR-LICENSE-CACHE");
LicenseManager.GetDeviceUUID(1, out deviceUUID);
LicenseManager.SetDeviceFriendlyName("FRIENDLY-NAME");
errorCode = LicenseManager.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
if (errorCode != (int)EnumErrorCode.EC_OK && errorCode != (int)EnumErrorCode.EC_LICENSE_CACHE_USED)
{
    Console.WriteLine("License initialization error: " + errorMsg);
}
else
{
    CaptureVisionRouter cvr = new CaptureVisionRouter();
    // add code for further process
}

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: