public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (MessageType.Length != 0)
            {
                hash ^= MessageType.GetHashCode();
            }
            if (MessageSubtype.Length != 0)
            {
                hash ^= MessageSubtype.GetHashCode();
            }
            if (IsText != false)
            {
                hash ^= IsText.GetHashCode();
            }
            if (TextContent.Length != 0)
            {
                hash ^= TextContent.GetHashCode();
            }
            if (BytesContent.Length != 0)
            {
                hash ^= BytesContent.GetHashCode();
            }
            if (ContentStampTime.Length != 0)
            {
                hash ^= ContentStampTime.GetHashCode();
            }
            if (CreateTime.Length != 0)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (RoutingKey.Length != 0)
            {
                hash ^= RoutingKey.GetHashCode();
            }
            return(hash);
        }
示例#2
0
        public static void ProcessMessage(MessageSubtype messageSubtype, IList <Byte[]> data, Messenger typeWrapper)
        {
            switch (messageSubtype)
            {
            case MessageSubtype.Reply:
                OnReply();
                break;

            case MessageSubtype.Feedback:
                OnFeedback();
                break;
            }

            void OnReply()
            {
                var casted = typeWrapper as IRawMessenger;

                if (casted is null)
                {
                    throw new InvalidCastException("Wrong message type.");
                }

                casted.ReceiveMessage(data);
            }

            void OnFeedback()
            {
                var casted = typeWrapper as IActionMessenger <Message, Message, Message>;

                if (casted is null)
                {
                    throw new InvalidCastException("Wrong message type.");
                }

                casted.ReceiveFeedback(data);
            }
        }