Ejemplo n.º 1
0
        private string GetCfg(string Key, bool Decrypt)
        {
            string empty = string.Empty;

            using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
            {
                GlobalConfig globalConfig = new GlobalConfig();
                globalConfig = rPMGlobalConfig.GetConfigRecord(Key);
                if (globalConfig != null)
                {
                    empty = globalConfig.Value;
                    if (Decrypt)
                    {
                        try
                        {
                            empty = CryptoIO.Decrypt(empty);
                        }
                        catch (Exception exception)
                        {
                            empty = string.Empty;
                        }
                    }
                }
            }
            return(empty);
        }
Ejemplo n.º 2
0
 public string GetLicenseData()
 {
     try
     {
         return(CryptoIO.Decrypt(context.Licenses.OrderByDescending(license => license.Timestamp).FirstOrDefault().LicData));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Ejemplo n.º 3
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.º 4
0
 private void LoadConfig()
 {
     using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
     {
         GlobalConfig globalConfig = new GlobalConfig();
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_ACCOUNT_PATH");
         if (globalConfig != null)
         {
             this.AccountPath = globalConfig.Value;
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_SYSTEM_PATH");
         if (globalConfig != null)
         {
             this.SystemPath = globalConfig.Value;
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_DB_ACCOUNT");
         if (globalConfig != null)
         {
             this.String_0 = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_DATABASE");
         if (globalConfig != null)
         {
             this.Database = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_PWD");
         if (globalConfig != null)
         {
             this.DBPwd = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_SYS_ENABLED");
         if (globalConfig != null)
         {
             this.IsEnabled = Convert.ToBoolean(globalConfig.Value);
         }
     }
 }
Ejemplo n.º 5
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);
        }