Example #1
0
 public void AssertType(RedisReplyType expectedType, RedisReplyType actualType)
 {
     if (actualType != expectedType)
     {
         throw new RedisProtocolException("意外的回复类型:'{0}',预期回复类型:'{1}'。".Fmt(actualType, expectedType));
     }
 }
Example #2
0
        public void AssertType(RedisReplyType expectedType)
        {
            var actualType = this.ReadType();

            if ((int)actualType == -1)
            {
                throw new RedisIOException("意外结束的流,预期回复类型:'{0}'。".Fmt(expectedType));
            }
            this.AssertType(expectedType, actualType);
        }
Example #3
0
        public object ReadObject()
        {
            RedisReplyType type = ReadType();

            switch (type)
            {
            case RedisReplyType.Bulk:
                return(new BinaryValue(ReadBulk(false)));

            case RedisReplyType.Integer:
                return(ReadInteger(false));

            case RedisReplyType.MultiBulk:
                return(ReadMultiBulk(false));

            case RedisReplyType.Status:
                return(ReadStatus(false));
            }
            throw new RedisProtocolException("意外的回复类型: " + type);
        }