private void Form_TrialReport_Load(object sender, EventArgs e)
        {
            //    string timeElapsed = HashPass.ReadElapsedFromReg();
            //    int hoursElapsed = int.Parse(timeElapsed) / (60*60);
            //    int remainingHours = 240 - hoursElapsed;
            //    progressBar1.Value = remainingHours;
            //    label1.Text = remainingHours.ToString() + " Hours remained";

            string days_str = HashPass.ReadDaysFromReg();
            double days     = 0;

            if (days_str != "")
            {
                days = double.Parse(days_str);
            }
            days = 30 - days;
            int    firstUsed           = int.Parse(HashPass.ReadFirstDateFromReg());
            int    lastUsed            = int.Parse(HashPass.ReadLastDateFromReg());
            int    elapsedDaysFromFULU = 30 - (lastUsed - firstUsed);
            string timeElapsed         = HashPass.ReadElapsedFromReg();
            int    hoursElapsed        = int.Parse(timeElapsed) / (60 * 60);
            int    remainingHours      = 720 - hoursElapsed;
            int    progressValue       = 0;

            if (elapsedDaysFromFULU > 30 || remainingHours <= 0)
            {
                progressValue = 0;
            }
            else
            {
                progressValue = (days < elapsedDaysFromFULU) ? int.Parse(days.ToString()) : elapsedDaysFromFULU;
            }
            progressBar1.Value = progressValue;
            label1.Text        = progressValue.ToString() + " Days remained";
        }
Ejemplo n.º 2
0
 public static void refreshLicInfo()
 {
     licenseName = ReadFromReg();
     if (LicType == "t")
     {
         double today     = DateTime.Today.ToOADate();
         int    FirstUsed = int.Parse(ReadFirstDateFromReg());
         int    LastUsed  = int.Parse(ReadLastDateFromReg());
         if (FirstUsed == 0 && LastUsed == 0)
         {
             WriteFirstDateToReg(today.ToString());
             WriteLastDateToReg(today.ToString());
             return;
         }
         else if ((FirstUsed == 0 && LastUsed != 0) || LastUsed > today)
         {
             isExpired = true;
             Form1.Board(true);
             return;
         }
         string timeElapsed    = HashPass.ReadElapsedFromReg();
         int    hoursElapsed   = int.Parse(timeElapsed) / (60 * 60);
         int    remainingHours = 720 - hoursElapsed;
         double elapsedDays    = today - FirstUsed;
         if (elapsedDays < 0 || elapsedDays > 30 || remainingHours <= 0)
         {
             isExpired = true;
             Form1.Board(true);
             return;
         }
         else
         {
             isExpired = false;
             Form1.Board(false);
         }
         if (isExpired == true)
         {
             licenseType = "Expired!";
         }
         else
         {
             licenseType = "Trial Demo";
         }
         WriteLastDateToReg(today.ToString());
     }
     else if (HashPass.LicType == "p")
     {
         isExpired   = false;
         licenseType = "Permanent";
         Form1.Board(false);
     }
 }