private void Form1_Load(object sender, EventArgs e) { SKGL.Validate validate = new SKGL.Validate(); validate.secretPhase = txtPassword.Text; validate.Key = txtSerial.Text; txtsStatus.Text "Creation date: " + validate.CreationDate + "\r\n" + "Expire date: " + validate.ExpireDate + "\r\n" + "Day left: " + validate.DaysLeft; }
public void CreateAndValidateAM() { SKGL.Generate gen = new SKGL.Generate(); string a = gen.doKey(30); SKGL.Validate ValidateAKey = new SKGL.Validate(); ValidateAKey.Key = a; Assert.IsTrue(ValidateAKey.IsValid == true); Assert.IsTrue(ValidateAKey.IsExpired == false); Assert.IsTrue(ValidateAKey.SetTime == 30); if (ValidateAKey.IsValid) { // displaying date // remember to use .ToShortDateString after each date! Console.WriteLine("This key is created {0}", ValidateAKey.CreationDate.ToShortDateString()); Console.WriteLine("This key will expire {0}", ValidateAKey.ExpireDate.ToShortDateString()); Console.WriteLine("This key is set to be valid in {0} day(s)", ValidateAKey.SetTime); Console.WriteLine("This key has {0} day(s) left", ValidateAKey.DaysLeft); } else { // if invalid Console.WriteLine("Invalid!"); } }
private void btnValid_Click(object sender, EventArgs e) { // Valid Button SKGL.Validate valide = new SKGL.Validate(); valide.secretPhase = txtPassword.Text; valide.Key = txtSerial.Text; txtStatus.Text = "Create Date:" + valide.CreationDate + "\r\n" + "ExpireDate:" + valide.ExpireDate + "\r\n" + "DayLeft:" + valide.DaysLeft; }
private void ValidateSerialKey_Click(object sender, EventArgs e) { SKGL.Validate validate = new SKGL.Validate(); validate.secretPhase = Password.Text; validate.Key = SerialKey.Text; ValidateReport.Text = "Дата создания: " + validate.CreationDate + "\r\n" + "Дата истекания: " + validate.ExpireDate + " \r\n" + "Дней осталось: " + validate.DaysLeft; }
//TODO: need return complex model with date? public bool IsInviteValid(string key) { var validation = new SKGL.Validate() { secretPhase = _code }; validation.Key = key; return(validation.IsValid); }
public void CreateAndValidateA() { SKGL.Validate val = new SKGL.Validate(); val.Key = "MXNBF-ITLDZ-WPOBY-UCHQW"; val.secretPhase = "567"; Assert.IsTrue(val.IsValid == true); Assert.IsTrue(val.IsExpired == true); Assert.IsTrue(val.SetTime == 30); }
public void CreateAndValidate999Days() { SKGL.Generate gen = new SKGL.Generate(); string a = gen.doKey(999); SKGL.Validate val = new SKGL.Validate(); val.Key = a; Assert.IsTrue(val.IsValid == true); Assert.IsTrue(val.IsExpired == false); }
// ReSharper disable once InconsistentNaming public void CreateAndValidateCJ() { var val = new SKGL.Validate { Key = "LZWXQ-SMBAS-JDVDL-XTEHB", SecretPhrase = "567" }; Assert.IsTrue(val.IsValid); Assert.IsTrue(val.IsExpired); Assert.IsTrue(val.SetTime == 30); Assert.IsTrue(val.Features[0]); }
public void CreateAndValidateSimple() { SKGL.Generate gen = new SKGL.Generate(); string a = gen.doKey(30); SKGL.Validate val = new SKGL.Validate(); val.Key = a; Assert.IsTrue(val.IsValid == true); Assert.IsTrue(val.IsExpired == false); Assert.IsTrue(val.SetTime == 30); }
public void CreateAndValidate999DaysWithSecretPhase() { SKGL.Generate gen = new SKGL.Generate(); gen.secretPhase = "d87e468e-02ae-4112-a687-fb4a402a2f7a"; string a = gen.doKey(999); SKGL.Validate val = new SKGL.Validate(); val.secretPhase = "d87e468e-02ae-4112-a687-fb4a402a2f7a"; val.Key = a; Assert.IsTrue(val.IsValid == true); Assert.IsTrue(val.IsExpired == false); }
public void CreateAndValidateCJ() { SKGL.Validate val = new SKGL.Validate(); val.Key = "LZWXQ-SMBAS-JDVDL-XTEHB"; val.secretPhase = "567"; int timeLeft = val.DaysLeft; Assert.IsTrue(val.IsValid == true); Assert.IsTrue(val.IsExpired == true); Assert.IsTrue(val.SetTime == 30); Assert.IsTrue(val.Features[0] == true); //Assert.IsTrue(val.Features[1] == false); }
public void CreateAndValidateSimple() { // Arrange var gen = new SKGL.Generate(); var a = gen.DoKey(30); // Act var val = new SKGL.Validate { Key = a }; // Assert Assert.IsTrue(val.IsValid); Assert.IsTrue(val.IsExpired == false); Assert.IsTrue(val.SetTime == 30); }
public RegistryLicense(string licenceKey) { if (licenceKey == null) { throw new NullReferenceException("The licensed type reference may not be null."); } _validate = new SKGL.Validate(); _validate.secretPhase = "C0t3ch1n0"; _validate.Key = licenceKey; if (!_validate.IsValid) { throw new ApplicationException("The licence code is not valid"); } }
public void CreateAndValidateA() { // Arrange const string key = "MXNBF-ITLDZ-WPOBY-UCHQW"; const string secretPhrase = "567"; // Act var val = new SKGL.Validate { Key = key, SecretPhrase = secretPhrase }; // Assert Assert.IsTrue(val.IsValid); Assert.IsTrue(val.IsExpired); Assert.IsTrue(val.SetTime == 30); }
public static string ObtenerEstadoLicencia() { string programa = GetPrograma(); var serial = Decrypt(ConfigurationManager.AppSettings["serial"]); SKGL.SerialKeyConfiguration skc = new SKGL.SerialKeyConfiguration(); SKGL.Validate ValidateAKey = new SKGL.Validate(skc); ValidateAKey.secretPhase = programa; ValidateAKey.Key = serial; if (ValidateAKey.IsValid) { if (ValidateAKey.Features[0] == false) { if (Math.Abs(ValidateAKey.DaysLeft) <= 30) { return(string.Format("La versión del programa finaliza en {0} días . Por favor actualice su licencia.", Math.Abs(ValidateAKey.DaysLeft))); } } if (ValidateAKey.Features[0] == true) { if (ValidateAKey.Features[1] == false) { if (Math.Abs(ValidateAKey.DaysLeft) <= 30) { return(string.Format("La versión del programa finaliza en {0} días . Por favor actualice su licencia.", Math.Abs(ValidateAKey.DaysLeft))); //return "La versión del programa finalizo. Por favor ingrese una licencia valida."; } } else if (ValidateAKey.Features[1] == true) { } } } else { return("El serial ingresado no es válido."); } return(string.Empty); }
public static string ValidarIngreso() { string programa = GetPrograma(); var serial = Decrypt(ConfigurationManager.AppSettings["serial"]); SKGL.SerialKeyConfiguration skc = new SKGL.SerialKeyConfiguration(); SKGL.Validate ValidateAKey = new SKGL.Validate(skc); ValidateAKey.secretPhase = programa; ValidateAKey.Key = serial; if (ValidateAKey.IsValid) { if (ValidateAKey.Features[0] == false) { if (ValidateAKey.DaysLeft < 0) { return("La versión trial del programa finalizo. Por favor ingrese una licencia valida."); } } if (ValidateAKey.Features[0] == true) { if (ValidateAKey.Features[1] == false) { if (ValidateAKey.DaysLeft < 0) { return("La versión del programa finalizo. Por favor ingrese una licencia valida."); } } else if (ValidateAKey.Features[1] == true) { } } } else { return("El serial ingresado no es válido."); } return(string.Empty); }
void validateSerialNumbers() { if (SerialNumbers == null) { return; } SKGL.Validate ValidateAKey = new SKGL.Validate(); ValidateAKey.secretPhase = SecretPhase; foreach (var sn in SerialNumbers) { ValidateAKey.Key = sn.Value; if (ValidateAKey.IsValid && ValidateAKey.IsOnRightMachine) { sn.IsValid = true; sn.IsUnlimOrders = ValidateAKey.Features[0]; sn.IsExtendedReports = ValidateAKey.Features[1]; } } }
public void TestLicenza1() { SKGL.Validate ValidateAKey = new SKGL.Validate(); // create an object ValidateAKey.secretPhase = "My$ecretPa$$W0rd"; // the passsword // Questa licenza dovrebbe essere valida fino al 20/11/2015 ValidateAKey.Key = "LBWRB-QOITK-SLCCU-MCGKS"; // enter a valid key Assert.IsFalse(ValidateAKey.IsExpired); Assert.IsTrue(ValidateAKey.IsValid); // Questa chiave non è valida (cioè è sbagliata) ValidateAKey.Key = "yFBFR-SZNVH-DGVXL-RTCLT"; Assert.IsFalse(ValidateAKey.IsValid); // Questa chiave è corretta ma è scaduta ValidateAKey.Key = "LREYZ-AAIDV-RLGRK-EVPFQ"; Assert.IsTrue(ValidateAKey.IsExpired); Assert.IsTrue(ValidateAKey.IsExpired); }
public void CreateAndValidateC() { SKGL.SerialKeyConfiguration skm = new SKGL.SerialKeyConfiguration(); SKGL.Generate gen = new SKGL.Generate(skm); skm.Features[0] = true; gen.secretPhase = "567"; string a = gen.doKey(37); SKGL.Validate val = new SKGL.Validate(); val.Key = a; val.secretPhase = "567"; Assert.IsTrue(val.IsValid == true); Assert.IsTrue(val.IsExpired == false); Assert.IsTrue(val.SetTime == 37); Assert.IsTrue(val.Features[0] == true); Assert.IsTrue(val.Features[1] == false); }
public void CreateAndValidateC() { var skm = new SKGL.SerialKeyConfiguration(); var gen = new SKGL.Generate(skm); skm.Features[0] = true; gen.SecretPhrase = "567"; var a = gen.DoKey(37); var val = new SKGL.Validate { Key = a, SecretPhrase = "567" }; Assert.IsTrue(val.IsValid); Assert.IsTrue(val.IsExpired == false); Assert.IsTrue(val.SetTime == 37); Assert.IsTrue(val.Features[0]); Assert.IsTrue(val.Features[1] == false); }