Ejemplo n.º 1
0
 public virtual IEnumerator<ITask> HttpGetHandler(HttpGet httpGet)
 {
     httpGet.ResponsePort.Post(new HttpResponseType(HttpStatusCode.OK,
         _state,
         _transform));
     yield break;
 }
Ejemplo n.º 2
0
 public void Should_Get_Web_Document()
 {
     var httpGet = new HttpGet(20, "", "");
     httpGet.Request("http://www.google.co.uk");
     var document = httpGet.ResponseBody;
     Assert.IsTrue(document.Contains("google"));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="aActionId"></param>
 public BaseStruct(short aActionId, HttpGet httpGet)
     : base(System.Web.HttpContext.Current.Response, aActionId)
 {
     this.aAction = aActionId;
     this.httpGet = httpGet;
     InitAction(System.Web.HttpContext.Current.Response);
 }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;//new HttpResponse(sw);
            response.Charset = "unicode";// "unicode";
            HttpGet httpGet = new HttpGet();
            String ActionID = string.Empty;
            if (httpGet.GetString("ActionID", ref ActionID))
            {
                try
                {
                    string actionName = string.Concat("Action", ActionID);
                    string sname = string.Concat("ZyGames.DirCenter.Action." + actionName);
                    object[] args = new object[1];
                    args[0] = response;

                    BaseStruct obj = (BaseStruct) Activator.CreateInstance(Type.GetType(sname), new object[] { httpGet });
                    if (obj.ReadUrlElement() && obj.DoAction() && !obj.GetError())
                    {
                        obj.BuildPacket();
                        obj.WriteAction();
                    }
                    else
                    {
                        obj.WriteErrorAction();
                        return;
                    }
                }
                catch (Exception ex)
                {
                    BaseLog oBaseLog = new BaseLog("DirCenterErrMain");
                    oBaseLog.SaveLog(ex);
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取Action处理的输出字节流
 /// </summary>
 /// <returns></returns>
 public static byte[] GetActionResponse(int actionId, BaseUser baseUser, string parameters, out HttpGet httpGet)
 {
     string serverHost = string.Format("{0}:{1}", ActionConfig.Current.IpAddress, ActionConfig.Current.Port);
     string param = string.Format("MsgId={0}&St={1}&Sid={2}&Uid={3}&ActionID={4}{5}",
         0,
         "st",
         baseUser.GetSessionId(),
         baseUser.GetUserId(),
         actionId,
         parameters);
     httpGet = new HttpGet(param, baseUser.SocketSid, baseUser.RemoteAddress);
     BaseStruct baseStruct = FindRoute(ActionConfig.Current.TypeName, httpGet, actionId);
     SocketGameResponse response = new SocketGameResponse();
     baseStruct.UserFactory = uid => { return baseUser; };
     baseStruct.SetPush();
     baseStruct.DoInit();
     using (baseStruct.RequestLock())
     {
         if (!baseStruct.GetError() &&
             baseStruct.ReadUrlElement() &&
             baseStruct.DoAction() &&
             !baseStruct.GetError())
         {
             baseStruct.BuildPacket();
             baseStruct.WriteAction(response);
         }
         else
         {
             baseStruct.WriteErrorAction(response);
         }
     }
     return response.ReadByte();
 }
Ejemplo n.º 6
0
 public LoginProxy(HttpGet httpGet)
 {
     this._httpGet = httpGet;
     if (_httpGet != null)
     {
         _httpGet.GetString("RetailID", ref retailID);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="context"></param>
 public HttpServiceRequest(HttpContext context)
 {
     _buffer = new MessageStructure();
     httpGet = new HttpGet(context.Request);
     response = new HttpGameResponse(context.Response);
     ParamString = httpGet.ParamString;
     SessionId = httpGet.SessionId;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 刷新验证码
        /// </summary>
        public void GenerateValidateCode()
        {
            //获取验证码和cookie
            HttpGet get = new HttpGet("https://dynamic.12306.cn/otsweb/passCodeNewAction.do?module=login&rand=sjrand");
            var imgName = Guid.NewGuid();
            var response = get.SendRequest();
            reqCookies = response.Cookies;
            string imgPath = Common.GetImageFromStream(response, Common.GetVirtualPath("\\ValidateCode\\" + imgName));

            this.pictureBox1.ImageLocation = imgPath;
        }
Ejemplo n.º 9
0
 protected override void OnRequested(HttpGet httpGet, IGameResponse response)
 {
     try
     {
         ActionFactory.Request(httpGet, response, GetUser);
     }
     catch (Exception ex)
     {
         Console.WriteLine("OnRequested error:{0}", ex.Message);
     }
 }
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            HttpGet get = new HttpGet(string.Format("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryLeftTicket&orderRequest.train_date={0}&orderRequest.from_station_telecode={1}&orderRequest.to_station_telecode={2}&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00",
                 this.dateTimePicker1.Value.ToString("yyyy-MM-dd"),
                                                              this.textBox1.Tag, this.textBox2.Tag));
            string temp = string.Format("orderRequest.train_date={0}&orderRequest.from_station_telecode={1}&orderRequest.to_station_telecode={2}&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00",
                 this.dateTimePicker1.Value.ToString("yyyy-MM-dd"),
                                                              this.textBox1.Tag, this.textBox2.Tag);
            this.getParams(temp);
            string tests = string.Format("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryLeftTicket&orderRequest.train_date={0}&orderRequest.from_station_telecode={1}&orderRequest.to_station_telecode={2}&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00",
                 this.dateTimePicker1.Value.ToString("yyyy-MM-dd"),
                                                              this.textBox1.Tag, this.textBox2.Tag);
            get.req.Referer = "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init";
            get.req.CookieContainer.Add(reqCookies);
            string result = get.SendReqReturnResponseString();
            //string result = "0,<span id='id_330000K5980K' class='base_txtdiv' onmouseover=javascript:onStopHover('330000K5980K#BXP#WCN') onmouseout='onStopOut()'>K599</span>,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;北京西&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;05:20,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;武昌&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;20:37,15:17,--,--,--,--,--,9,4,--,8,<font color='#008800'>有</font>,--,<a name='btn130_2' class='btn130_2' style='text-decoration:none;' onclick=javascript:getSelected('K599#15:17#05:20#330000K5980K#BXP#WCN#20:37#北京西#武昌#08#27#1*****30364*****00091*****00083*****0004#MUFFMDhDQTNCNEMzQjMwMTU4Qzg5NjdDODMxREI2MkNFODFDMThEREM3MzM0NDA5NEY0RTUzMTU6Ojo6MTM4MTMwMTIxMTg2MQ==#C1')>预&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订</a>";
            result = result.Replace("&nbsp;", string.Empty).Replace("<br>", string.Empty).
                Replace("<font color='#008800'>", string.Empty).Replace("</font>", string.Empty)
                .Replace("<img src='/otsweb/images/tips/first.gif'>", string.Empty)
                 .Replace("<img src='/otsweb/images/tips/last.gif'>", string.Empty)
                  .Replace("<font color='darkgray'>", string.Empty);

            string para1 = "onStopOut()'>";
            string para2 = "</span>";

            string[] trains = result.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
            List<TrainModel> trainList = new List<TrainModel>();
            foreach (string item in trains)
            {
                string[] data = item.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                TrainModel trainmodel = new TrainModel()
                {
                    checi = data[1].Substring(data[1].IndexOf(para1) + para1.Length).Replace(para2, string.Empty),
                    fazhan = data[2],
                    tostation = data[3],
                    lishi = data[4],
                    shangwu = data[5],
                    tedeng = data[6],
                    yideng = data[7],
                    erdeng = data[8],
                    gaojiruanwo = data[9],
                    ruanwo = data[10],
                    yingwo = data[11],
                    ruanzuo = data[12],
                    yingzuo = data[13],
                    wuzuo = data[14],
                    qita = data[15],
                    ordertiket = data[16]
                };
                trainList.Add(trainmodel);
            }

            this.dataGridView1.DataSource = trainList;
        }
Ejemplo n.º 11
0
 public override string get(string uri)
 {
     try
     {
         // Prepare a request object
         HttpGet httpGet = new HttpGet(uri);
         HttpWebResponse response = execute(httpGet);
     }
     catch (UnknownHostException ex)
     {
     }
     return parseResponse(response);
 }
Ejemplo n.º 12
0
        protected override void OnRequested(HttpGet httpGet, IGameResponse response)
        {
            try
            {
                var actionId = httpGet.ActionId;
                var uid = httpGet.GetString("uid");
                Console.WriteLine("Action{0} from {1} {2}", actionId, httpGet.RemoteAddress, uid);
                ActionFactory.Request(httpGet, response, GetUser);

            }
            catch (Exception ex)
            {
                TraceLog.WriteError("{0}", ex);
            }
        }
Ejemplo n.º 13
0
        protected override void OnRequested(HttpGet httpGet, IGameResponse response)
        {
            try
            {
                var actionId = httpGet.ActionId;
                var uid = httpGet.GetString("uid");
                Console.WriteLine("Action{0} from {1} {2}", actionId, httpGet.RemoteAddress, uid);
                ActionFactory.Request(httpGet, response, userId => new GameDataCacheSet<GameUser>().FindKey(userId.ToNotNullString()));

            }
            catch (Exception ex)
            {
                TraceLog.WriteError("{0}", ex);
            }
        }
Ejemplo n.º 14
0
        public List<Passenger> SavePassenger()
        {
            HttpGet get = new HttpGet("https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=getpassengerJson");
            get.req.CookieContainer.Add(reqCookies);
            string json = get.SendReqReturnResponseString();
            if (!string.IsNullOrEmpty(json))
            {
                try
                {
                    passengetList = JsonConvert.DeserializeObject<List<Passenger>>(JObject.Parse(json)["passengerJson"].ToString());

                    if (passengetList.Count > 0)
                    {
                        XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"));
                        XElement rootele = new XElement("data");
                        passengetList.ForEach(x =>
                        {
                            XElement city = new XElement("city");
                            city.SetAttributeValue("first_letter", x.first_letter);
                            city.SetAttributeValue("isUserSelf", x.isUserSelf);
                            city.SetAttributeValue("mobile_no", x.mobile_no);
                            city.SetAttributeValue("old_passenger_id_no", x.old_passenger_id_no);
                            city.SetAttributeValue("old_passenger_id_type_code", x.old_passenger_id_type_code);
                            city.SetAttributeValue("old_passenger_name", x.old_passenger_name);
                            city.SetAttributeValue("passenger_flag", x.passenger_flag);
                            city.SetAttributeValue("passenger_id_no", x.passenger_id_no);
                            city.SetAttributeValue("passenger_id_type_code", x.passenger_id_type_code);
                            city.SetAttributeValue("passenger_id_type_name", x.passenger_id_type_name);
                            city.SetAttributeValue("passenger_name", x.passenger_name);
                            city.SetAttributeValue("passenger_type", x.passenger_type);
                            city.SetAttributeValue("passenger_type_name", x.passenger_type_name);
                            city.SetAttributeValue("recordCount", x.recordCount);
                            city.SetValue(x.passenger_name);
                            rootele.Add(city);
                        });
                        xdoc.Add(rootele);
                        xdoc.Save(passengerXMLPath);
                        return passengetList;
                    }
                }
                catch (Exception ex)
                {
                    return null;
                }
            }
            return null;
        }
Ejemplo n.º 15
0
        protected override void OnRequested(HttpGet httpGet, IGameResponse response)
        {
            try
            {
                //int actionId = 0;
                //if (httpGet.GetInt("actionId", ref actionId))
                //{
                //    Console.WriteLine("request actionId:{0}", actionId);

                //}
                ActionFactory.Request(httpGet, response, userId => new GameDataCacheSet<GameUser>().FindKey(userId.ToNotNullString()));
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("d={0},{1}", httpGet.ParamString, ex.ToString());
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 获取AccessToken
        /// </summary>
        /// <returns>返回请求结果JSON字符串,AccessToken需自行根据不同应用进行提取</returns>
        public virtual string GetAccessToken(Dictionary<string, string> dic, HttpMethod.RequestMethod method)
        {
            UriBuilder uri = new UriBuilder(AccessTokenRequestUrl);
            string queryString = Common.BuildQueryString(dic);
            uri.Query = queryString;
            string result = string.Empty;

            if (method == HttpMethod.RequestMethod.GET) //GET请求
            {
                HttpGet get = new HttpGet(uri.ToString());
                result = get.SendReqReturnResponseString();
            }
            else if (method == HttpMethod.RequestMethod.POST) //POST请求
            {
                HttpPost post = new HttpPost(AccessTokenRequestUrl, queryString);
                result = post.SendReqReturnResponseString();
            }
            return result;
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;//new HttpResponse(sw);
                response.Charset = "unicode";// "unicode";
                //Stopwatch a = new Stopwatch();
                //a.Start();
                HttpGet httpGet = new HttpGet(HttpContext.Current.Request);
                int ActionID = httpGet.ActionId;
                ActionFactory.Request("ZyGames.Tianjiexing.BLL.Action.Action{0},ZyGames.Tianjiexing.BLL", userId => new GameDataCacheSet<GameUser>().FindKey(userId.ToNotNullString()));

                //a.Stop();
                //TraceLog.WriteError("接口访问{0},{1}", ActionID, a.Elapsed.TotalMilliseconds);
            }
            catch (Exception ex)
            {
                new BaseLog().SaveLog(ex);
            }
        }
Ejemplo n.º 18
0
 protected override void OnRequested(HttpGet httpGet, IGameResponse response)
 {
     try
     {
         GuestUser user = null;
         if (_sessions.ContainsKey(httpGet.RemoteAddress))
         {
             user = _sessions[httpGet.RemoteAddress];
         }
         ActionFactory.Request(httpGet, response, GetUser);
         if (user != null)
         {
             httpGet.LoginSuccessCallback(user.UserId);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("OnRequested error:{0}", ex.Message);
     }
 }
Ejemplo n.º 19
0
 public Action1000(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action1000, httpGet)
 {
 }
Ejemplo n.º 20
0
 public Action6412(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action6412, httpGet)
 {
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Contract.Action.LoginAction"/> class.
 /// </summary>
 /// <param name="actionId">Action identifier.</param>
 /// <param name="httpGet">Http get.</param>
 protected LoginAction(short actionId, HttpGet httpGet)
     : base(actionId, httpGet)
 {
     LoginProxy = new LoginProxy(httpGet);
 }
Ejemplo n.º 22
0
 public Action6004(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action6004, httpGet)
 {
 }
Ejemplo n.º 23
0
 public IEnumerator <ITask> HttpGetHandler(HttpGet httpGet)
 {
     httpGet.ResponsePort.Post(new HttpResponseType(_state));
     yield break;
 }
Ejemplo n.º 24
0
 public Action1466(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action1466, httpGet)
 {
 }
Ejemplo n.º 25
0
 public Action6101(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action6101, httpGet)
 {
 }
Ejemplo n.º 26
0
        public void IRSensorsHttpGetHandler(HttpGet httpget)
        {
            HttpResponseType resp = new HttpResponseType(HttpStatusCode.OK, this.state.InfraredSensorState);

            httpget.ResponsePort.Post(resp);
        }
Ejemplo n.º 27
0
        public override bool BookingOrder()
        {
            string strRegCookie = Register.GetRegistData_Root("BRCOOKIE1");

            if (String.IsNullOrEmpty(strRegCookie))
            {
                ConsoleLogInfo("Cookie为空");
                return(false);
            }
            mucookiedata cookieData = JsonHelper.JsonToObject <mucookiedata>(strRegCookie);

            #region 航班搜索

            string strFlightParm = "{\"adtCount\":" + AdultCount + ",\"chdCount\":" + ChildCount + ",\"infCount\":0,\"currency\":\"CNY\",\"tripType\":\"OW\",\"recommend\":false,\"reselect\":\"\",\"page\":\"0\",\"sortType\":\"a\",\"sortExec\":\"a\",\"segmentList\":[{\"deptCd\":\"" + DepAir + "\",\"arrCd\":\"" + ArrAir + "\",\"deptDt\":\"" + DepDate.ToString("yyyy-MM-dd") + "\",\"deptAirport\":\"\",\"arrAirport\":\"\",\"deptCdTxt\":\"上海\",\"arrCdTxt\":\"洛杉矶\",\"deptCityCode\":\"" + DepCity + "\",\"arrCityCode\":\"" + ArrCity + "\"}],\"version\":\"A.1.0\"}";


            string   searchBoody = "_=" + cookieData.serid + "&searchCond=" + strFlightParm;
            HttpPost searchPost  = new HttpPost("http://www.ceair.com/otabooking/flight-search!doFlightSearch.shtml");
            searchPost.Accept      = "application/json, text/javascript, */*; q=0.01";
            searchPost.UserAgent   = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
            searchPost.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
            searchPost.PostData    = searchBoody;
            searchPost.Referer     = "http://www.ceair.com/booking/aicn-apvg-200717_CNY.html";
            searchPost.Host        = "www.ceair.com";
            searchPost.CookieList  = cookieData.cookieList;
            string strSearchRes = searchPost.Request();

            muFlightRspEntity curSearchFlight = JsonHelper.JsonToObject <muFlightRspEntity>(strSearchRes);
            if (curSearchFlight == null)
            {
                ConsoleLogInfo("搜索结果异常");
                return(false);
            }
            if (curSearchFlight.FlightInfo == null)
            {
                ConsoleLogInfo("当前行程无航班");
                return(false);
            }
            FlightInfo selectFlight = curSearchFlight.FlightInfo.Find(delegate(FlightInfo tmpFlight)
            {
                return(tmpFlight.FlightNo == FlightNumber);
            });

            if (selectFlight == null)
            {
                ConsoleLogInfo("未找到航班" + FlightNumber);
                return(false);
            }

            List <SearchProduct> searchProductList = curSearchFlight.SearchProduct.FindAll(delegate(SearchProduct curProduct)
            {
                return(curProduct.Snk.Contains(selectFlight.FlightNo));
            });
            if (searchProductList == null || searchProductList.Count == 0)
            {
                ConsoleLogInfo("未找到报价" + FlightNumber);
                return(false);
            }
            SearchProduct minProduct = null;

            foreach (SearchProduct tmpProduct in searchProductList)
            {
                if (minProduct == null || minProduct.SalePrice > tmpProduct.SalePrice)
                {
                    minProduct = tmpProduct;
                }
            }
            #endregion



            #region 登录
            HttpPost loginPost = null;
            try
            {
                string strLogin = "";
                for (int i = 0; i < 3; i++)
                {
                    HttpPost geetPost = new HttpPost("https://passport.ceair.com/cesso/geet!geetInit.shtml");
                    geetPost.Accept     = "application/json, text/javascript, */*; q=0.01";
                    geetPost.UserAgent  = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
                    geetPost.Referer    = "https://passport.ceair.com/?redirectUrl=http%3A%2F%2Fwww.ceair.com%2F";
                    geetPost.Host       = "passport.ceair.com";
                    geetPost.CookieList = searchPost.RspCookieList;
                    string   strGeetPost = geetPost.Request();
                    initdata curInitData = JsonHelper.JsonToObject <initdata>(strGeetPost);

                    //string strGeetDM = String.Format("http://47.100.165.218:5001/geetest/test1/v3?gt={0}&challenge={1}&guid={2}"
                    //     , curInitData.gt
                    //     , curInitData.challenge
                    //     , "8e741316-f510-8c7e-2d63-240ddbd285e7");

                    #region 校验1
                    //string strGeetDM = String.Format("http://api.geev.top/geetest/tzfresh?gt={0}&challenge={1}&token={2}&refer={3}"
                    //      , curInitData.gt
                    //      , curInitData.challenge
                    //      , "sbsiDHkm47896rud"
                    //     , "");
                    //HttpGet geetDMGet = new HttpGet(strGeetDM);
                    //string strGeetDMRes = geetDMGet.Request();
                    //Root curJiaoYan = JsonHelper.JsonToObject<Root>(strGeetDMRes);
                    //if (String.IsNullOrEmpty(curJiaoYan.validate))
                    //{
                    //    ConsoleLogInfo("滑块异常");
                    //    continue;
                    //}
                    //string body = @"user="******"&password=MTIzNDQzMjE=&token=APDIDJS_donghang_2e4756a51a1253fa85be0217c2dec709&ltv=1&at=1&validateType=geek&geetest_challenge=" + curJiaoYan.challenge + "&geetest_seccode=" + curJiaoYan.validate + "%7Cjordan&geetest_validate=" + curJiaoYan.validate;
                    #endregion

                    #region 校验2
                    string strGeetDM = String.Format("http://47.100.165.218:5001/geetest/test1/v3?gt={0}&challenge={1}&guid={2}"
                                                     , curInitData.gt
                                                     , curInitData.challenge
                                                     , "bc60f196-b582-c9d5-ae9b-91a3c2c5bc8a");
                    HttpGet geetDMGet    = new HttpGet(strGeetDM);
                    string  strGeetDMRes = geetDMGet.Request();

                    ConsoleLogInfo("登录打码" + strGeetDMRes);
                    jiaoyanres curJiaoYan = JsonHelper.JsonToObject <jiaoyanres>(strGeetDMRes);
                    if (String.IsNullOrEmpty(curJiaoYan.validate))
                    {
                        ConsoleLogInfo("滑块异常");
                        continue;
                    }
                    string body = @"user="******"&password=MTIzNDQzMjE=&token=APDIDJS_donghang_2e4756a51a1253fa85be0217c2dec709&ltv=1&at=1&validateType=geek&geetest_challenge=" + curInitData.challenge + "&geetest_seccode=" + curJiaoYan.validate + "%7Cjordan&geetest_validate=" + curJiaoYan.validate;

                    #endregion



                    loginPost             = new HttpPost("https://passport.ceair.com/cesso/login-static!auth.shtml");
                    loginPost.Accept      = "application/json, text/javascript, */*; q=0.01";
                    loginPost.UserAgent   = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
                    loginPost.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
                    loginPost.Referer     = "https://passport.ceair.com/?redirectUrl=http%3A%2F%2Fwww.ceair.com%2F";
                    loginPost.Host        = "passport.ceair.com";
                    loginPost.CookieList  = geetPost.RspCookieList;
                    loginPost.PostData    = body;
                    strLogin = loginPost.Request();
                    if (strLogin.Contains("\"SUCCESS\""))
                    {
                        ConsoleLogInfo("登录成功");
                        break;
                    }
                    else if (strLogin.Contains("用户"))
                    {
                        ConsoleLogInfo("登录失败," + strLogin);
                        break;
                    }
                    else
                    {
                        ConsoleLogInfo("登录失败," + strLogin);
                        continue;
                    }
                }
                if (!strLogin.Contains("\"SUCCESS\""))
                {
                    Console.WriteLine("登录失败" + strLogin);
                    ConsoleLogInfo("登录失败" + strLogin);
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                ConsoleLogError(ex, "登录");
                return(false);
            }

            #endregion

            #region  择航班
            string strSelectBodyFlight = "{\"fscKey\":\"" + curSearchFlight.FscKey + "\",\"isBrandUp\":\"\",\"selcon\":[{\"airPriceUnitIndex\":" + minProduct.Index + ",\"snk\":\"" + minProduct.Snk + "\"}]}";

            strSelectBodyFlight = "_=" + cookieData.serid + "&selectConds=" + strSelectBodyFlight;
            HttpPost selectPost = new HttpPost("http://www.ceair.com/otabooking/flight-confirm!flightConfirm.shtml");
            selectPost.Accept      = "application/json, text/javascript, */*; q=0.01";
            selectPost.UserAgent   = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
            selectPost.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
            selectPost.PostData    = strSelectBodyFlight;
            selectPost.CookieList  = loginPost.RspCookieList;
            selectPost.Referer     = "http://www.ceair.com/booking/aicn-apvg-200717_CNY.html";
            selectPost.Host        = "www.ceair.com";
            string strSelectFlight = selectPost.Request();

            #endregion

            #region 提交乘机人
            Zeus.Log.ZLogClient.WriteLogFile(strSelectFlight);
            string            allChekckToken = strSelectFlight.Split(';')[1];
            List <allPaxInfo> allPax         = new List <allPaxInfo>();
            foreach (var curPassenger in OrderInfo.Passengers)
            {
                string[]   namearray  = curPassenger.name.Split('/');
                allPaxInfo allPaxInfo = new allPaxInfo()
                {
                    uuid                   = "",
                    favorIdx               = "",
                    paxNameFirst           = string.IsNullOrEmpty(curPassenger.lastName) ? namearray[1] : curPassenger.lastName,
                    paxNameLast            = string.IsNullOrEmpty(curPassenger.firstName) ? namearray[0] : curPassenger.firstName,
                    benePaxListIndex       = "1",
                    cardId                 = "",
                    contactInfo            = "",
                    contacts               = "mobile",
                    ffpAirline             = "",
                    ffpNo                  = "",
                    ffpLevel               = "",
                    infCarrierName         = "",
                    insurance              = false,
                    isBeneficariesAssigned = false,
                    isBeneficiary          = "",
                    paxName                = "",
                    paxNameCn              = "",
                    paxOrigin              = "",
                    id             = "",
                    email          = OrderContactInfo.Email,
                    birthday       = DateTime.ParseExact(curPassenger.birthday, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd"),
                    docaCity       = "Park",
                    docaState      = "PA",
                    docaStreet     = "Shinfield Road Reading RG2 7ED",
                    mobileAreaCode = "86",
                    docaPostCode   = "19019",
                    docaNationCode = "",
                    gender         = curPassenger.gender,
                    paxType        = curPassenger.ageType == "1" ? "ADT" : "CHD",
                    idIssueNation  = curPassenger.nationality,
                    nationality    = curPassenger.nationality,
                    idDetails      = new List <idDetail>(),
                    idType         = curPassenger.cardType == "1" ? "PP" : "OTHER",
                    idNo           = curPassenger.cardNum,
                    insureInfos    = new List <object>(),
                    idValidDt      = DateTime.ParseExact(curPassenger.cardExpired, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy-MM-dd"),
                    mobile         = OrderContactInfo.Phone,
                };
                allPaxInfo.idDetails = new List <idDetail>();
                allPaxInfo.idDetails.Add(
                    new idDetail()
                {
                    id            = allPaxInfo.id,
                    idIssueNation = allPaxInfo.nationality,
                    idType        = allPaxInfo.idType,
                    idNo          = allPaxInfo.idNo,
                    idValidDt     = allPaxInfo.idValidDt
                });
                allPax.Add(allPaxInfo);
            }
            string TimeStamp    = GetTimeStamp();
            string strPassenger = JsonHelper.ObjectToJson(allPax);
            //strPassenger = "[{\"uuid\":\"ac830890-7a12-11ea-a0dc-b1efc89d2a80\",\"favorIdx\":\"ac821e30-7a12-11ea-a0dc-b1efc89d2a80\",\"benePaxListIndex\":\"\",\"birthday\":\"1980-01-01\",\"docaCity\":\"Park\",\"docaNationCode\":\"\",\"docaPostCode\":\"19019\",\"docaState\":\"PA\",\"docaStreet\":\"Shinfield Road Reading RG2 7ED\",\"mobileAreaCode\":\"\",\"email\":\"\",\"ffpAirline\":\"\",\"ffpLevel\":\"\",\"ffpNo\":\"\",\"gender\":\"M\",\"idNo\":\"G44444555\",\"idType\":\"PP\",\"id\":\"\",\"idValidDt\":\"2022-04-19\",\"idIssueNation\":\"CN\",\"nationality\":\"CN\",\"infCarrierName\":\"\",\"insurance\":false,\"insureInfos\":[],\"mobile\":\"17600883716\",\"contactInfo\":\"\",\"contacts\":\"mobile\",\"cardId\":\"\",\"paxType\":\"ADT\",\"paxName\":\"\",\"paxNameCn\":\"\",\"paxNameFirst\":\"DADA\",\"paxNameLast\":\"PANG\",\"isBeneficariesAssigned\":false,\"isBeneficiary\":\"\",\"paxOrigin\":\"0\",\"idDetails\":[{\"id\":\"\",\"idNo\":\"G44444555\",\"idType\":\"PP\",\"idIssueNation\":\"CN\",\"idValidDt\":\"2022-04-19\"}]}]";
            #region 判断乘机人信息
            HttpPost checkDataPost = new HttpPost("http://www.ceair.com/otabooking/paxinfo-input!checkDataNew.shtml");
            checkDataPost.Accept      = "application/json, text/javascript, */*; q=0.01";
            checkDataPost.UserAgent   = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
            checkDataPost.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
            checkDataPost.PostData    = @"allPaxInfo=" + HttpUtility.UrlEncode(strPassenger) + "&sessionVersion=" + curSearchFlight.CreateTime;
            checkDataPost.CookieList  = loginPost.RspCookieList;
            checkDataPost.Referer     = "http://www.ceair.com/booking/passenger.html?allCheckToken=" + allChekckToken;
            checkDataPost.Host        = "www.ceair.com";
            string strCheckData = checkDataPost.Request();

            if (!strCheckData.Contains("\"passCheck\":true"))
            {
                ConsoleLogInfo("乘机人信息有误:" + strCheckData);
                return(false);
            }
            CheckPassengerRes checkDataRes = JsonHelper.JsonToObject <CheckPassengerRes>(strCheckData);
            #endregion

            string strPassContact = JsonHelper.ObjectToJson(new PascontactInfo()
            {
                contactEmail  = OrderContactInfo.Email,
                contactMobile = OrderContactInfo.Phone,
                contactName   = OrderContactInfo.FirstName + OrderContactInfo.LastName,
                id            = Zeus.Sys.Common.Utility.GetNewID().ToString().MD5().Substring(2, 8)
            });

            #region 判断联系人信息
            HttpPost checkContact = new HttpPost("http://www.ceair.com/otabooking/paxinfo-input!checkContactInfo.shtml");
            checkContact.Accept      = "application/json, text/javascript, */*; q=0.01";
            checkContact.UserAgent   = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
            checkContact.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
            checkContact.PostData    = @"contactInfo=" + HttpUtility.UrlEncode(strPassContact) + "&sessionVersion=" + curSearchFlight.CreateTime;
            checkContact.CookieList  = loginPost.RspCookieList;
            checkContact.Referer     = "http://www.ceair.com/booking/passenger.html?allCheckToken=" + allChekckToken;
            checkContact.Host        = "www.ceair.com";
            string strcheckContact = checkContact.Request();
            if (!strcheckContact.Contains("\"checkOfResult\":true"))
            {
                ConsoleLogInfo("联系人信息有误:" + strcheckContact);
                return(false);
            }
            #endregion


            string   strBodyPassenger = "allPaxInfo=" + HttpUtility.UrlEncode(strPassenger) + "&contactInfo=" + HttpUtility.UrlEncode(strPassContact) + "&sessionVersion=" + curSearchFlight.CreateTime + "&nonmember=0&useScore=false";
            HttpPost passengerPost    = new HttpPost("http://www.ceair.com/otabooking/paxinfo-input!showBookingInfoNew.shtml");
            passengerPost.Accept      = "text/plain, */*; q=0.01";
            passengerPost.UserAgent   = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
            passengerPost.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
            passengerPost.PostData    = strBodyPassenger;
            passengerPost.CookieList  = checkContact.RspCookieList;
            passengerPost.Referer     = "http://www.ceair.com/booking/passenger.html?allCheckToken=" + allChekckToken;
            passengerPost.Host        = "www.ceair.com";
            string strSubmitPassenger = passengerPost.Request();
            if (strSubmitPassenger != "success")
            {
                ConsoleLogInfo("提交乘机人失败:" + strSubmitPassenger);
                return(false);
            }
            #endregion

            HttpGet getVerifyCode = new HttpGet("http://www.ceair.com/booking/verification-code!getBookingVerficationCode.shtml?_=" + curSearchFlight.CreateTime + "");
            getVerifyCode.Accept     = "text/plain, */*; q=0.01";
            getVerifyCode.CookieList = passengerPost.RspCookieList;
            getVerifyCode.UserAgent  = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
            getVerifyCode.Referer    = "http://www.ceair.com/booking/passenger.html?allCheckToken=" + allChekckToken;

            string  code      = getVerifyCode.Request();
            HttpGet getPayUrl = new HttpGet("http://www.ceair.com/otabooking/booking!booking.shtml?checkToken=" + code + "&allCheckToken=" + allChekckToken + "");
            getPayUrl.Accept     = "application/json, text/javascript, */*; q=0.01";
            getPayUrl.CookieList = getVerifyCode.RspCookieList;
            getPayUrl.UserAgent  = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36 Edg/80.0.361.111";
            getPayUrl.Referer    = "http://www.ceair.com/booking/passenger.html?allCheckToken=" + allChekckToken;

            string        payurl  = getPayUrl.Request();
            PayUrlResInfo resinfo = JsonHelper.JsonToObject <PayUrlResInfo>(payurl);
            if (string.IsNullOrEmpty(resinfo.nextUrl) || string.IsNullOrEmpty(resinfo.orderNo))
            {
                ConsoleLogInfo(resinfo.airResultMsg);
                return(false);
            }
            OrderBackInfo.airorderinfo = new airorderinfo()
            {
                airordercode = resinfo.orderNo.ToString()
            };
            OrderBackInfo.airorderinfo.airPayInfo = new airpayinfo()
            {
                payUrl      = resinfo.nextUrl,
                lastPayTime = DateTime.Now.AddMinutes(10),
                payprice    = decimal.Parse(checkDataRes.price.totalPrice.price),
                paycurrency = checkDataRes.price.totalFee.currency
            };
            return(true);
        }
Ejemplo n.º 28
0
 public Action1001(HttpGet httpGet)
     : base(1001, httpGet)
 {
 }
Ejemplo n.º 29
0
        public int GetDefaultProfile()
        {
            if (defaultprofileid == 0)
            {
                if (Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), WORKSPACE_FOLDER, PROFILES_FOLDER)))
                {
                    string[] fileEntries = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), WORKSPACE_FOLDER, PROFILES_FOLDER));

                    foreach (string filepath in fileEntries)
                    {
                        string filename = Path.GetFileName(filepath);

                        if (filename.EndsWith(".json") && filename.Split('_').Length == 2)
                        {
                            try
                            {
                                string profileidstr = filename.Split('_')[1].Split('.')[0];

                                if (Int32.TryParse(profileidstr, out int profileid))
                                {
                                    string      profilefilecont = File.ReadAllText(filepath);
                                    HttpProfile profile         = JsonConvert.DeserializeObject <HttpProfile>(profilefilecont);

                                    if (profile.Default)
                                    {
                                        defaultprofileid = profileid;
                                    }

                                    availableprofile.Add(profileid, profile);
                                }
                            }
                            catch
                            {
                            }
                        }
                    }

                    if (availableprofile.Count == 0)
                    {
                        Console.WriteLine("[*] No profile avalilable, creating new one...");

                        var profile = new HttpProfile
                        {
                            Delay            = 5000,
                            Default          = true,
                            Name             = "Default",
                            UserAgent        = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36",
                            ContentUri       = "/content/",
                            Spawn            = "notepad.exe",
                            HtmlCovered      = false,
                            InjectionManaged = true
                        };

                        HttpGet httpget = new HttpGet
                        {
                            ApiPath = new string[] { "/newslist.jsp" }
                        };

                        HttpClient getclient = new HttpClient();

                        HttpHeader[] headers = new HttpHeader[3];

                        HttpHeader header = new HttpHeader
                        {
                            Name  = "Cache-Control",
                            Value = "no-cache"
                        };

                        headers[0] = header;

                        header = new HttpHeader
                        {
                            Name  = "Connection",
                            Value = "Keep-Alive"
                        };

                        headers[1] = header;

                        header = new HttpHeader
                        {
                            Name  = "Pragma",
                            Value = "no-cache"
                        };

                        headers[2] = header;

                        getclient.Headers = headers;

                        httpget.Client = getclient;

                        HttpServer getserver = new HttpServer();

                        HttpHeader[] serverheaders = new HttpHeader[3];

                        HttpHeader serverheader = new HttpHeader
                        {
                            Name  = "Content-Type",
                            Value = "application/octet-stream"
                        };

                        serverheaders[0] = serverheader;

                        serverheader = new HttpHeader
                        {
                            Name  = "Connection",
                            Value = "Keep-Alive"
                        };

                        serverheaders[1] = serverheader;

                        serverheader = new HttpHeader
                        {
                            Name  = "Server",
                            Value = "Apache"
                        };

                        serverheaders[2] = serverheader;

                        getserver.Headers = serverheaders;

                        httpget.Server = getserver;

                        profile.HttpGet = httpget;

                        var httppost = new HttpPost
                        {
                            ApiPath = new string[] { "/newslist.jsp" },
                            Client  = getclient,
                            Server  = getserver,
                            Param   = "stocklevel",
                            Mask    = @"{0}={1}"
                        };
                        profile.HttpPost = httppost;

                        string deser = JsonConvert.SerializeObject(profile, Formatting.Indented);
                        File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), WORKSPACE_FOLDER, PROFILES_FOLDER, "default_1.json"), deser);

                        defaultprofileid = 1;
                        availableprofile.Add(defaultprofileid, profile);
                    }
                }
                else
                {
                    Console.WriteLine(Path.Combine(Directory.GetCurrentDirectory(), WORKSPACE_FOLDER, PROFILES_FOLDER));
                }

                if (defaultprofileid == 0 && availableprofile.Count > 0)
                {
                    availableprofile.First().Value.Default = true;
                    defaultprofileid = availableprofile.First().Key;
                }

                return(defaultprofileid);
            }
            else
            {
                return(defaultprofileid);
            }
        }
Ejemplo n.º 30
0
        public void CanGetMultiRecipientEventDetails()
        {
            http.Stub(
                HttpGet
                .Url("https://api.cronofy.com/v1/smart_invites?smart_invite_id=example-event-id")
                .RequestHeader("Authorization", string.Format("Bearer {0}", clientSecret))
                .ResponseCode(200)
                .ResponseBody(@"{
                      ""recipients"": [
                       {
                         ""email"": ""*****@*****.**"",
                         ""status"": ""accepted""
                       },
                       {
                         ""email"": ""*****@*****.**"",
                         ""status"": ""declined"",
                         ""comment"": ""example comment"",
                         ""proposal"": {
                            ""start"": {
                              ""time"": ""2014-09-13T23:00:00+02:00"",
                              ""tzid"": ""Europe/Paris""
                            },
                            ""end"": {
                              ""time"": ""2014-09-13T23:00:00+02:00"",
                              ""tzid"": ""Europe/Paris""
                            }
                          }
                       }
                      ],
                      ""smart_invite_id"": ""your-unique-identifier-for-invite"",
                      ""callback_url"": ""https://example.yourapp.com/cronofy/smart_invite/notifications"",
                      ""method"": ""request"",
                      ""event"": {
                        ""summary"": ""Board meeting"",
                        ""description"": ""Discuss plans for the next quarter."",
                        ""start"": ""2017-10-05T09:30:00Z"",
                        ""end"": ""2017-10-05T10:00:00Z"",
                        ""tzid"": ""Europe/London"",
                        ""location"": {
                          ""description"": ""Board room""
                        }
                      },
                      ""attachments"": {
                        ""icalendar"": ""BEGIN:VCALENDAR\nVERSION:2.0...""
                      }
                    }")
                );

            var actual = client.GetSmartInvite("example-event-id");

            Assert.Equal("your-unique-identifier-for-invite", actual.SmartInviteId);
            Assert.Equal("https://example.yourapp.com/cronofy/smart_invite/notifications", actual.CallbackUrl);
            Assert.Equal("request", actual.Method);
            Assert.Equal("BEGIN:VCALENDAR\nVERSION:2.0...", actual.Attachments.ICalendar);

            Assert.Equal(2, actual.Recipients.Count());

            var reply1 = actual.Recipients.First();

            Assert.NotNull(reply1);
            Assert.Equal("*****@*****.**", reply1.Email);
            Assert.Equal("accepted", reply1.Status);

            var reply2 = actual.Recipients.Last();

            Assert.NotNull(reply2);
            Assert.Equal("*****@*****.**", reply2.Email);
            Assert.Equal("declined", reply2.Status);
            Assert.Equal("example comment", reply2.Comment);
            Assert.Equal(new EventTime(new DateTimeOffset(2014, 9, 13, 23, 00, 00, TimeSpan.FromHours(2)), "Europe/Paris"), reply2.Proposal.Start);
            Assert.Equal(new EventTime(new DateTimeOffset(2014, 9, 13, 23, 00, 00, TimeSpan.FromHours(2)), "Europe/Paris"), reply2.Proposal.End);
        }
Ejemplo n.º 31
0
 public PayNormalAction(short aActionId, HttpGet httpGet)
     : base(aActionId, httpGet)
 {
 }
Ejemplo n.º 32
0
 public Action2003(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action2003, httpGet)
 {
 }
Ejemplo n.º 33
0
 public Action9003(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action9003, httpGet)
 {
 }
Ejemplo n.º 34
0
 /// <summary>
 /// /
 /// </summary>
 /// <param name="aActionId"></param>
 /// <param name="httpGet"></param>
 /// <param name="scriptRoute"></param>
 /// <param name="ignoreAuthorize">忽略授权</param>
 public ScriptAction(short aActionId, HttpGet httpGet, ScriptRoute scriptRoute, bool ignoreAuthorize)
     : base(aActionId, httpGet)
 {
     _scriptRoute     = scriptRoute;
     _ignoreAuthorize = ignoreAuthorize;
 }
Ejemplo n.º 35
0
 protected AuthorizeAction(short actionID, HttpGet httpGet)
     : base(actionID, httpGet)
 {
 }
Ejemplo n.º 36
0
 public Action1025(HttpGet httpGet)
     : base(1025, httpGet)
 {
 }
 public void OnWebcamHttpGet(HttpGet get)
 {
     this.webCamPort.HttpGetHelper(get, this.webCamState, this.webCamTransform);
 }
Ejemplo n.º 38
0
 public Action5205(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action5205, httpGet)
 {
 }
Ejemplo n.º 39
0
 protected override void OnRequested(HttpGet httpGet, IGameResponse response)
 {
     Console.WriteLine("Request data:{0}", httpGet.ParamString);
 }
Ejemplo n.º 40
0
 public Action100(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action100, httpGet)
 {
     _roomStruct = new MemoryCacheStruct <UserConnection>();
 }
Ejemplo n.º 41
0
 public Action1081(short aActionId, HttpGet httpGet)
     : base(aActionId, httpGet)
 {
 }
Ejemplo n.º 42
0
 public Action1016(HttpGet httpGet)
     : base(1016, httpGet)
 {
 }
Ejemplo n.º 43
0
 public Action1007(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action1007, httpGet)
 {
 }
Ejemplo n.º 44
0
 public Action1081(short aActionId, HttpGet httpGet)
     : base(aActionId, httpGet)
 {
 }
Ejemplo n.º 45
0
        private void ProcessPackage(object state)
        {
            var package = (RequestPackage)state;
            if (package == null) return;

            var session = package.Session;
            try
            {
                byte[] data = new byte[0];
                if (!string.IsNullOrEmpty(package.RouteName))
                {
                    HttpGet httpGet = new HttpGet(package);
                    if (CheckRemote(package.RouteName, httpGet))
                    {
                        MessageStructure response = new MessageStructure();
                        OnCallRemote(package.RouteName, httpGet, response);
                        data = response.PopBuffer();
                    }
                }
                else
                {
                    SocketGameResponse response = new SocketGameResponse();
                    response.WriteErrorCallback += ActionDispatcher.ResponseError;
                    ActionGetter actionGetter = ActionDispatcher.GetActionGetter(package);
                    OnRequested(actionGetter, response);
                    data = response.ReadByte();
                }
                try
                {
                    if (data.Length > 0)
                    {
                        session.SendAsync(data, 0, data.Length);
                    }
                }
                catch (Exception ex)
                {
                    TraceLog.WriteError("PostSend异常{0}", ex);
                }

            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Task异常{0}", ex);
            }
            finally
            {
                session.ExitSession();
                Interlocked.Decrement(ref runningNum);
            }
        }
Ejemplo n.º 46
0
 public Action4302(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action4302, httpGet)
 {
 }
Ejemplo n.º 47
0
 public Action7007(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action7007, httpGet)
 {
 }
Ejemplo n.º 48
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZyGames.Framework.Game.Contract.Action.AppStoreDetailAction"/> class.
 /// </summary>
 /// <param name="aActionId">A action identifier.</param>
 /// <param name="httpGet">Http get.</param>
 public AppStoreDetailAction(short aActionId, HttpGet httpGet)
     : base(aActionId, httpGet)
 {
 }
Ejemplo n.º 49
0
        public string Get(string name)
        {
            string path = AppSettingUtility.PreDataPath + "CarDetection/" + name + ".txt";

            return(HttpGet.GetPreData(path));
        }
Ejemplo n.º 50
0
        //protected override void DoListen()
        //{
        //    this.ServiceProxy.Listen(9001);
        //}

        protected override void OnCallRemote(string route, HttpGet httpGet, MessageHead head, MessageStructure structure)
        {
        }
Ejemplo n.º 51
0
 public Action1000(HttpGet httpGet)
     : base(1000, httpGet)
 {
 }
Ejemplo n.º 52
0
 public Action7010(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action7010, httpGet)
 {
 }
Ejemplo n.º 53
0
 public Action1201(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action1201, httpGet)
 {
 }
Ejemplo n.º 54
0
 public IEnumerator <ITask> HttpGetHandler(HttpGet get)
 {
     get.ResponsePort.Post(new HttpResponseType(HttpStatusCode.OK, _state));
     yield break;
 }
Ejemplo n.º 55
0
        void HttpGetHandler(HttpGet httpGet)
        {
            HttpListenerRequest request = httpGet.Body.Context.Request;
            HttpListenerResponse response = httpGet.Body.Context.Response;

            Stream image = null;

            string path = request.Url.AbsolutePath;

            if (path == _cylinder)
            {
                image = GenerateCylinder();
            }
            else if (path == _top)
            {
                image = GenerateTop(400);
            }
            else if (path.StartsWith(_topw))
            {
                int width;
                string remain = path.Substring(_topw.Length);

                if (int.TryParse(remain, out width))
                {
                    image = GenerateTop(width);
                }
            }
            else if (path == _root)
            {
                HttpResponseType rsp = new HttpResponseType(HttpStatusCode.OK,
                _state,
                //base.StateTransformPath,
                _transform);
                httpGet.ResponsePort.Post(rsp);
            }

            if (image != null)
            {
                SendJpeg(httpGet.Body.Context, image);
            }
            else
            {
                httpGet.ResponsePort.Post(Fault.FromCodeSubcodeReason(
                    W3C.Soap.FaultCodes.Receiver,
                    DsspFaultCodes.OperationFailed,
                    "Unable to generate Image"));
            }
        }
Ejemplo n.º 56
0
 public Action1258(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action1258, httpGet)
 {
 }
Ejemplo n.º 57
0
 public Action100(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action100, httpGet)
 {
     _roomStruct = new MemoryCacheStruct<UserConnection>();
 }
Ejemplo n.º 58
0
 public Action5305(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action5305, httpGet)
 {
 }
Ejemplo n.º 59
0
 public Action3009(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action3009, httpGet)
 {
 }
Ejemplo n.º 60
0
 public Action13002(HttpGet httpGet)
     : base(ActionIDDefine.Cst_Action13002, httpGet)
 {
 }