Example #1
0
        public static LoginPageCookie GetLoginPageCookie()
        {
            LoginPageCookie result = null;

            try
            {
                result = SerializeUtil.Deserialize <LoginPageCookie>(AESUtil.Decrypt(File.ReadAllText(DataPath + "LoginPageCookie.json"), aesKey));
            }
            catch { }
            return(result);
        }
Example #2
0
 public static void WriteHistory(Dictionary <string, string> msgs)
 {
     Task.Factory.StartNew(() =>
     {
         var json = AESUtil.Encrypt(SerializeUtil.Serialize(msgs), aesKey);
         using (var fs = File.Open(DataPath + "History.json", FileMode.OpenOrCreate))
         {
             var data = Encoding.UTF8.GetBytes(json);
             fs.Write(data, 0, data.Length);
         }
     });
 }
Example #3
0
        public static void WriteData(LoginPageCookie loginPageCookie, LoginPageXml loginPageXml)
        {
            var json1 = AESUtil.Encrypt(SerializeUtil.Serialize(loginPageCookie), aesKey);

            using (var fs = File.Open(DataPath + "LoginPageCookie.json", FileMode.OpenOrCreate))
            {
                var data = Encoding.UTF8.GetBytes(json1);
                fs.Write(data, 0, data.Length);
            }
            var json2 = AESUtil.Encrypt(SerializeUtil.Serialize(loginPageXml), aesKey);

            using (var fs = File.Open(DataPath + "LoginPageXml.json", FileMode.OpenOrCreate))
            {
                var data = Encoding.UTF8.GetBytes(json2);
                fs.Write(data, 0, data.Length);
            }
        }
Example #4
0
        public static Dictionary <string, string> GetHistory()
        {
            Dictionary <string, string> result = null;

            try
            {
                if (File.Exists(DataPath + "History.json"))
                {
                    result = SerializeUtil.Deserialize <Dictionary <string, string> >(AESUtil.Decrypt(File.ReadAllText(DataPath + "History.json"), aesKey));
                }
            }
            catch { }

            return(result);
        }