Exemple #1
0
        public static void deSerialize()
        {
            string sPath = HttpContext.Current.Server.MapPath("~/config/config.txt");
            if (!File.Exists(sPath))
            {
                m_lListDictionary = new ListDictionary();
                return;
            }

            m_lListDictionary = new ListDictionary();
            TextReader oTr = File.OpenText(sPath);

            char cN1 = '\n';

            string sTemp = oTr.ReadToEnd();
            string[] asTemp = sTemp.Split(cN1);

            foreach (string sLine in asTemp)
            {
                if (sLine.Length == 0)
                    continue;

                string[] asTemp2 = sLine.Split(',');

                if (asTemp[0].ToString() == "DatabasePassword")
                {
                    CCrypt oCrypt = new CCrypt();
                    m_lListDictionary.Add(asTemp2[0], oCrypt.DESDecrypt(asTemp2[1]));
                    continue;
                }
                m_lListDictionary.Add(asTemp2[0], asTemp2[1]);
            }

            oTr.Close();
        }
Exemple #2
0
        public static void Serialize()
        {
            string sPath = HttpContext.Current.Server.MapPath("~/config/config.txt");

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

            TextWriter oTs = File.CreateText(sPath);

            foreach (DictionaryEntry oDe in m_lListDictionary)
            {
                if (oDe.Key.ToString() != "Username" && oDe.Key.ToString() != "Password")
                {
                    if (oDe.Key.ToString() == "DatabasePassword")
                    {
                        CCrypt oCrypt = new CCrypt();
                        string sCrypt = oCrypt.DESEncrypt(oDe.Value.ToString());
                        oTs.WriteLine(oDe.Key + "," + sCrypt);
                    }
                    else
                    {
                        oTs.WriteLine(oDe.Key + "," + oDe.Value);
                    }
                }
            }
            oTs.Close();
        }
Exemple #3
0
        public static void deSerialize()
        {
            string sPath = HttpContext.Current.Server.MapPath("~/config/config.txt");

            if (!File.Exists(sPath))
            {
                m_lListDictionary = new ListDictionary();
                return;
            }

            m_lListDictionary = new ListDictionary();
            TextReader oTr = File.OpenText(sPath);

            char cN1 = '\n';

            string sTemp = oTr.ReadToEnd();

            string[] asTemp = sTemp.Split(cN1);

            foreach (string sLine in asTemp)
            {
                if (sLine.Length == 0)
                {
                    continue;
                }

                string[] asTemp2 = sLine.Split(',');

                if (asTemp[0].ToString() == "DatabasePassword")
                {
                    CCrypt oCrypt = new CCrypt();
                    m_lListDictionary.Add(asTemp2[0], oCrypt.DESDecrypt(asTemp2[1]));
                    continue;
                }
                m_lListDictionary.Add(asTemp2[0], asTemp2[1]);
            }

            oTr.Close();
        }
Exemple #4
0
 public CPrefs(ulong secretKey)
 {
     var bytes = BitConverter.GetBytes(secretKey);  // 8 bytes secret key
     Crypter = new CCrypt(bytes);
 }
Exemple #5
0
    public CPrefs(ulong secretKey)
    {
        var bytes = BitConverter.GetBytes(secretKey);  // 8 bytes secret key

        Crypter = new CCrypt(bytes);
    }
Exemple #6
0
        public static void Serialize()
        {
            string sPath = HttpContext.Current.Server.MapPath("~/config/config.txt");
            if (File.Exists(sPath))
                File.Delete(sPath);

            TextWriter oTs = File.CreateText(sPath);

            foreach (DictionaryEntry oDe in m_lListDictionary)
            {
                if (oDe.Key.ToString() != "Username" && oDe.Key.ToString() != "Password")
                    if (oDe.Key.ToString() == "DatabasePassword")
                    {
                        CCrypt oCrypt = new CCrypt();
                        string sCrypt = oCrypt.DESEncrypt(oDe.Value.ToString());
                        oTs.WriteLine(oDe.Key + "," + sCrypt);
                    }
                    else
                    {
                        oTs.WriteLine(oDe.Key + "," + oDe.Value);
                    }

            }
            oTs.Close();
        }