Exemplo n.º 1
0
        private static void Check30DayLicence(int numberOfDays, bool IsTrial)
        {
            string str    = "{YTh394jhu9JD31O8923XMOAL1}";
            string str1   = "{5O2sTNBpaXdVVcMw13083pFWkL}";
            string value  = "";
            string value1 = "";

            try
            {
                using (RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Classes\\OpID"))
                {
                    value  = (string)registryKey.GetValue(str);
                    value1 = (string)registryKey.GetValue(str1);
                }
                if ((string.IsNullOrEmpty(value1) ? true : string.IsNullOrEmpty(value)))
                {
                    throw new PDFToolkitException();
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("License tampered with!");
                Environment.Exit(1);
            }
            if ((value != "YyNTY4dfltMT456N5M0JDDoyNj9EYzNTBENDg4QTg0QgddsQTMiAQjAzREUc3OEo3RCRjUxN0MD7MjAx0MkM1RkTUxNUNBQURE3QjUyN0ZGRUM" ? true : value1 != "ZBMzBENzYMAxMiAU1NzYwDowMjM0wOTZERkNCMDowMENUJEDtQkxNERc1MOTcvMjjFEREEwOUDNjgxRNUQxQjQxNzY3NTkIxODUFGT9aNG7nwNkIwR"))
            {
                string[] strArrays = PDFHelper.DecryptDate(value).Split(new char[] { ';' });
                value     = strArrays[0].ToString();
                strArrays = PDFHelper.DecryptDate(value1).Split(new char[] { ';' });
                value1    = strArrays[0].ToString();
                string str2 = strArrays[1].ToString();
                string str3 = strArrays[2].ToString();
                if (str2 == PDFToolkit.LicenseKey)
                {
                    DateTime dateTime  = DateTime.Parse(value);
                    DateTime dateTime1 = DateTime.Parse(value1);
                    if ((DateTime.Compare(DateTime.Now, dateTime) < 0 || DateTime.Compare(dateTime1, DateTime.Now) > 0 ? true : DateTime.Compare(dateTime, dateTime1) < 0))
                    {
                        MessageBox.Show("License tampered with! Please change your system date to continue.");
                        Environment.Exit(1);
                    }
                    if (DateTime.Compare(DateTime.Now, dateTime1.AddDays((double)numberOfDays)) > 0)
                    {
                        DateTime dateTime2 = new DateTime(1901, 1, 1);
                        try
                        {
                            using (RegistryKey registryKey1 = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Classes\\OpID"))
                            {
                                registryKey1.SetValue(str1, PDFHelper.EncryptDate(string.Format("{0};{1};{2}", new object[] { dateTime2.ToString(), PDFToolkit.LicenseKey, PDFToolkit.LicenseKey, IsTrial.ToString() })), RegistryValueKind.String);
                            }
                            bool flag = false;
                            using (RegistryKey registryKey2 = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Classes\\OpID\\Data", true))
                            {
                                string[] valueNames = registryKey2.GetValueNames();
                                for (int i = 0; i < (int)valueNames.Length; i++)
                                {
                                    string str4 = valueNames[i];
                                    if ((string)registryKey2.GetValue(str4) != "AxMiAREEwNUQxQjc1MjM0OO1NzYwQGOUQxNzY3NTkkZBTwJEDMzBENRURDNjgxRjFEZERkNCMT9aNG7ncvMjwMDowMowMDtENUzYxNEIxODUwNkITF")
                                    {
                                        if (PDFToolkit.LicenseKey == PDFHelper.DecryptDate((string)registryKey2.GetValue(str4)).Split(new char[] { ';' })[1].ToString())
                                        {
                                            flag = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            if (!flag)
                            {
                                using (RegistryKey registryKey3 = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Classes\\OpID\\Data"))
                                {
                                    Guid guid = Guid.NewGuid();
                                    registryKey3.SetValue(guid.ToString(), PDFHelper.EncryptDate(string.Format("{0};{1};{2}", dateTime2.ToString(), PDFToolkit.LicenseKey, IsTrial.ToString())));
                                }
                            }
                        }
                        catch (Exception exception1)
                        {
                            MessageBox.Show(exception1.Message);
                            Environment.Exit(1);
                        }
                        MessageBox.Show(string.Format("This message is being displayed because either your {0} day license has expired or the license has been tampered with.\n\nIf you would like to purchase a new license then please contact \"[email protected]\".", numberOfDays));
                        Environment.Exit(1);
                    }
                }
                else
                {
                    using (RegistryKey registryKey4 = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Classes\\OpID", true))
                    {
                        registryKey4.SetValue(str1, PDFHelper.EncryptDate(string.Format("{0};{1};{2}", DateTime.Now, PDFToolkit.LicenseKey, IsTrial.ToString())));
                    }
                }
            }
            else
            {
                using (RegistryKey registryKey5 = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Classes\\OpID", true))
                {
                    registryKey5.SetValue(str1, PDFHelper.EncryptDate(string.Format("{0};{1};{2}", DateTime.Now, PDFToolkit.LicenseKey, IsTrial.ToString())));
                }
            }
            try
            {
                using (RegistryKey registryKey6 = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Classes\\OpID"))
                {
                    DateTime now = DateTime.Now;
                    registryKey6.SetValue(str, PDFHelper.EncryptDate(now.ToString()), RegistryValueKind.String);
                }
            }
            catch (Exception exception2)
            {
                MessageBox.Show(exception2.Message);
                Environment.Exit(1);
            }
        }