Ejemplo n.º 1
0
        public bool UpdateLicense(string data)
        {
            bool flag = false;

            try
            {
                string[] strArray1 = GetLicenseData().Split('|');
                string[] strArray2 = CryptoIO.Decrypt(data).Split('|');
                int      int32     = Convert.ToInt32(strArray2[2]);
                DateTime now       = DateTime.Now;
                using (RPM_GlobalConfig rpmGlobalConfig = new RPM_GlobalConfig())
                {
                    GlobalConfig configRecord = rpmGlobalConfig.GetConfigRecord("PRODUCT_KEY");
                    string[]     strArray3    = CryptoIO.Decrypt(configRecord.Value).Split('|');
                    if (strArray2[0].Equals(strArray3[0]))
                    {
                        if (strArray2[1].Equals(strArray3[1]))
                        {
                            if (strArray3[1].Equals(strArray1[1]))
                            {
                                configRecord.Value = CryptoIO.Encrypt(string.Format("{0}|{1}", strArray3[0], now));
                                rpmGlobalConfig.SaveUpdate(configRecord);
                                rpmGlobalConfig.Save();
                                flag = true;
                            }
                        }
                    }
                }
                if (flag)
                {
                    using (new RPM_License())
                    {
                        License rec = new License();
                        rec.Timestamp = now;
                        Guid guid = Guid.NewGuid();
                        rec.LicData = CryptoIO.Encrypt(string.Format("{0}|{1}|{2}", guid, now, int32));
                        SaveUpdate(rec);
                        Save();
                    }
                }
            }
            catch
            {
            }
            return(flag);
        }
Ejemplo n.º 2
0
        public void CreateDefaultLicense()
        {
            License  rec = new License();
            DateTime now = DateTime.Now;

            rec.Timestamp = now;
            Guid guid = Guid.NewGuid();

            rec.LicData = CryptoIO.Encrypt(string.Format("{0}|{1}|1", guid, now));
            SaveUpdate(rec);
            Save();
            using (RPM_GlobalConfig rpmGlobalConfig = new RPM_GlobalConfig())
            {
                rpmGlobalConfig.SaveUpdate(new GlobalConfig()
                {
                    Key        = "PRODUCT_KEY",
                    Value      = CryptoIO.Encrypt(string.Format("{0}|{1}", Guid.NewGuid(), now)),
                    IsEditable = false,
                    Desc       = "C3 Sentinel SKU Product ID",
                    DataType   = "STRING"
                });
                rpmGlobalConfig.Save();
            }
        }
Ejemplo n.º 3
0
        public string GetRequestKey(int Count)
        {
            string str         = string.Empty;
            string licenseData = GetLicenseData();

            if (!string.IsNullOrEmpty(licenseData))
            {
                string[] strArray1 = licenseData.Split('|');
                using (RPM_GlobalConfig rpmGlobalConfig = new RPM_GlobalConfig())
                {
                    str = rpmGlobalConfig.GetConfigValue("PRODUCT_KEY");
                    if (string.IsNullOrEmpty(str))
                    {
                        return(null);
                    }
                    string[] strArray2 = CryptoIO.Decrypt(str).Split('|');
                    if (strArray1[1].Equals(strArray2[1]))
                    {
                        str = CryptoIO.Encrypt(string.Format("{0}|{1}|{2}|{3}|{4}", DateTime.Now.Millisecond, strArray2[0], strArray1[1], DateTime.Now, Count));
                    }
                }
            }
            return(str);
        }