Exemplo n.º 1
0
        protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters)
        {
            Log.DebugFormat("Handeling operation request");

            _handlerList.HandleMessage(new Request(operationRequest.OperationCode,
                                                   operationRequest.Parameters.ContainsKey(_server.SubCodeParameterCode) ? (int?)Convert.ToInt32(operationRequest.Parameters[_server.SubCodeParameterCode])
                                : null, operationRequest.Parameters), this);
        }
Exemplo n.º 2
0
        private void OnOperationRequest(object sender, MessageReceivedEventArgs e)
        {
            Console.WriteLine("Handling operation request");

            using (var message = e.GetMessage()) {
                using (var reader = message.GetReader()) {
                    var parameters =
                        MessageSerializerService.DeserializeObjectOfType <Dictionary <byte, object> >(reader.ReadString());
                    handlerList.HandleMessage(
                        new Request((byte)e.Tag,
                                    parameters.ContainsKey(Server.SubCodeParameterCode)
                                ? (int?)Convert.ToInt32(parameters[Server.SubCodeParameterCode])
                                : null, parameters), this);
                }
            }
        }
Exemplo n.º 3
0
        protected void OnOperationRequest(object sender, MessageReceivedEventArgs e)
        {
            var peer = ConnectionCollection.GetPeers <IClientPeer>().FirstOrDefault(c => c.Client == e.Client);

            subServerHandlerList.Peer = peer;

            Console.WriteLine("Handling operation request");

            using (var message = e.GetMessage()) {
                using (var reader = message.GetReader()) {
                    var parameters =
                        MessageSerializerService.DeserializeObjectOfType <Dictionary <byte, object> >(reader.ReadString());
                    subServerHandlerList.HandleMessage(new Request((byte)e.Tag,
                                                                   parameters.ContainsKey(SubCodeParameterCode)
                            ? (int?)Convert.ToInt32(parameters[SubCodeParameterCode])
                            : null, parameters), this);
                }
            }
        }
Exemplo n.º 4
0
 public void HandleMessage(IMessage message)
 {
     _handlerList.HandleMessage(message, this);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Handle message from the server.
        /// </summary>
        /// <param name="message"></param>
        public void HandleMessage(IMessage message)
        {
            Log.Debug("Handle message.");

            _handlerList.HandleMessage(message, this);
        }