Example #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!");
            }
        }
Example #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!");
            }
        }
Example #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));
 }
Example #4
0
        public void MachineCodeTest()
        {
            var gen = new SKGL.Generate();
            var a   = gen.MachineCode.ToString();

            Assert.IsNotNull(a);
            Console.WriteLine($"MachineCode: {a}");
        }
Example #5
0
        public string GenerateInvite()
        {
            var createKey = new SKGL.Generate()
            {
                secretPhase = _code
            };

            return(createKey.doKey(DaysExpired));
        }
Example #6
0
        async Task <int> generateMachineID()
        {
            await Task.Run(() =>
            {
                MachineID = new SKGL.Generate().MachineCode;
            });

            return(MachineID);
        }
Example #7
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);
        }
Example #8
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);
        }
Example #9
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);
        }
Example #10
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);
        }
Example #11
0
        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);
        }
Example #12
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);
        }
Example #13
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);
        }
Example #14
0
        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);
        }
Example #15
0
 public void MachineCodeTest()
 {
     SKGL.Generate gen = new SKGL.Generate();
     string        a   = gen.MachineCode.ToString();
 }
Example #16
0
 private void GetCodeBtn_Click(object sender, EventArgs e)
 {
     SKGL.SerialKeyConfiguration skc = new SKGL.SerialKeyConfiguration();
     SKGL.Generate generate          = new SKGL.Generate(skc);
     MachineCode.Text = generate.MachineCode.ToString();
 }
Example #17
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));
 }
Example #18
0
 public void MachineCodeTest()
 {
     SKGL.Generate gen = new SKGL.Generate();
     string a= gen.MachineCode.ToString();
 }