public override int GetObjectEncodeSize(object value, bool arrayEncoding)
 {
     if (arrayEncoding)
     {
         return(16);
     }
     return(UuidEncoding.GetEncodeSize(new Guid?((Guid)value)));
 }
 public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer)
 {
     if (arrayEncoding)
     {
         AmqpBitConverter.WriteUuid(buffer, (Guid)value);
         return;
     }
     UuidEncoding.Encode(new Guid?((Guid)value), buffer);
 }
Beispiel #3
0
 public override int GetObjectEncodeSize(object value, bool arrayEncoding)
 {
     if (arrayEncoding)
     {
         return(FixedWidth.Uuid);
     }
     else
     {
         return(UuidEncoding.GetEncodeSize((Guid)value));
     }
 }
 public override object DecodeObject(ByteBuffer buffer, Microsoft.ServiceBus.Messaging.Amqp.Encoding.FormatCode formatCode)
 {
     return(UuidEncoding.Decode(buffer, formatCode));
 }
        static AmqpEncoding()
        {
            AmqpEncoding.booleanEncoding       = new BooleanEncoding();
            AmqpEncoding.ubyteEncoding         = new UByteEncoding();
            AmqpEncoding.ushortEncoding        = new UShortEncoding();
            AmqpEncoding.uintEncoding          = new UIntEncoding();
            AmqpEncoding.ulongEncoding         = new ULongEncoding();
            AmqpEncoding.byteEncoding          = new ByteEncoding();
            AmqpEncoding.shortEncoding         = new ShortEncoding();
            AmqpEncoding.intEncoding           = new IntEncoding();
            AmqpEncoding.longEncoding          = new LongEncoding();
            AmqpEncoding.floatEncoding         = new FloatEncoding();
            AmqpEncoding.doubleEncoding        = new DoubleEncoding();
            AmqpEncoding.decimal128Encoding    = new DecimalEncoding();
            AmqpEncoding.charEncoding          = new CharEncoding();
            AmqpEncoding.timeStampEncoding     = new TimeStampEncoding();
            AmqpEncoding.uuidEncoding          = new UuidEncoding();
            AmqpEncoding.binaryEncoding        = new BinaryEncoding();
            AmqpEncoding.symbolEncoding        = new SymbolEncoding();
            AmqpEncoding.stringEncoding        = new StringEncoding();
            AmqpEncoding.listEncoding          = new ListEncoding();
            AmqpEncoding.mapEncoding           = new MapEncoding();
            AmqpEncoding.arrayEncoding         = new ArrayEncoding();
            AmqpEncoding.describedTypeEncoding = new DescribedEncoding();
            Dictionary <Type, EncodingBase> types = new Dictionary <Type, EncodingBase>()
            {
                { typeof(bool), AmqpEncoding.booleanEncoding },
                { typeof(byte), AmqpEncoding.ubyteEncoding },
                { typeof(ushort), AmqpEncoding.ushortEncoding },
                { typeof(uint), AmqpEncoding.uintEncoding },
                { typeof(ulong), AmqpEncoding.ulongEncoding },
                { typeof(sbyte), AmqpEncoding.byteEncoding },
                { typeof(short), AmqpEncoding.shortEncoding },
                { typeof(int), AmqpEncoding.intEncoding },
                { typeof(long), AmqpEncoding.longEncoding },
                { typeof(float), AmqpEncoding.floatEncoding },
                { typeof(double), AmqpEncoding.doubleEncoding },
                { typeof(decimal), AmqpEncoding.decimal128Encoding },
                { typeof(char), AmqpEncoding.charEncoding },
                { typeof(DateTime), AmqpEncoding.timeStampEncoding },
                { typeof(Guid), AmqpEncoding.uuidEncoding },
                { typeof(ArraySegment <byte>), AmqpEncoding.binaryEncoding },
                { typeof(AmqpSymbol), AmqpEncoding.symbolEncoding },
                { typeof(string), AmqpEncoding.stringEncoding },
                { typeof(AmqpMap), AmqpEncoding.mapEncoding }
            };

            AmqpEncoding.encodingsByType = types;
            Dictionary <FormatCode, EncodingBase> formatCodes = new Dictionary <FormatCode, EncodingBase>()
            {
                { 66, AmqpEncoding.booleanEncoding },
                { 65, AmqpEncoding.booleanEncoding },
                { 86, AmqpEncoding.booleanEncoding },
                { 80, AmqpEncoding.ubyteEncoding },
                { 96, AmqpEncoding.ushortEncoding },
                { 112, AmqpEncoding.uintEncoding },
                { 82, AmqpEncoding.uintEncoding },
                { 67, AmqpEncoding.uintEncoding },
                { 128, AmqpEncoding.ulongEncoding },
                { 83, AmqpEncoding.ulongEncoding },
                { 68, AmqpEncoding.ulongEncoding },
                { 81, AmqpEncoding.byteEncoding },
                { 97, AmqpEncoding.shortEncoding },
                { 113, AmqpEncoding.intEncoding },
                { 84, AmqpEncoding.intEncoding },
                { 129, AmqpEncoding.longEncoding },
                { 85, AmqpEncoding.longEncoding },
                { 114, AmqpEncoding.floatEncoding },
                { 130, AmqpEncoding.doubleEncoding },
                { 148, AmqpEncoding.decimal128Encoding },
                { 115, AmqpEncoding.charEncoding },
                { 131, AmqpEncoding.timeStampEncoding },
                { 152, AmqpEncoding.uuidEncoding },
                { 160, AmqpEncoding.binaryEncoding },
                { 176, AmqpEncoding.binaryEncoding },
                { 163, AmqpEncoding.symbolEncoding },
                { 179, AmqpEncoding.symbolEncoding },
                { 161, AmqpEncoding.stringEncoding },
                { 177, AmqpEncoding.stringEncoding },
                { 69, AmqpEncoding.listEncoding },
                { 192, AmqpEncoding.listEncoding },
                { 208, AmqpEncoding.listEncoding },
                { 193, AmqpEncoding.mapEncoding },
                { 209, AmqpEncoding.mapEncoding },
                { 224, AmqpEncoding.arrayEncoding },
                { 240, AmqpEncoding.arrayEncoding },
                { 0, AmqpEncoding.describedTypeEncoding }
            };

            AmqpEncoding.encodingsByCode = formatCodes;
        }
Beispiel #6
0
 public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode)
 {
     return(UuidEncoding.Decode(buffer, formatCode));
 }