public StringDecoder(int sizeQuota)
 {
     this.sizeQuota    = sizeQuota;
     this.sizeDecoder  = new IntDecoder();
     this.currentState = StringDecoder.State.ReadingSize;
     this.Reset();
 }
 public ServerSessionDecoder(long streamPosition, int maxViaLength, int maxContentTypeLength) : base(streamPosition)
 {
     this.viaDecoder         = new ViaStringDecoder(maxViaLength);
     this.contentTypeDecoder = new ContentTypeStringDecoder(maxContentTypeLength);
     this.sizeDecoder        = new IntDecoder();
     this.currentState       = ServerSessionDecoder.State.ReadingViaRecord;
 }
Beispiel #3
0
        public int Decode(byte[] buffer, int offset, int size)
        {
            DecoderHelper.ValidateSize(size);
            if (this.isValueDecoded)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(Microsoft.ServiceBus.SR.GetString(Resources.FramingValueNotAvailable, new object[0])));
            }
            int num = 0;

            while (num < size)
            {
                int        num1       = buffer[offset];
                IntDecoder intDecoder = this;
                intDecoder.@value = intDecoder.@value | (num1 & 127) << (this.index * 7 & 31);
                num++;
                if (this.index == 4 && (num1 & 248) != 0)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataException(Microsoft.ServiceBus.SR.GetString(Resources.FramingSizeTooLarge, new object[0])));
                }
                IntDecoder intDecoder1 = this;
                intDecoder1.index = (short)(intDecoder1.index + 1);
                if ((num1 & 128) != 0)
                {
                    offset++;
                }
                else
                {
                    this.isValueDecoded = true;
                    break;
                }
            }
            return(num);
        }
Beispiel #4
0
 public ClientDuplexDecoder(long streamPosition) : base(streamPosition)
 {
     this.sizeDecoder = new IntDecoder();
 }
 public SingletonMessageDecoder(long streamPosition) : base(streamPosition)
 {
     this.sizeDecoder  = new IntDecoder();
     this.currentState = SingletonMessageDecoder.State.ChunkStart;
 }