コード例 #1
0
 private void OnError(SerializedInfo request, AppType appType)
 {
     if (appType != AppType.CppTrader)
     {
         request.UpdateContent(XmlResultHelper.ErrorResult);
     }
     else
     {
         Debug.Assert(appType == AppType.CppTrader);
         request.UpdateContent(JsonResponse.NewErrorResult(request.ClientInfo.ClientInvokeId));
     }
     SendCenter.Default.Send(request);
 }
コード例 #2
0
        private static void InitAndSendInitDataInPointer(SerializedInfo request, DataSet initData)
        {
            DataSet ds = Init(request.ClientInfo.Session, initData);

            request.UpdateContent(new PacketContent(ds.ToPointer()));
            SendCenter.Default.Send(request);
        }
コード例 #3
0
 private void OnLoginStateLoadingCompleteCallback(LoginManager sender, AppType appType)
 {
     sender.StateLoadingCompleted -= OnLoginStateLoadingCompleteCallback;
     if (AppType.Mobile == appType)
     {
         Token token = SessionManager.Default.GetToken(_Request.ClientInfo.Session);
         _Request.UpdateContent(new PacketContent(Mobile.Manager.Login(token)));
         SendCenter.Default.Send(_Request);
     }
     else if (appType == AppType.CppTrader)
     {
         LoginResult result = new LoginResult {
             SessionId = _Request.ClientInfo.Session.ToString(), ServerDateTime = DateTime.Now.ToStandrandDateTimeStr()
         };
         _Request.UpdateContent(JsonResponse.NewResult(_Request.ClientInfo.ClientInvokeId, result));
         SendCenter.Default.Send(_Request);
     }
     if (System.Configuration.ConfigurationManager.AppSettings["MobileDebug"] == "true")
     {
     }
 }
コード例 #4
0
        private void ProcessRequest(SerializedInfo request)
        {
            PacketContent responseContent = null;

            try
            {
                ContentType       contentType = request.Content.ContentType;
                IRequestProcessor requestProcessor;
                if (contentType == ContentType.KeepAlivePacket)
                {
                    requestProcessor = KeepAliveProcessor.Default;
                }
                else if (contentType == ContentType.Xml)
                {
                    requestProcessor = XmlProcessor.Default;
                }
                else if (contentType == ContentType.Json)
                {
                    requestProcessor = JsonProcessor.Default;
                }
                else
                {
                    throw new NotSupportedException();
                }
                responseContent = requestProcessor.Process(request);
            }
            catch (Exception ex)
            {
                responseContent = XmlResultHelper.NewErrorResult(ex.ToString()).ToPacketContent();
            }
            finally
            {
                Application.Default.SessionMonitor.Update(request.ClientInfo.Session);
                if (responseContent != null)
                {
                    request.UpdateContent(responseContent);
                    SendCenter.Default.Send(request);
                }
            }
        }
コード例 #5
0
 private static void SendErrorResult(SerializedInfo request, Exception ex)
 {
     _Logger.Error(ex);
     request.UpdateContent(XmlResultHelper.ErrorResult);
     SendCenter.Default.Send(request);
 }