Beispiel #1
0
        /// <summary>
        /// 获取通信内容
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static ProtocolInfo GetProtocolInfo(XsConfig config, bool monitor = false)
        {
            ProtocolInfo pinfo  = null;
            CookieModel  cmodel = null;

            if (config.Cookies.Length > 0)
            {
                pinfo = new ProtocolInfo();

                cmodel    = config.Cookies[0];
                pinfo.Url = cmodel.Url;

                string strParam = GetParam(config);
                if (cmodel.Method.ToUpper() == "POST")
                {
                    pinfo.Method = ProtocolMethod.Post;

                    pinfo.Url += "/api/game-lottery/static-open-code";
                    pinfo.Data = "name=qqmin&history=true";
                }
                else
                {
                    pinfo.Method = ProtocolMethod.Get;
                    pinfo.Url   += "/newgame_play.shtml?curmid=2660&flag=getopencodes";
                    //pinfo.Url += "/newgame_play.shtml?curmid=2660";
                }
            }
            return(pinfo);
        }
Beispiel #2
0
        /// <summary>
        /// 获取参数
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        private static string GetParam(XsConfig config)
        {
            Dictionary <string, int> param = new Dictionary <string, int>();

            param["id"]  = config.FFCP.Id;
            param["num"] = config.FFCP.Num;

            string data = string.Empty;

            if (param != null) //有参数的情况下,拼接url
            {
                foreach (var item in param)
                {
                    data = data + item.Key + "=" + item.Value + "&";
                }
                data = data.Substring(0, data.Length - 1);
            }
            return(data);
        }
Beispiel #3
0
        /// <summary>
        /// 获取通信内容
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static ProtocolInfo GetProtocolInfo(XsConfig config, bool monitor = false)
        {
            ProtocolInfo pinfo  = null;
            CookieModel  cmodel = null;

            if (config.Cookies.Length > 0)
            {
                pinfo = new ProtocolInfo();

                cmodel    = config.Cookies[0];
                pinfo.Url = cmodel.Url;

                string strParam = GetParam(config);
                if (cmodel.Method.ToUpper() == "POST")
                {
                    pinfo.Method = ProtocolMethod.Post;
                    if (monitor)
                    {
                        pinfo.Url += "/LotteryService.aspx";
                        pinfo.Data = "flag=balance";
                    }
                    else
                    {
                        pinfo.Url += "/UserService.aspx";
                        pinfo.Data = "flag=UIWinOpenNumberBean&" + strParam;
                    }
                }
                else
                {
                    pinfo.Method = ProtocolMethod.Get;
                    pinfo.Url   += "/page/WORecord.shtml?" + strParam;
                }

                UserAgent = cmodel.UserAgent;
            }
            return(pinfo);
        }