using System.Collections.Generic;
public class TLLIntegration
{
private static byte[] bytInitChunk = { 59, 73, ... }; // Generate your own Init chunk in TLL Toolbox and paste it here. Make sure you put corresponding private key to the product settings in TLL server
internal static TLLInterface tlli = new TLLInterface(bytInitChunk, "5ss8:,UaAUhzTE?9trSjSynsxDxTRbn", true);
public static void ConfigureTLL()
{
tlli.HWID.EnableMoreDistinctMode = true;
LoadCustomTranslation();
}
private static void LoadCustomTranslation()
{
tlli.RegistrationFormTranslations.Clear();
tlli.RegistrationFormTranslations.Add("License is activated. You can enter new license below.");
tlli.RegistrationFormTranslations.Add("Your hardware ID: ");
tlli.RegistrationFormTranslations.Add(" (double-click to copy)");
tlli.RegistrationFormTranslations.Add("We're now searching valid license online. Please allow few seconds...");
tlli.RegistrationFormTranslations.Add("Your license was automatically activated.");
tlli.RegistrationFormTranslations.Add("Close");
tlli.RegistrationFormTranslations.Add("Please enter your serial number.");
tlli.RegistrationFormTranslations.Add("We're now verifying your serial number, please wait...");
tlli.RegistrationFormTranslations.Add("Your license was successfully activated.");
tlli.RegistrationFormTranslations.Add("It seems we're having issues with connection to activation server. Would you like to try offline activation?");
tlli.RegistrationFormTranslations.Add("You must enter valid e-mail to activate your license.");
tlli.RegistrationFormTranslations.Add("All files (*.*)");
tlli.RegistrationFormTranslations.Add("We're now verifying entered license, please wait...");
tlli.RegistrationFormTranslations.Add("E-mail");
tlli.RegistrationFormTranslations.Add("Serial number");
tlli.RegistrationFormTranslations.Add("Cancel");
tlli.RegistrationFormTranslations.Add("Register");
tlli.RegistrationFormTranslations.Add("Gives ERROR");
tlli.RegistrationFormTranslations.Add("Load license from file");
tlli.RegistrationFormTranslations.Add("License data");
tlli.RegistrationFormTranslations.Add("Show more licensing options");
tlli.RegistrationFormTranslations.Add("Migrate to new PC");
tlli.RegistrationFormTranslations.Add("Offline activation");
tlli.RegistrationFormTranslations.Add("Auto activation");
tlli.RegistrationFormTranslations.Add("Delete local license");
tlli.RegistrationFormTranslations.Add("Copy hardware ID");
tlli.RegistrationFormTranslations.Add("We have deactivated license on this computer.");
tlli.RegistrationFormTranslations.Add("Actual license was cleared from registry.");
tlli.RegistrationFormTranslations.Add("HardwareID was copied to clipboard.");
tlli.RegistrationFormTranslations.Add("Get offline license");
tlli.RegistrationFormTranslations.Add("License is activated. License owner:");
tlli.RegistrationFormTranslations.Add("How to activate license on offline computer");
tlli.RegistrationFormTranslations.Add("1. Note your hardware ID:");
tlli.RegistrationFormTranslations.Add("2. Note offline activation form URL");
tlli.RegistrationFormTranslations.Add("3. Visit offline activation form on any other online computer, use hardware ID above and get license file for this PC.");
tlli.RegistrationFormTranslations.Add("4. Copy the activation file (using USB drive, etc) to offline computer and use it.");
}
}
// You can add method below to your startup code or to your window/form load events, etc.
// Code below runs synchronously. This is only example code. You may need to alter it according to your needs.
private void TLLInit()
{
TLLIntegration.ConfigureTLL();
recheck_license:
if (TLLIntegration.tlli.MyLicense == null)
{
// Do something when in demo/no license state
// You can change code below to open your own registration dialog that uses TLLInterface.ActivateSerial and/or TLLInterface.ActivateHWID and/or TLLInterface.ActivateTrial methods
DialogResult dres = TLLIntegration.tlli.ShowRegistrationForm(this, "App license", "http://www.buyyourapp.com", null, false);
if (dres == DialogResult.OK)
{
goto recheck_license;
}
}
else if (TLLIntegration.tlli.MyLicense.IsDemo)
{
// Any code you want to run when user is running trial (e.g. your nag screen)
}
else
{
// Add your app code when full license is activated
if (TLLIntegration.tlli.OnlineRevocationCheck())
{
TLLIntegration.tlli.AsyncSilentReactivation();
}
else
{
// Invalid/pirated license detected
Application.Exit();
}
}
}