示例#1
0
        private int CheckHideFile()
        {
            string[] HideInfo;
            HideInfo = FileReadWrite.ReadFile(hideFilePath).Split(';');
            long DiffDays;
            int  DaysToEnd;
            int  defDays = 0;

            DaysToEnd = Convert.ToInt32(HideInfo[1]);
            if (DaysToEnd <= 0)
            {
                defDays = 0;
                return(0);
            }
            DateTime dt = new DateTime(Convert.ToInt64(HideInfo[0]));

            DiffDays = DateAndTime.DateDiff(DateInterval.Day,
                                            dt.Date, DateTime.Now.Date,
                                            FirstDayOfWeek.Saturday,
                                            FirstWeekOfYear.FirstFullWeek);

            DaysToEnd = Convert.ToInt32(HideInfo[1]);
            DiffDays  = Math.Abs(DiffDays);

            defDays = DaysToEnd - Convert.ToInt32(DiffDays);

            if (defDays <= 0)
            {
                defDays = 0;
            }
            return(defDays);
        }
示例#2
0
        public bool Reactivate()
        {
            bool result = false;

            try
            {
                productID = "";
                productID = GetProductId(); //combination of a company name and guid
                productID = Encryption.Boring(Encryption.InverseByBase(productID, 10));

                licenseKey = Encryption.MakePassword(productID, identifier);

                if (userPassword == licenseKey)
                {
                    string[] hideInfo = FileReadWrite.ReadFile(hideFilePath).Split(';');
                    for (int i = 4; i < hideInfo.Length; i++)
                    {
                        if (hideInfo[i] == identifier)
                        {
                            MessageBox.Show("You've already tried with the activation code.\nTry to get another identifier with a valid activation code.", "Failed to activate.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return(false);
                        }
                    }
                    string hideData;
                    hideData = DateTime.Now.Ticks.ToString();
                    for (int i = 1; i < hideInfo.Length; i++)
                    {
                        hideData += ";" + hideInfo[i];
                    }
                    hideData += ";" + identifier;

                    if (File.Exists(hideFilePath))
                    {
                        File.Delete(hideFilePath);
                    }

                    FileReadWrite.WriteFile(hideFilePath, hideData);
                    trialDays = 90;
                    result    = true;
                }
                else
                {
                    MessageBox.Show("The password is incorrect.\n Please enter a valid activation code.", "Incorrect Password", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    result = false;
                }

                return(result);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to reactivate the BCF Reader.\n" + ex.Message, "TrialMaker:Reactivate", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }
示例#3
0
 private void MakeHideFile()
 {
     try
     {
         string HideInfo;
         trialDays = 90;
         int tempRunTimes = 10000;
         HideInfo  = DateTime.Now.Ticks + ";";
         HideInfo += trialDays + ";" + tempRunTimes + ";" + productID + ";" + identifier;
         FileReadWrite.WriteFile(hideFilePath, HideInfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to make a hide file.\n" + ex.Message, "TrialMaker:MakeHideFile", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }