Programatically generate license file for customer

You can generate license with LibraryToolbox.exe without need to write program. This example is usable for automated systems or customized works.

public void GenerateLicenseForCustomer(string ProductName, string LicenseOwner, string HardwareID = "", System.DateTime LicenseExpiration = null)
{
    TreeksLicensingLibrary.License lic = new TreeksLicensingLibrary.License();
    TreeksLicensingLibrary.LicenseSigningKey key = new TreeksLicensingLibrary.LicenseSigningKey();

    key.LoadFile("C:\\myappkey.lkey");

    lic.ProductName = ProductName;
    lic.OwnerName = LicenseOwner;
    lic.HardwareID = HardwareID;
    lic.ExpirationDate = LicenseExpiration;

    string strLicense = lic.GeneratedSignedLicenseXML(key);

    IO.File.WriteAllText("C:\\registration.lic", strLicense, false);
}
Public Sub GenerateLicenseForCustomer(ByVal ProductName As String, ByVal LicenseOwner As String, Optional ByVal HardwareID As String = "", Optional ByVal LicenseExpiration As Date = Nothing)
    Dim lic As New TreeksLicensingLibrary.License
    Dim key As New TreeksLicensingLibrary.LicenseSigningKey

    key.LoadFile("C:\myappkey.lkey")

    lic.ProductName = ProductName
    lic.OwnerName = LicenseOwner
    lic.HardwareID = HardwareID
    lic.ExpirationDate = LicenseExpiration

    Dim strLicense As String = lic.GeneratedSignedLicenseXML(key)

    My.Computer.FileSystem.WriteAllText("C:\registration.lic", strLicense, False)
End Sub