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]); }
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]); }
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]); }