Example #1
0
        private static void ServerReceivedRequest(object sender, ReceivedRequestEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }
            IpcMessage requestMessage = JsonConvert.DeserializeObject <IpcMessage>(e.Request);

            switch (requestMessage.Type)
            {
            case IpcMessage.TcpMessageType.Command:
                #region Handle IPC Commands
                if (requestMessage.IsGetVersionMessage())
                {
                    e.Response = version;
                    e.Handled  = true;
                    return;
                }
                if (requestMessage.IsStopMessage())
                {
                    stopEvent.Set();
                    e.Handled = true;
                    return;
                }
                #endregion
                break;

            case IpcMessage.TcpMessageType.Update:
                HandleUpdate(requestMessage.Update);
                e.Handled = true;
                break;
            }
        }