コード例 #1
0
 public override int GetObjectEncodeSize(object value, bool arrayEncoding)
 {
     if (!arrayEncoding)
     {
         return(ListEncoding.GetEncodeSize((IList)value));
     }
     return(8 + ListEncoding.GetValueSize((IList)value));
 }
コード例 #2
0
        public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer)
        {
            if (!arrayEncoding)
            {
                ListEncoding.Encode((IList)value, buffer);
                return;
            }
            IList lists     = (IList)value;
            int   valueSize = 4 + ListEncoding.GetValueSize(lists);

            ListEncoding.Encode(lists, 4, valueSize, buffer);
        }
コード例 #3
0
        public static int GetEncodeSize(IList value)
        {
            if (value == null)
            {
                return(1);
            }
            if (value.Count == 0)
            {
                return(1);
            }
            int valueSize = ListEncoding.GetValueSize(value);
            int encodeWidthByCountAndSize = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize);

            return(1 + encodeWidthByCountAndSize * 2 + valueSize);
        }
コード例 #4
0
ファイル: ListEncoding.cs プロジェクト: tralivali1234/IL2JS
 public static int GetEncodeSize(IList value)
 {
     if (value == null)
     {
         return(FixedWidth.NullEncoded);
     }
     else if (value.Count == 0)
     {
         return(FixedWidth.FormatCode);
     }
     else
     {
         int valueSize = ListEncoding.GetValueSize(value);
         int width     = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize);
         return(FixedWidth.FormatCode + width * 2 + valueSize);
     }
 }
コード例 #5
0
        public static void Encode(IList value, ByteBuffer buffer)
        {
            if (value == null)
            {
                AmqpEncoding.EncodeNull(buffer);
                return;
            }
            if (value.Count == 0)
            {
                AmqpBitConverter.WriteUByte(buffer, 69);
                return;
            }
            int valueSize = ListEncoding.GetValueSize(value);
            int encodeWidthByCountAndSize = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize);

            AmqpBitConverter.WriteUByte(buffer, (byte)((encodeWidthByCountAndSize == 1 ? 192 : 208)));
            ListEncoding.Encode(value, encodeWidthByCountAndSize, encodeWidthByCountAndSize + valueSize, buffer);
        }
コード例 #6
0
ファイル: ListEncoding.cs プロジェクト: tralivali1234/IL2JS
        public static void Encode(IList value, ByteBuffer buffer)
        {
            if (value == null)
            {
                AmqpEncoding.EncodeNull(buffer);
            }
            else if (value.Count == 0)
            {
                AmqpBitConverter.WriteUByte(buffer, (byte)FormatCode.List0);
            }
            else
            {
                int valueSize = ListEncoding.GetValueSize(value);
                int width     = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize);
                AmqpBitConverter.WriteUByte(buffer, width == FixedWidth.UByte ? (byte)FormatCode.List8 : (byte)FormatCode.List32);

                int size = width + valueSize;
                ListEncoding.Encode(value, width, size, buffer);
            }
        }