AgileDotNetLicenseProvider.CreateLicenseFromString Method

SecureTeam Copy Protection

AgileDotNetLicenseProvider.CreateLicenseFromString

Creates a AgileDotNetLicense object from its string representation.

Syntax

Public Shared Sub CreateLicenseFromString( _
   ByVal licenseContent As String _
)
public static AgileDotNetLicense CreateLicenseFromString(
   string licenseContent
);

Parameters

licenseContent
The license string representation.

Return Value

A license object

Remarks

The method may be used to install a license on a target machine without distributing the license file along the application.

Example

 using System;
 using System.ComponentModel;
 using AgileDotNet.Licensing;
 
 namespace SecuredNamespace
 {
     [LicenseProvider(typeof(AgileDotNetLicenseProvider))]
     public class SecuredComponent
        {
            public SecuredComponent(string licenseContent)
            {
                AgileDotNetLicense license = AgileDotNetLicenseProvider.CreateLicenseFromString(licenseContent);
                license.Save("MyLic");

                license = LicenseManager.Validate(this.GetType(), this) as AgileDotNetLicense;
            }

            public void ExecuteProtecteMethod()
            {
            if (license.IsTrial)
            {
                // Add your code here
            }
            else
            {
                // Add your code here
            }
         }
 
         private AgileDotNetLicense license;
     }
 }
 

See Also

AgileDotNetLicenseProvider Class | AgileDotNet.Licensing Namespace