public static List <GroupInfo> GetGroupList2(ICoolQApi api) { List <GroupInfo> list = new List <GroupInfo>(); try { //CQLogger.GetInstance().AddLog(string.Format("[↓][帐号] 取群列表", new object[0])); string url = "http://qun.qq.com/cgi-bin/qun_mgr/get_group_list"; var postData = new Dictionary <string, string>(); XJHTTP xJHTTP = new XJHTTP(); CookieContainer cookieContainer = xJHTTP.StringToCookie("qun.qq.com", api.GetCookies()); postData.Add("bkn", api.GetCsrfToken().ToString()); HttpResults httpResults = xJHTTP.PostHtml(url, "http://qun.qq.com/member.html", "bkn=" + api.GetCsrfToken().ToString(), false, cookieContainer, 15000); string sourceString = httpResults.Html; MyLogUtil.ToLog(httpResults.Html); var strReg = "{\"gc\":([1-9][0-9]{4,10}),\"gn\":\"(.*?)\",\"owner\":([1-9][0-9]{4,10})}"; Regex reg = new Regex(strReg); MatchCollection matches = reg.Matches(sourceString); MyJsonUtil <GroupInfo2> myJsonUtil = new MyJsonUtil <GroupInfo2>(); foreach (Match match in matches) { GroupInfo2 g = myJsonUtil.parseJsonStr(match.Value); list.Add(new GroupInfo(g.gn, g.gc, g.owner)); } } catch (Exception ex) { //MessageBox.Show(ex.Message); MyLogUtil.ErrToLog("获取群列表出现错误,原因:" + ex); } return(list); }
public static MovieConfig GetMovieJsonConfig() { string dirPath = GetDllRoot() + "MovieConfig.txt"; if (File.Exists(dirPath)) { MyJsonUtil <MovieConfig> myJsonUtil = new MyJsonUtil <MovieConfig>(); MovieConfig movieConfig = myJsonUtil.parseJsonStr(MyFileUtil.readFileAll(dirPath)); return(movieConfig); } else { return(null); } }
public static List <ResourceApiInfo> GetVipParserApiList() { string dirPath = GetDllRoot() + "VipParser.txt"; if (File.Exists(dirPath)) { MyJsonUtil <List <ResourceApiInfo> > myJsonUtil = new MyJsonUtil <List <ResourceApiInfo> >(); List <ResourceApiInfo> list = myJsonUtil.parseJsonStr(MyFileUtil.readFileAll(dirPath)); return(list); } else { return(new List <ResourceApiInfo>()); } }
/// <summary> /// 获取基础配置 /// </summary> /// <returns></returns> public static BaseJson GetBaseJsonConfig() { string dirPath = GetDllRoot() + "BaseJson.txt"; if (File.Exists(dirPath)) { MyJsonUtil <BaseJson> myJsonUtil = new MyJsonUtil <BaseJson>(); BaseJson baseJson = myJsonUtil.parseJsonStr(MyFileUtil.readFileAll(dirPath)); return(baseJson); } else { return(new BaseJson()); } }
/// <summary> /// 获取本地配置文件 /// </summary> /// <returns></returns> public static SystemConfigJson GetSystemConfigJson() { try { if (!File.Exists(GetSystemConfigJsonPath())) { return(null); } else { MyJsonUtil <SystemConfigJson> myJsonUtil = new MyJsonUtil <SystemConfigJson>(); string content = MyFileUtil.readFileAll(GetSystemConfigJsonPath()); SystemConfigJson systemConfigJson = myJsonUtil.parseJsonStr(content); return(systemConfigJson); } }catch (Exception e) { return(null); } }
internal Member Recharge(double money, long qq) { Member member = null; MyJsonUtil <Member> myJsonUtil = new MyJsonUtil <Member>(); string memberPath = MySystemUtil.GetMemberPath(qq); if (File.Exists(memberPath)) { string content = MyFileUtil.readFileAll(memberPath); member = myJsonUtil.parseJsonStr(content); //判断用户是否过期 long currentTime = Convert.ToInt64(MyDateUtil.GetTimeStamp(DateTime.Now)); if (currentTime > member.Time)//说明已经过期 { long outOfDate = currentTime + AddTime(money); member.DateDesp = MyDateUtil.ConvertStringToDateTime("" + outOfDate).ToString("yyyy-MM-dd HH:mm:ss"); member.Time = outOfDate; member.Type = 3; } else//还没有过期 { member.Time = member.Time + AddTime(money); member.DateDesp = MyDateUtil.ConvertStringToDateTime("" + member.Time).ToString("yyyy-MM-dd HH:mm:ss"); member.Type = 3; } MyFileUtil.writeToFile(memberPath, myJsonUtil.parseJsonObj(member)); } else { member = new Member(); long currentTime = Convert.ToInt64(MyDateUtil.GetTimeStamp(DateTime.Now)); long outOfDate = currentTime + AddTime(money); member.DateDesp = MyDateUtil.ConvertStringToDateTime("" + outOfDate).ToString("yyyy-MM-dd HH:mm:ss"); member.Time = outOfDate; member.Type = 3; MyFileUtil.writeToFile(memberPath, myJsonUtil.parseJsonObj(member)); } return(member); }
internal Member GetMemberDate(long fromQQ) { Member member = null; string memberPath = MySystemUtil.GetMemberPath(fromQQ); if (File.Exists(memberPath)) { MyJsonUtil <Member> myJsonUtil = new MyJsonUtil <Member>(); string content = MyFileUtil.readFileAll(memberPath); member = myJsonUtil.parseJsonStr(content); long currentTime = Convert.ToInt64(MyDateUtil.GetTimeStamp(DateTime.Now)); if (currentTime > member.Time)//说明已经过期 { member.Type = 2; } } else { member = new Member(); member.Type = 1;//1不是会员 2 会员过期 3 正常会员 } return(member); }