private void InitializeValues() { cmbCodeName.Items.Clear(); cmbPurchaseType.Items.Clear(); txtMachineKey.Text = String.Empty; string[] enumNames = Enum.GetNames(typeof(ProductCodeName)); foreach (string enumName in enumNames) { cmbCodeName.Items.Add(enumName); } enumNames = Enum.GetNames(typeof(PurchaseType)); foreach (string enumName in enumNames) { cmbPurchaseType.Items.Add(enumName); } txtMachineKey.Text = MachineIdProvider.Retrieve(MachineIdType.Composite2).Key; }
public bool VerifyLicence(out string message) { // 1- Try to load licence from licence file. LicUtils utils = new LicUtils(); PragmaLicense lic = LoadLicence(); message = String.Empty; // 2- No licence file. if (lic == null) { message = "No license found.\r\n"; //message = _licFile; return(false); } // 2- Verify the licence. try { if (!utils.VerifyLicense(_licFile)) { message = "You are trying to use an invalid license.\r\nPlease visit www.PragmaSQL.com to purchase a valid license."; return(false); } } catch (Exception ex) { message = "Error:" + ex.Message; return(false); } MachineID current = MachineIdProvider.Retrieve(lic.MachineIdType); if (current.Key != lic.MachineKey.Key) { message = "You are trying to use a license which was not issued to you.\r\nPlease visit www.PragmaSQL.com to purchase a valid license."; return(false); } if (new ProductInfo().CurrentCodeName != lic.ProductCodeName) { message = "You are trying to use a license which was not issued for this version.\r\nPlease visit www.PragmaSQL.com to purchase a valid license."; return(false); } // 3- If licence is a demo licence check existance of the expire file if (lic.PurchaseType == PurchaseType.Demo) { try { if (!File.Exists(_demoExpireFile)) { message = "Demo expire date can not be determined!\r\nPlease visit www.PragmaSQL.com to purchase a license."; return(false); } if (!ExpireDemoLicence(lic)) { message = "Your demo period expired!\r\nPlease visit www.PragmaSQL.com to purchase a license."; return(false); } } catch (Exception ex) { message = ex.Message; return(false); } } return(true); }