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); }
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); }
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") { } }
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); } } }
private static void SendErrorResult(SerializedInfo request, Exception ex) { _Logger.Error(ex); request.UpdateContent(XmlResultHelper.ErrorResult); SendCenter.Default.Send(request); }