예제 #1
0
        T IMessagePackFormatter <T> .Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var byteArr = new ByteArrayKey(MessagePackBinary.ReadBytes(bytes, offset, out readSize));

            return((T)_byteTypeNameLookup.GetOrAdd(byteArr, b =>
            {
                var typename = TypeEx.ToQualifiedAssemblyName(MessagePackBinary.ReadString(byteArr.Bytes, 0, out _));
                _macroses.ForEach(x =>
                {
                    typename = typename.Replace(x.Value, x.Key);
                });

                var type = Type.GetType(typename, true);

                _typeByteNameLookup.TryAdd(type, b.Bytes); //add to reverse cache

                return type;
            }));
        }
예제 #2
0
        public T[] Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var startOffset = offset;
            var formatter   = formatterResolver.GetFormatterWithVerify <T>();

            var len = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);

            offset += readSize;
            var array = new T[len];

            for (var i = 0; i < array.Length; i++)
            {
                array[i] = formatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                offset  += readSize;
            }

            readSize = offset - startOffset;
            return(array);
        }
예제 #3
0
 public ArraySegment <byte> Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver,
                                        out int readSize)
 {
     if (MessagePackBinary.IsNil(bytes, offset))
     {
         readSize = 1;
         return(default);
예제 #4
0
        public T Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var formatter   = formatterResolver.GetFormatterWithVerify <object>();
            var startOffset = offset;

            var count = MessagePackBinary.ReadMapHeader(bytes, offset, out readSize);

            offset += readSize;

            var dict = CollectionHelpers <T, IEqualityComparer> .CreateHashCollection(count, MessagePackSecurity.Active.GetEqualityComparer());

            using (MessagePackSecurity.DepthStep())
            {
                for (int i = 0; i < count; i++)
                {
                    var key = formatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                    offset += readSize;
                    var value = formatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                    offset += readSize;
                    dict.Add(key, value);
                }
            }

            readSize = offset - startOffset;
            return(dict);
        }
예제 #5
0
        public Tuple <T1> Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }
            else
            {
                var startOffset = offset;
                var count       = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                if (count != 1)
                {
                    throw new InvalidOperationException("Invalid Tuple count");
                }
                offset += readSize;
                using (MessagePackSecurity.DepthStep())
                {
                    var item1 = formatterResolver.GetFormatterWithVerify <T1>().Deserialize(bytes, offset, formatterResolver, out readSize);
                    offset += readSize;

                    readSize = offset - startOffset;
                    return(new Tuple <T1>(item1));
                }
            }
        }
        public IList Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(default(IList));
            }

            var formatter   = formatterResolver.GetFormatterWithVerify <object>();
            var startOffset = offset;

            var count = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);

            offset += readSize;

            var list = new object[count];

            for (int i = 0; i < count; i++)
            {
                list[i] = formatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;
            }

            readSize = offset - startOffset;
            return(list);
        }
        public TDictionary Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(default(TDictionary));
            }
            else
            {
                var startOffset    = offset;
                var keyFormatter   = formatterResolver.GetFormatterWithVerify <TKey>();
                var valueFormatter = formatterResolver.GetFormatterWithVerify <TValue>();

                var len = MessagePackBinary.ReadMapHeader(bytes, offset, out readSize);
                offset += readSize;

                var dict = Create(len);
                for (int i = 0; i < len; i++)
                {
                    var key = keyFormatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                    offset += readSize;

                    var value = valueFormatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                    offset += readSize;

                    Add(dict, i, key, value);
                }
                readSize = offset - startOffset;

                return(Complete(dict));
            }
        }
예제 #8
0
        public ValueTuple <T1, T2> Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                throw new InvalidOperationException("Data is Nil, ValueTuple can not be null.");
            }
            else
            {
                var startOffset = offset;
                var count       = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                if (count != 2)
                {
                    throw new InvalidOperationException("Invalid ValueTuple count");
                }
                offset += readSize;

                var item1 = formatterResolver.GetFormatterWithVerify <T1>().Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;
                var item2 = formatterResolver.GetFormatterWithVerify <T2>().Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;

                readSize = offset - startOffset;
                return(new ValueTuple <T1, T2>(item1, item2));
            }
        }
예제 #9
0
        public ForwardDefinitionList Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var definitionList = new ForwardDefinitionList();

            var startOffset   = offset;
            var elementsCount = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);

            offset += readSize;

            // read declarations
            for (int i = 0; i < elementsCount; i++)
            {
                var guidObject = GuidObjectFormatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                definitionList.Add(guidObject);
                offset += readSize;
            }

            readSize = offset - startOffset;

            return(definitionList);
        }
예제 #10
0
        public Bgra32Image Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var startOffset = offset;

            var arrayCount = MessagePackBinary.ReadArrayHeaderRaw(bytes, offset, out var rs);

            offset += rs;

            if (arrayCount != 3)
            {
                throw new InvalidDataException();
            }

            var width = MessagePackBinary.ReadInt32(bytes, offset, out rs);

            offset += rs;

            var height = MessagePackBinary.ReadInt32(bytes, offset, out rs);

            offset += rs;

            var data = MessagePackBinary.ReadBytesSegment(bytes, offset, out rs);

            offset += rs;

            readSize = offset - startOffset;
            return(new Bgra32ImageFromMessagePack(width, height, data));
        }
예제 #11
0
        public ReactiveProperty <T> Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }
            else
            {
                var startOffset = offset;

                var length = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                offset += readSize;
                if (length != 3)
                {
                    throw new InvalidOperationException("Invalid ReactiveProperty data.");
                }

                var mode = (ReactivePropertyMode)MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                offset += readSize;

                var schedulerId = MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                offset += readSize;

                var scheduler = ReactivePropertySchedulerMapper.GetScheduler(schedulerId);

                var v = formatterResolver.GetFormatterWithVerify <T>().Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;

                readSize = offset - startOffset;

                return(new ReactiveProperty <T>(scheduler, v, mode));
            }
        }
예제 #12
0
        public DateTime[] Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var startOffset = offset;

            var len = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);

            offset += readSize;
            var array = new DateTime[len];

            for (var i = 0; i < array.Length; i++)
            {
                var dateData = MessagePackBinary.ReadInt64(bytes, offset, out readSize);
                array[i] = DateTime.FromBinary(dateData);
                offset  += readSize;
            }

            readSize = offset - startOffset;
            return(array);
        }
        public IGrouping <TKey, TElement> Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }
            else
            {
                var startOffset = offset;
                var count       = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                offset += readSize;

                if (count != 2)
                {
                    throw new InvalidOperationException("Invalid Grouping format.");
                }

                var key = formatterResolver.GetFormatterWithVerify <TKey>().Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;

                var value = formatterResolver.GetFormatterWithVerify <IEnumerable <TElement> >().Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;

                readSize = offset - startOffset;
                return(new Grouping <TKey, TElement>(key, value));
            }
        }
            public BitArray Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver,
                                        out int readSize)
            {
                if (MessagePackBinary.IsNil(bytes, offset))
                {
                    readSize = 1;
                    return(null);
                }
                else
                {
                    var startOffset = offset;

                    var len = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                    offset += readSize;

                    var array = new BitArray(len);
                    for (int i = 0; i < len; i++)
                    {
                        array[i] = MessagePackBinary.ReadBoolean(bytes, offset, out readSize);
                        offset  += readSize;
                    }

                    readSize = offset - startOffset;
                    return(array);
                }
            }
        public TCollection Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(default(TCollection));
            }
            else
            {
                var startOffset = offset;
                var formatter   = formatterResolver.GetFormatterWithVerify <TElement>();

                var len = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                offset += readSize;

                var list = Create(len);
                for (int i = 0; i < len; i++)
                {
                    Add(list, i, formatter.Deserialize(bytes, offset, formatterResolver, out readSize));
                    offset += readSize;
                }
                readSize = offset - startOffset;

                return(Complete(list));
            }
        }
예제 #16
0
        public List <T> Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }
            else
            {
                var startOffset = offset;
                var formatter   = formatterResolver.GetFormatterWithVerify <T>();

                var len = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                offset += readSize;
                var list = new List <T>(len);
                using (MessagePackSecurity.DepthStep())
                {
                    for (int i = 0; i < len; i++)
                    {
                        list.Add(formatter.Deserialize(bytes, offset, formatterResolver, out readSize));
                        offset += readSize;
                    }
                }

                readSize = offset - startOffset;
                return(list);
            }
        }
        public IDictionary Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var formatter   = formatterResolver.GetFormatterWithVerify <object>();
            var startOffset = offset;

            var count = MessagePackBinary.ReadMapHeader(bytes, offset, out readSize);

            offset += readSize;

            var dict = new Dictionary <object, object>(count);

            for (int i = 0; i < count; i++)
            {
                var key = formatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;
                var value = formatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                offset += readSize;
                dict.Add(key, value);
            }

            readSize = offset - startOffset;
            return(dict);
        }
예제 #18
0
        public T Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(default(T));
            }

            var formatter   = formatterResolver.GetFormatterWithVerify <object>();
            var startOffset = offset;

            var count = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);

            offset += readSize;

            var list = new T();

            using (MessagePackSecurity.DepthStep())
            {
                for (int i = 0; i < count; i++)
                {
                    list.Add(formatter.Deserialize(bytes, offset, formatterResolver, out readSize));
                    offset += readSize;
                }
            }

            readSize = offset - startOffset;
            return(list);
        }
        public object Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            int startOffset = offset;
            var packType    = MessagePackBinary.GetMessagePackType(bytes, offset);

            if (packType == MessagePackType.Extension)
            {
                var ext = MessagePackBinary.ReadExtensionFormatHeader(bytes, offset, out readSize);
                if (ext.TypeCode == TypelessFormatter.ExtensionTypeCode)
                {
                    // it has type name serialized
                    offset += readSize;
                    var typeName = MessagePackBinary.ReadStringSegment(bytes, offset, out readSize);
                    offset += readSize;
                    var result = DeserializeByTypeName(typeName, bytes, offset, formatterResolver, out readSize);
                    offset  += readSize;
                    readSize = offset - startOffset;
                    return(result);
                }
            }

            // fallback
            return(Resolvers.TypelessFormatterFallbackResolver.Instance.GetFormatter <object>().Deserialize(bytes, startOffset, formatterResolver, out readSize));
        }
예제 #20
0
        public ImmutableArray <T> Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(ImmutableArray <T> .Empty);
            }
            else
            {
                var startOffset = offset;
                var formatter   = formatterResolver.GetFormatterWithVerify <T>();

                var len = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                offset += readSize;

                var builder = ImmutableArray.CreateBuilder <T>(len);
                for (int i = 0; i < len; i++)
                {
                    builder.Add(formatter.Deserialize(bytes, offset, formatterResolver, out readSize));
                    offset += readSize;
                }
                readSize = offset - startOffset;

                return(builder.ToImmutable());
            }
        }
예제 #21
0
        public T Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var startOffset   = offset;
            var elementsCount = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);

            offset += readSize;

            object instance;

            if (MessagePackBinary.IsNil(bytes, offset))
            {
                // reference:
                MessagePackBinary.ReadNil(bytes, offset, out readSize);
                offset += readSize;
                var reference = MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                offset += readSize;

                instance = Serializer.Instance.State.GetInstance(reference);
            }
            else
            {
                // full deserialization:
                var meta = DarkMeta <T> .Value;
                if (!meta.Flags.IsStatic())
                {
                    var typeIndex = (TypeIndex)MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                    offset += readSize;
                    if (typeIndex != meta.TypeIndex)
                    {
                        meta = DarkMeta.Get(typeIndex);
                        if (meta == null)
                        {
                            Logger.Instance.Warning(String.Format("Can't find typeIndex {0}", typeIndex));
                            for (int i = 0; i < elementsCount - 1; i++)
                            {
                                offset += MessagePackBinary.ReadNextBlock(bytes, offset);
                            }
                            readSize = offset - startOffset;
                            return(null);
                        }
                    }
                }

                instance = DeserializeBody(meta.Type, elementsCount - 1, bytes, offset, formatterResolver, out readSize);

                offset += readSize;
                meta.OnDeserialized(instance);
            }

            readSize = offset - startOffset;

            return(instance as T);
        }
예제 #22
0
        /// <inheritdoc />
        public Recording Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            int startOffset = offset;

            int count = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);

            offset += readSize;
            // NOTE: We can use this to distinguish between future versions of a Recording.
            if (count != 6)
            {
                throw new InvalidOperationException("Request format invalid.");
            }

            string hash = MessagePackBinary.ReadString(bytes, offset, out readSize);

            offset += readSize;

            string keyGeneratorName = MessagePackBinary.ReadString(bytes, offset, out readSize);

            offset += readSize;

            DateTime recordedUtc = MessagePackBinary.ReadDateTime(bytes, offset, out readSize);

            offset += readSize;

            int durationMs = MessagePackBinary.ReadInt32(bytes, offset, out readSize);

            offset += readSize;

            byte[] responseData = MessagePackBinary.ReadBytes(bytes, offset, out readSize);
            offset += readSize;

            byte[] requestData;
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                requestData = null;
                offset++;
            }
            else
            {
                requestData = MessagePackBinary.ReadBytes(bytes, offset, out readSize);
                offset     += readSize;
            }
            readSize = offset - startOffset;

            return(new Recording(
                       hash,
                       keyGeneratorName,
                       recordedUtc,
                       durationMs,
                       responseData,
                       requestData));
        }
 public Task Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
 {
     if (!MessagePackBinary.IsNil(bytes, offset))
     {
         ThrowHelper.ThrowInvalidOperationException_Input();
     }
     readSize = 1;
     return(CompletedTask);
 }
예제 #24
0
        FieldList IMessagePackFormatter <FieldList> .Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            var startOffset   = offset;
            var elementsCount = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize) / 3;

            offset += readSize;

            var list = new FieldList(elementsCount);

            var state = Serializer.Instance.State;

            if (state.Settings.Flags.HasFlag(SerializationFlags.KeepOriginalBytes))
            {
                list.OriginalBytes = new List <FieldBytes>();
            }

            var previousOffset = state.LocalOffset;

            for (int i = 0; i < elementsCount; i++)
            {
                state.StartLocalGroup();

                var typeId = MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                offset += readSize;

                var memberId = MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                offset += readSize;

                if (typeId >= 0)
                {
                    // normal
                    var fieldKey = new FieldKey((TypeIndex)typeId, memberId);
                    list[fieldKey] = FieldMeta.Get(fieldKey).Deserialize(bytes, offset, formatterResolver, out readSize);
                    list.OriginalBytes?.Add(new FieldBytes(fieldKey, offset, readSize));
                    offset += readSize;
                }
                else
                {
                    // ValueProducer
                    var fieldKey = new FieldKey((TypeIndex)(-typeId), memberId);
                    list[fieldKey] = formatterResolver.GetFormatter <ValueProducer>().Deserialize(bytes, offset, formatterResolver, out readSize);
                    list.OriginalBytes?.Add(new FieldBytes(fieldKey, offset, readSize));
                    offset += readSize;
                }
            }
            state.RestoreLocalGroup(previousOffset);

            readSize = offset - startOffset;

            return(list);
        }
예제 #25
0
        public bool?Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            return(MessagePackBinary.ReadBoolean(bytes, offset, out readSize));
        }
예제 #26
0
        public T?Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            return(underlyingFormatter.Deserialize(bytes, offset, formatterResolver, out readSize));
        }
예제 #27
0
        public Uri Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            return(new Uri(MessagePackBinary.ReadString(bytes, offset, out readSize), UriKind.RelativeOrAbsolute));
        }
예제 #28
0
        public Version Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            return(new Version(MessagePackBinary.ReadString(bytes, offset, out readSize)));
        }
예제 #29
0
        public T[,] Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }
            else
            {
                var startOffset = offset;
                var formatter   = formatterResolver.GetFormatterWithVerify <T>();

                var len = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                offset += readSize;
                if (len != ArrayLength)
                {
                    throw new InvalidOperationException("Invalid T[,] format");
                }

                var iLength = MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                offset += readSize;

                var jLength = MessagePackBinary.ReadInt32(bytes, offset, out readSize);
                offset += readSize;

                var maxLen = MessagePackBinary.ReadArrayHeader(bytes, offset, out readSize);
                offset += readSize;

                var array = new T[iLength, jLength];

                var i = 0;
                var j = -1;
                using (MessagePackSecurity.DepthStep())
                {
                    for (int loop = 0; loop < maxLen; loop++)
                    {
                        if (j < jLength - 1)
                        {
                            j++;
                        }
                        else
                        {
                            j = 0;
                            i++;
                        }

                        array[i, j] = formatter.Deserialize(bytes, offset, formatterResolver, out readSize);
                        offset     += readSize;
                    }
                }

                readSize = offset - startOffset;
                return(array);
            }
        }
예제 #30
0
        public T?Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
        {
            if (MessagePackBinary.IsNil(bytes, offset))
            {
                readSize = 1;
                return(null);
            }

            return(formatterResolver.GetFormatterWithVerify <T>()
                   .Deserialize(bytes, offset, formatterResolver, out readSize));
        }