private string[] LicenseInformation()
        {
            string[] information = { "", "", "", "", "", "" };

            var path = Application.StartupPath + @"\bin\";

            string filename = "License.lic";

            string[] lines = File.ReadAllLines(path + filename);

            var arr = lines[7].Split(':');

            string dec = ClsTripleDES.Decrypt(arr[1].ToString());

            var licarr = dec.Split(',');

            information[0] = licarr[3];
            information[1] = licarr[4];
            information[2] = licarr[0];
            information[3] = licarr[1];
            information[4] = licarr[5];


            return(information);
        }
        private bool CheckTrail()
        {
            try
            {
                var path = Application.StartupPath + @"\bin\";

                string filename = "License.lic";

                string[] lines = File.ReadAllLines(path + filename);

                var arr = lines[7].Split(':');

                string dec = ClsTripleDES.Decrypt(arr[1].ToString());

                var licarr = dec.Split(',');

                string trail = licarr[5].ToString();

                bool check = Convert.ToBoolean(trail);
                if (check)
                {
                    return(true);
                }

                if (!check)
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occured: " + ex.Message.ToString(), "Error - Student Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(false);
        }
        private int TrailDaysRemaining()
        {
            try
            {
                var path = Application.StartupPath + @"\bin\";

                string filename = "License.lic";

                string[] lines = File.ReadAllLines(path + filename);

                var arr = lines[7].Split(':');

                string dec = ClsTripleDES.Decrypt(arr[1].ToString());

                var licarr = dec.Split(',');

                int date  = DateTime.Now.Day;
                int month = DateTime.Now.Month;
                int year  = DateTime.Now.Year;

                CultureInfo enUS = new CultureInfo("en-US");
                DateTime    licEndDate;
                bool        check = DateTime.TryParseExact(licarr[1].ToString(), "dd/MM/yyyy", enUS, DateTimeStyles.None, out licEndDate);
                DateTime    now   = new DateTime(year, month, date);
                double      day   = (licEndDate - now).TotalDays;

                int daysremaining = Convert.ToInt32(day);

                return(daysremaining);
            }
            catch (Exception)
            {
            }
            return(0);
        }
        private bool LicenseValid()
        {
            try
            {
                var path = Application.StartupPath + @"\bin\";

                string filename = "License.lic";

                string[] lines = File.ReadAllLines(path + filename);

                var arr = lines[7].Split(':');

                string dec = ClsTripleDES.Decrypt(arr[1].ToString());

                var licarr = dec.Split(',');

                CultureInfo enUS = new CultureInfo("en-US");
                DateTime    licEndDate;
                bool        check = DateTime.TryParseExact(licarr[1].ToString(), "dd/MM/yyyy", enUS, DateTimeStyles.None, out licEndDate);

                var guid   = db.Randoms.Where(c => c.ID == 18).FirstOrDefault();
                var owner  = db.Randoms.Where(c => c.ID == 5).FirstOrDefault();
                var school = db.Randoms.Where(c => c.ID == 1).FirstOrDefault();

                string LicGuid   = licarr[2].ToString();
                string LicOwner  = licarr[3].ToString();
                string LicSchool = licarr[4].ToString();



                if (guid.Text.ToString() == LicGuid)
                {
                    if (LicOwner == owner.Text.ToString())
                    {
                        if (LicSchool == school.Text.ToString())
                        {
                            return(true);
                        }
                    }
                }
            }

            catch (Exception)
            {
                MessageBox.Show("Error! License Not Valid! Contact your Developer!", "Error - Student Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            return(false);
        }
Beispiel #5
0
        private string LicenseEnds()
        {
            var path = Application.StartupPath + @"\bin\";

            string filename = "License.lic";

            string[] lines = File.ReadAllLines(path + filename);

            var arr = lines[7].Split(':');

            string dec = ClsTripleDES.Decrypt(arr[1].ToString());

            var licarr = dec.Split(',');


            return(licarr[1].ToString());
        }
Beispiel #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     textBox2.Text = ClsTripleDES.Decrypt(textBox1.Text);
 }