示例#1
0
        public IPCMessage GetMessage(Guid messageId)
        {
            if (!MessageLog.ContainsKey(messageId))
            {
                return(null);
            }

            return(MessageLog[messageId]);
        }
示例#2
0
        /// <summary>
        /// Used by clients to send messages
        /// </summary>
        /// <param name="message"></param>
        public Guid SendMessage(IPCMessage message)
        {
            if (MessageLog.ContainsKey(message.Id))
            {
                // Repeated message
                IPCMessage lastMessage = MessageLog[message.Id];
                return(lastMessage.ResponseId);
            }

            message.ResponseId = Guid.NewGuid();
            MessageLog.Add(message.Id, message);

            OnMessageReceived?.Invoke(message);

            return(message.ResponseId);
        }