Exemple #1
0
        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!");
            }
        }
Exemple #2
0
        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!");
            }
        }
Exemple #3
0
 private void btnGenerate_Click(object sender, EventArgs e)
 {
     // Generate button
     SKGL.Generate generate = new SKGL.Generate();
     generate.secretPhase = txtPassword.Text;
     txtSerial.Text       = generate.doKey(Convert.ToInt32(txtDay.Text));
 }
Exemple #4
0
        public string GenerateInvite()
        {
            var createKey = new SKGL.Generate()
            {
                secretPhase = _code
            };

            return(createKey.doKey(DaysExpired));
        }
Exemple #5
0
        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);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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);
        }
Exemple #11
0
 private void GenSerialKey_Click(object sender, EventArgs e)
 {
     SKGL.Generate generate = new SKGL.Generate();
     generate.secretPhase = Password.Text;
     SerialKey.Text       = generate.doKey(Convert.ToInt32(ActionTime.Text));
 }