Example #1
0
        private void HandleError(object sender, IReply message, GetError error)
        {
            bool  errorFound = false;
            Regex errorRegex = new Regex(error.Match);

            if (message.GetType() == typeof(ServerErrorMessage))
            {
                ServerErrorMessage msg = (ServerErrorMessage)message;
                errorFound = error.Error.Equals(msg.ErrorCode);

                if (errorFound && errorRegex.IsMatch(msg.Message))
                {
                    error.Result = msg;
                    error.Ready.Set();
                }
            }
        }
Example #2
0
        private void HandleReply(object sender, IReply message, GetReply reply)
        {
            bool  replyFound = false;
            Regex replyRegex = new Regex(reply.Match);

            if (message.GetType() == typeof(ServerReplyMessage))
            {
                ServerReplyMessage msg = (ServerReplyMessage)message;
                replyFound = reply.Reply.Equals(msg.ReplyCode);

                if (replyFound && replyRegex.IsMatch(msg.Message))
                {
                    reply.Result = msg;
                    reply.Ready.Set();
                }
            }
        }