Skip to content

Instantly share code, notes, and snippets.

@HowardvanRooijen
Created February 25, 2015 23:46
Show Gist options
  • Save HowardvanRooijen/65e49de436e5b0acf8a3 to your computer and use it in GitHub Desktop.
Save HowardvanRooijen/65e49de436e5b0acf8a3 to your computer and use it in GitHub Desktop.
Client Scaffolding for license validation
public static void Main(string[] args)
{
// In a real implementation the public key would be embedded in the assembly
// possibly via an embedded resource
var publicKeyPath = @"..\..\..\..\LicenseData\PublicKey.xml".ResolveBaseDirectory();
// You could also either load the license from the file system or deliver it
// on demand from a web endpoint
var licensePath = @"..\..\..\..\LicenseData\License.xml".ResolveBaseDirectory();
if (!File.Exists(publicKeyPath) || !File.Exists(licensePath))
{
Console.WriteLine(Messages.RunServerAppFirst);
Console.WriteLine(Messages.PressAnyKey);
Console.ReadKey();
Environment.Exit(-1);
}
ValidateLicense(publicKeyPath, licensePath);
Console.WriteLine(Messages.NoLicenseViolations);
Console.WriteLine(Messages.PressAnyKey);
Console.ReadKey();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment