예제 #1
0
        public void Receive(string name, byte[] message, object custom)
        {
            var logItem = new MessageLogItem(DateTime.UtcNow, name, message, custom);

            MessageHistory.Add(logItem);

            if (!MessageBindAccess.AnyBind(name))
            {
                if (ThrowNoneBinds)
                {
                    throw new MessageNotBindedException("Received not binded message: " + name, name, message);
                }
                else
                {
                    return;
                }
            }

            var binds = MessageBindAccess.GetBinds(name);

            for (int i = 0; i < binds.Count; i++)
            {
                binds[i].BindAction(custom);
            }
        }
예제 #2
0
        public void Receive(string name, byte[] message, object custom)
        {
            var logItem = new MessageLogItem(DateTime.UtcNow, name, message, custom);

            MessageHistory.Add(logItem);

            if (!MessageBindAccess.AnyBind(name))
            {
                throw new MessageNotBindedException("Received not binded message: " + name, name, message);
            }

            var binds = MessageBindAccess.GetBinds(name);

            for (int i = 0; i < binds.Count; i++)
            {
                var messageDeserialized = SerializationProvider.Deserialize(binds[i].MessageType, message);
                logItem.AddMessage(messageDeserialized);
                binds[i].BindAction(messageDeserialized);
            }
        }