Esempio n. 1
0
 public virtual string[] UnEncryptSentReward(string content, ref int result, string key)
 {
     try
     {
         string[] array = content.Split(new char[]
         {
             '#'
         });
         if (array.Length == 8)
         {
             string   text     = ConfigurationManager.AppSettings["SentRewardTimeSpan"];
             int      num      = int.Parse(string.IsNullOrEmpty(text) ? "1" : text);
             TimeSpan timeSpan = string.IsNullOrEmpty(array[6]) ? new TimeSpan(1, 1, 1) : (DateTime.Now - BaseInterface.ConvertIntDateTime(double.Parse(array[6])));
             if (timeSpan.Days == 0 && timeSpan.Hours == 0 && timeSpan.Minutes < num)
             {
                 if (string.IsNullOrEmpty(key))
                 {
                     string[] result2 = array;
                     return(result2);
                 }
                 string a = BaseInterface.md5(string.Concat(new string[]
                 {
                     array[2],
                     array[3],
                     array[4],
                     array[5],
                     array[6],
                     key
                 }));
                 if (a == array[7].ToLower())
                 {
                     string[] result2 = array;
                     return(result2);
                 }
                 result = 5;
             }
             else
             {
                 result = 7;
             }
         }
         else
         {
             result = 6;
         }
     }
     catch (Exception exception)
     {
         BaseInterface.log.Error("UnEncryptSentReward", exception);
     }
     return(new string[0]);
 }
Esempio n. 2
0
 public virtual string[] UnEncryptCharge(string content, ref int result, string site)
 {
     try
     {
         string text = string.Empty;
         if (!string.IsNullOrEmpty(site))
         {
             text = ConfigurationManager.AppSettings[string.Format("ChargeKey_{0}", site)];
         }
         if (string.IsNullOrEmpty(text))
         {
             text = BaseInterface.GetChargeKey;
         }
         if (!string.IsNullOrEmpty(text))
         {
             string[] array = content.Split(new char[]
             {
                 '|'
             });
             string a = BaseInterface.md5(string.Concat(new string[]
             {
                 array[0],
                 array[1],
                 array[2],
                 array[3],
                 array[4],
                 text
             }));
             if (array.Length > 5)
             {
                 if (a == array[5].ToLower())
                 {
                     return(array);
                 }
                 result = 7;
             }
             else
             {
                 result = 8;
             }
         }
         else
         {
             result = 6;
         }
     }
     catch (Exception exception)
     {
         BaseInterface.log.Error("UnEncryptCharge", exception);
     }
     return(new string[0]);
 }
Esempio n. 3
0
 public virtual string[] UnEncryptCharge(string content, ref int result, string site)
 {
     try
     {
         string str1 = string.Empty;
         if (!string.IsNullOrEmpty(site))
         {
             str1 = ConfigurationManager.AppSettings[string.Format("ChargeKey_{0}", (object)site)];
         }
         if (string.IsNullOrEmpty(str1))
         {
             str1 = BaseInterface.GetChargeKey;
         }
         if (!string.IsNullOrEmpty(str1))
         {
             string[] strArray = content.Split(new char[1]
             {
                 '|'
             });
             string str2 = BaseInterface.md5(strArray[0] + strArray[1] + strArray[2] + strArray[3] + strArray[4] + str1);
             if (strArray.Length > 5)
             {
                 if (str2 == strArray[5].ToLower())
                 {
                     return(strArray);
                 }
                 result = 7;
             }
             else
             {
                 result = 8;
             }
         }
         else
         {
             result = 6;
         }
     }
     catch (Exception ex)
     {
         BaseInterface.log.Error((object)"UnEncryptCharge", ex);
     }
     return(new string[0]);
 }
Esempio n. 4
0
 public virtual string[] UnEncryptLogin(string content, ref int result, string site)
 {
     try
     {
         string text = string.Empty;
         if (!string.IsNullOrEmpty(site))
         {
             text = ConfigurationManager.AppSettings[string.Format("LoginKey_{0}", site)];
         }
         if (string.IsNullOrEmpty(text))
         {
             text = BaseInterface.GetLoginKey;
         }
         if (!string.IsNullOrEmpty(text))
         {
             string[] array = content.Split(new char[]
             {
                 '|'
             });
             if (array.Length > 3)
             {
                 string a = BaseInterface.md5(array[0] + array[1] + array[2] + text);
                 if (a == array[3].ToLower())
                 {
                     return(array);
                 }
                 result = 5;
             }
             else
             {
                 result = 2;
             }
         }
         else
         {
             result = 4;
         }
     }
     catch (Exception exception)
     {
         BaseInterface.log.Error("UnEncryptLogin", exception);
     }
     return(new string[0]);
 }
Esempio n. 5
0
 public virtual string[] UnEncryptLogin(string content, ref int result, string site)
 {
     try
     {
         string str = string.Empty;
         if (!string.IsNullOrEmpty(site))
         {
             str = ConfigurationManager.AppSettings[string.Format("LoginKey_{0}", (object)site)];
         }
         if (string.IsNullOrEmpty(str))
         {
             str = BaseInterface.GetLoginKey;
         }
         if (!string.IsNullOrEmpty(str))
         {
             string[] strArray = content.Split(new char[1]
             {
                 '|'
             });
             if (strArray.Length > 3)
             {
                 if (BaseInterface.md5(strArray[0] + strArray[1] + strArray[2] + str) == strArray[3].ToLower())
                 {
                     return(strArray);
                 }
                 result = 5;
             }
             else
             {
                 result = 2;
             }
         }
         else
         {
             result = 4;
         }
     }
     catch (Exception ex)
     {
         BaseInterface.log.Error((object)"UnEncryptLogin", ex);
     }
     return(new string[0]);
 }
Esempio n. 6
0
 public virtual string[] UnEncryptSentReward(string content, ref int result, string key)
 {
     try
     {
         string[] strArray = content.Split(new char[1]
         {
             '#'
         });
         if (strArray.Length == 8)
         {
             string   str      = ConfigurationManager.AppSettings["SentRewardTimeSpan"];
             int      num      = int.Parse(string.IsNullOrEmpty(str) ? "1" : str);
             TimeSpan timeSpan = string.IsNullOrEmpty(strArray[6]) ? new TimeSpan(1, 1, 1) : DateTime.Now - BaseInterface.ConvertIntDateTime(double.Parse(strArray[6]));
             if (timeSpan.Days == 0 && timeSpan.Hours == 0 && timeSpan.Minutes < num)
             {
                 if (string.IsNullOrEmpty(key))
                 {
                     return(strArray);
                 }
                 if (BaseInterface.md5(strArray[2] + strArray[3] + strArray[4] + strArray[5] + strArray[6] + key) == strArray[7].ToLower())
                 {
                     return(strArray);
                 }
                 result = 5;
             }
             else
             {
                 result = 7;
             }
         }
         else
         {
             result = 6;
         }
     }
     catch (Exception ex)
     {
         BaseInterface.log.Error((object)"UnEncryptSentReward", ex);
     }
     return(new string[0]);
 }
Esempio n. 7
0
        public virtual string[] UnEncryptSentReward(string content, ref int result, string key)
        {
            try
            {
                //         0       1     2       3       4   5    6    7
                //content=title|content|username|gold|money|param|time|v
                string[] str = content.Split('#');

                //检查content的参数合法
                if (str.Length == 8)
                {
                    string str_spanTime = System.Configuration.ConfigurationSettings.AppSettings["SentRewardTimeSpan"];
                    int    int_spantime = Int32.Parse(string.IsNullOrEmpty(str_spanTime) ? "1" : str_spanTime);
                    //检查time是否超时
                    TimeSpan timeSpan = string.IsNullOrEmpty(str[6]) ? new TimeSpan(1, 1, 1) : DateTime.Now - BaseInterface.ConvertIntDateTime(Double.Parse(str[6]));
                    if (timeSpan.Days == 0 && timeSpan.Hours == 0 && timeSpan.Minutes < int_spantime)
                    {
                        //检查Key
                        if (string.IsNullOrEmpty(key))
                        {
                            return(str);
                        }
                        else
                        {
                            string v = md5(str[2] + str[3] + str[4] + str[5] + str[6] + key);
                            if (v == str[7].ToLower())
                            {
                                return(str);
                            }
                            else
                            {
                                result = 5;     //Key无效
                            }
                        }
                    }
                    else
                    {
                        result = 7;  //time超时
                    }
                }
                else
                {
                    result = 6;  //content参数不对
                }
            }
            catch (Exception ex)
            {
                log.Error("UnEncryptSentReward", ex);
            }

            return(new string[0]);
        }
Esempio n. 8
0
 public static string RequestContent(string Url)
 {
     return(BaseInterface.RequestContent(Url, 2560));
 }