public static License GetProductKey() { if (File.Exists(Environment.SystemDirectory.ToString() + "/tdhash")) { StreamReader tr = new StreamReader(Environment.SystemDirectory.ToString() + "/tdhash"); string productKey = ""; if ((productKey = tr.ReadLine()) != null) { productKey = Decrypter.Decrypt(productKey); ProductKeyHandler productKeyHandler = new ProductKeyHandler(productKey, productCode, version); if (productKeyHandler.IsValidProductKey()) { License license = new License(); license.ExpireDate = productKeyHandler.GetExpireDate(); license.LicenseType = productKeyHandler.GetLicenseType(); tr.Close(); return(license); } } tr.Close(); } return(null); }
public static License ValidProductKey(string productKey) { ProductKeyHandler productKeyHandler = new ProductKeyHandler(productKey, productCode, version); if (productKeyHandler.IsValidProductKey()) { License license = new License(); license.ExpireDate = productKeyHandler.GetExpireDate(); license.LicenseType = productKeyHandler.GetLicenseType(); return(license); } return(null); }
public static License ValidProductKey(string productKey) { ProductKeyHandler productKeyHandler = new ProductKeyHandler(productKey, Constants.GetProductCode(), Constants.GetProductVersion()); if (productKeyHandler.IsValidProductKey()) { License license = new License(); license.ExpireDate = productKeyHandler.GetExpireDate(); license.LicenseType = productKeyHandler.GetLicenseType(); StreamWriter sw = new StreamWriter(Environment.SystemDirectory.ToString() + "/tdhash"); sw.WriteLine(Encode.Encrypter.Encrypt(productKey)); sw.Flush(); sw.Close(); return(license); } return(null); }