예제 #1
0
        private void HandleClientConnection(NamedPipeServerStream pipe)
        {
            var reader            = new JsonStreamReader(pipe, Encoding.UTF8);
            var requestJsonString = reader.ReadJsonString();
            var response          = BuildResponse(requestJsonString);
            var writer            = new JsonStreamWriter(pipe);

            writer.WriteJson(response);
            writer.Flush();
        }
        private void HandleClientConnection(NamedPipeServerStream pipe)
        {
            // Read query request.
            var    reader        = new JsonStreamReader(pipe, Encoding.UTF8);
            var    legacyRequest = reader.ReadJson <LegacyRequest>();
            object response      = null;

            if (!string.IsNullOrEmpty(legacyRequest.EquipmentSlot))
            {
                response = new LegacyResponse(HandleRequest(legacyRequest.AsRequest()));
            }
            else
            {
                response = HandleRequest(reader.ReadJson <Request>());
            }
            WriteResponse(pipe, response);
        }