The LicenseCheck example demonstrates how to check for and configure the DCF license.
Classes
Class | Description | |
---|---|---|
Program |
Example to show checking the license, and configuration of the license path.
|
Remarks
Supported OS Platforms:
- Windows - .Net Framework 4.7.2 64-bit and 32-bit
- Windows - .Net Core 2.1 64-bit and 32-bit
- Linux - .Net Core 2.1 64-bit
Examples
LicenseCheck Sample Code
public class Program { private static readonly ILogger Logger = LogManager.GetCurrentClassLogger(); /// <summary> /// The main entry point for the application. /// </summary> [STAThread] public static void Main() { // Set the license file path to a bogus value to demonstrate failure Framework.LicenseFilePath = "Bogus"; try { Framework.CheckLicense(); } catch (DCFException e) { Logger.Info(e, "Expected bogus license failure message:"); } // Now reset to expected default value systeminfo.txt Framework.LicenseFilePath = Framework.DefaultLicenseFileName; try { Framework.CheckLicense(); string license = File.ReadAllText(Framework.LicenseFilePath); Logger.InfoFormat("License check passed:{0}{1}", Environment.NewLine, license); } catch (Exception e) { Logger.Error(e, "Unexpected license check failure:"); Environment.ExitCode = 1; } if (System.Diagnostics.Debugger.IsAttached) { Console.Write("Press any key to continue . . . "); Console.ReadKey(); } } }