Created
February 25, 2015 23:46
-
-
Save HowardvanRooijen/65e49de436e5b0acf8a3 to your computer and use it in GitHub Desktop.
Client Scaffolding for license validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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