示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
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);
        }
示例#6
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();
 }
示例#7
0
        /// <summary>
        /// Calcola un numero da 5 cifre che rappresenta un hash
        /// di tutti i dati hardware del computer su cui sta girando.
        /// </summary>
        /// Questo metodo l'ho preso da qui:
        /// http://blog.clizware.net/all/977
        ///
        /// <returns>
        /// Una stringa da 5 caratteri che per ora contiene solo numeri
        /// (in pratica sarebbe un long)
        /// </returns>


        public static string getMachineCode()
        {
            SKGL.SerialKeyConfiguration skc = new SKGL.SerialKeyConfiguration();
            return(skc.MachineCode.ToString());
        }