Exemplo n.º 1
0
        public object CreateInstance(ProtoReader source, bool includeLocalCallback)
        {
            //Helpers.DebugWriteLine("* creating : " + forType.FullName);
            object obj;

            if (_factory != null)
            {
                obj = InvokeCallback(_factory, null, _constructType, source.Context);
            }
            else if (_useConstructor && _hasConstructor)
            {
                obj = Activator.CreateInstance(_constructType
#if !CF && !SILVERLIGHT && !WINRT && !PORTABLE
                                               , true
#endif
                                               );
            }
            else
            {
                obj = BclHelpers.GetUninitializedObject(_constructType);
            }
            ProtoReader.NoteObject(obj, source);
            if (_baseCtorCallbacks != null)
            {
                for (int i = 0; i < _baseCtorCallbacks.Length; i++)
                {
                    InvokeCallback(_baseCtorCallbacks[i], obj, _constructType, source.Context);
                }
            }
            if (includeLocalCallback && _callbacks != null)
            {
                InvokeCallback(_callbacks.BeforeDeserialize, obj, _constructType, source.Context);
            }
            return(obj);
        }
Exemplo n.º 2
0
        object CreateUnknownInstance(ProtoReader source, bool includeLocalCallback)
        {
            object obj;

#if PROFILE259
            ConstructorInfo constructorInfo = System.Linq.Enumerable.First(
                unknownConstructType.GetTypeInfo().DeclaredConstructors, c => c.GetParameters().Length == 0);
            obj = constructorInfo.Invoke(new object[] {});
#else
            obj = Activator.CreateInstance(unknownConstructType
#if !(CF || PORTABLE || NETSTANDARD1_3 || NETSTANDARD1_4 || UAP)
                                           , nonPublic: true
#endif
                                           );
#endif
            ProtoReader.NoteObject(obj, source);
            if (baseCtorCallbacks != null)
            {
                for (int i = 0; i < baseCtorCallbacks.Length; i++)
                {
                    InvokeCallback(baseCtorCallbacks[i], obj, source.Context);
                }
            }
            if (includeLocalCallback && callbacks != null)
            {
                InvokeCallback(callbacks.BeforeDeserialize, obj, source.Context);
            }
            return(obj);
        }
Exemplo n.º 3
0
        private object CreateInstance(ProtoReader source, bool includeLocalCallback)
        {
            //Helpers.DebugWriteLine("* creating : " + forType.FullName);
            object obj;

            if (factory != null)
            {
                obj = InvokeCallback(factory, null, source.Context);
            }
            else if (useConstructor)
            {
                if (!hasConstructor)
                {
                    TypeModel.ThrowCannotCreateInstance(constructType);
                }
                obj = Activator.CreateInstance(constructType, nonPublic: true);
            }
            else
            {
                obj = BclHelpers.GetUninitializedObject(constructType);
            }
            ProtoReader.NoteObject(obj, source);
            if (baseCtorCallbacks != null)
            {
                for (int i = 0; i < baseCtorCallbacks.Length; i++)
                {
                    InvokeCallback(baseCtorCallbacks[i], obj, source.Context);
                }
            }
            if (includeLocalCallback && callbacks != null)
            {
                InvokeCallback(callbacks.BeforeDeserialize, obj, source.Context);
            }
            return(obj);
        }
Exemplo n.º 4
0
        public object CreateInstance(ProtoReader source)
        {
            Array r = Array.CreateInstance(_itemType, 0);

            ProtoReader.NoteObject(r, source);
            return(r);
        }
Exemplo n.º 5
0
        public virtual object CreateInstance(ProtoReader source)
        {
            var r = Activator.CreateInstance(_concreteTypeDefault);

            ProtoReader.NoteObject(r, source);
            return(r);
        }
Exemplo n.º 6
0
        // Token: 0x0600029E RID: 670 RVA: 0x0000FC80 File Offset: 0x0000DE80
        private object CreateInstance(ProtoReader source, bool includeLocalCallback)
        {
            object obj;

            if (this.factory != null)
            {
                obj = this.InvokeCallback(this.factory, null, source.Context);
            }
            else if (this.useConstructor)
            {
                if (!this.hasConstructor)
                {
                    TypeModel.ThrowCannotCreateInstance(this.constructType);
                }
                obj = Activator.CreateInstance(this.constructType, true);
            }
            else
            {
                obj = BclHelpers.GetUninitializedObject(this.constructType);
            }
            ProtoReader.NoteObject(obj, source);
            if (this.baseCtorCallbacks != null)
            {
                for (int i = 0; i < this.baseCtorCallbacks.Length; i++)
                {
                    this.InvokeCallback(this.baseCtorCallbacks[i], obj, source.Context);
                }
            }
            if (includeLocalCallback && this.callbacks != null)
            {
                this.InvokeCallback(this.callbacks.BeforeDeserialize, obj, source.Context);
            }
            return(obj);
        }
Exemplo n.º 7
0
        object CreateInstance(ProtoReader source)
        {
            //Helpers.DebugWriteLine("* creating : " + forType.FullName);
            object obj;

            if (useConstructor)
            {
                if (!hasConstructor)
                {
                    TypeModel.ThrowCannotCreateInstance(constructType);
                }
                obj = Activator.CreateInstance(constructType
#if !CF && !SILVERLIGHT
                                               , true
#endif
                                               );
            }
            else
            {
                obj = BclHelpers.GetUninitializedObject(constructType);
            }
            ProtoReader.NoteObject(obj, source);
            if (baseCtorCallbacks != null)
            {
                for (int i = 0; i < baseCtorCallbacks.Length; i++)
                {
                    InvokeCallback(baseCtorCallbacks[i], obj, source.Context);
                }
            }
            if (callbacks != null)
            {
                InvokeCallback(callbacks.BeforeDeserialize, obj, source.Context);
            }
            return(obj);
        }
Exemplo n.º 8
0
        public object Read(object value, ProtoReader source)
        {
            Helpers.DebugAssert(value == null); // since replaces
            var v = _parse.Invoke(null, new object[] { source.ReadString() });

            ProtoReader.NoteObject(v, source);
            return(v);
        }
Exemplo n.º 9
0
        public override object CreateInstance(ProtoReader source)
        {
            object builderInstance = _builderFactory.Invoke(null, null);
            var    r = _finish.Invoke(builderInstance, null);

            ProtoReader.NoteObject(r, source);
            return(r);
        }
Exemplo n.º 10
0
        private static ActiveCodeReq Read(ActiveCodeReq acReq, ProtoReader protoReader)
        {
            int fieldNum;

            while ((fieldNum = protoReader.ReadFieldHeader()) > 0)
            {
                if (fieldNum != 1)
                {
                    if (fieldNum != 2)
                    {
                        if (acReq == null)
                        {
                            ActiveCodeReq activeCodeReq = new ActiveCodeReq();
                            ProtoReader.NoteObject(activeCodeReq, protoReader);
                            acReq = activeCodeReq;
                        }

                        protoReader.AppendExtensionData(acReq);
                    }
                    else
                    {
                        if (acReq == null)
                        {
                            ActiveCodeReq activeCodeReq = new ActiveCodeReq();
                            ProtoReader.NoteObject(activeCodeReq, protoReader);
                            acReq = activeCodeReq;
                        }

                        string activeCode = protoReader.ReadString();
                        if (activeCode != null)
                        {
                            acReq.ActiveCode = activeCode;
                        }
                    }
                }
                else
                {
                    if (acReq == null)
                    {
                        ActiveCodeReq activeCodeReq = new ActiveCodeReq();
                        ProtoReader.NoteObject(activeCodeReq, protoReader);
                        acReq = activeCodeReq;
                    }

                    long accountId = protoReader.ReadInt64();
                    acReq.AccountId = accountId;
                }
            }

            if (acReq == null)
            {
                ActiveCodeReq activeCodeReq = new ActiveCodeReq();
                ProtoReader.NoteObject(activeCodeReq, protoReader);
                acReq = activeCodeReq;
            }

            return(acReq);
        }
Exemplo n.º 11
0
        public object Read(object value, ProtoReader source)
        {
            var result = ProtoReader.AppendBytes(_overwriteList ? null : (byte[])value, source);

            if (_overwriteList || value == null)
            {
                ProtoReader.NoteObject(result, source);
            }
            return(result);
        }
Exemplo n.º 12
0
        object CreateInstance(ProtoReader source, bool includeLocalCallback)
        {
            //Helpers.DebugWriteLine("* creating : " + forType.FullName);
            object obj = null;

            if (model.netDataPoolDelegate != null)
            {
                // ========================================================
                // added by wsh @ 2017-07-01 for net data pool
                obj = model.netDataPoolDelegate(constructType);
                // ========================================================
            }
            if (obj == null)
            {
                if (factory != null)
                {
                    obj = InvokeCallback(factory, null, source.Context);
                }
                else if (useConstructor)
                {
                    if (!hasConstructor)
                    {
                        TypeModel.ThrowCannotCreateInstance(constructType);
                    }
                    obj = Activator.CreateInstance(constructType
#if !CF && !SILVERLIGHT && !WINRT && !PORTABLE
                                                   , true
#endif
                                                   );
                }
                else
                {
                    obj = BclHelpers.GetUninitializedObject(constructType);
                }
            }
            ProtoReader.NoteObject(obj, source);
            if (baseCtorCallbacks != null)
            {
                for (int i = 0; i < baseCtorCallbacks.Length; i++)
                {
                    InvokeCallback(baseCtorCallbacks[i], obj, source.Context);
                }
            }
            if (includeLocalCallback && callbacks != null)
            {
                InvokeCallback(callbacks.BeforeDeserialize, obj, source.Context);
            }
            return(obj);
        }
Exemplo n.º 13
0
        object CreateInstance(ProtoReader source, bool includeLocalCallback)
        {
            //Helpers.DebugWriteLine("* creating : " + forType.FullName);
            object obj;

            if (factory != null)
            {
                obj = InvokeCallback(factory, null, source.Context);
            }
            else if (useConstructor)
            {
                if (!hasConstructor)
                {
                    TypeModel.ThrowCannotCreateInstance(constructType);
                }
#if PROFILE259
                ConstructorInfo constructorInfo = System.Linq.Enumerable.First(
                    constructType.GetTypeInfo().DeclaredConstructors, c => c.GetParameters().Length == 0);
                obj = constructorInfo.Invoke(new object[] {});
#else
                obj = Activator.CreateInstance(constructType
#if !(CF || SILVERLIGHT || WINRT || PORTABLE || NETSTANDARD1_3 || NETSTANDARD1_4)
                                               , nonPublic: true
#endif
                                               );
#endif
            }
            else
            {
                obj = BclHelpers.GetUninitializedObject(constructType);
            }
            ProtoReader.NoteObject(obj, source);
            if (baseCtorCallbacks != null)
            {
                for (int i = 0; i < baseCtorCallbacks.Length; i++)
                {
                    InvokeCallback(baseCtorCallbacks[i], obj, source.Context);
                }
            }
            if (includeLocalCallback && callbacks != null)
            {
                InvokeCallback(callbacks.BeforeDeserialize, obj, source.Context);
            }
            return(obj);
        }
Exemplo n.º 14
0
        /// <summary>
        /// The read.
        /// </summary>
        /// <param name="mxPayload">
        /// The mx payload.
        /// </param>
        /// <param name="protoReader">
        /// The proto reader.
        /// </param>
        /// <returns>
        /// The <see cref="MxPayload"/>.
        /// </returns>
        private static MxPayload Read(MxPayload mxPayload, ProtoReader protoReader)
        {
            int num;

            while ((num = protoReader.ReadFieldHeader()) > 0)
            {
                if (num != 1)
                {
                    if (mxPayload == null)
                    {
                        var expr_49 = new MxPayload();
                        ProtoReader.NoteObject(expr_49, protoReader);
                        mxPayload = expr_49;
                    }

                    protoReader.SkipField();
                }
                else
                {
                    if (mxPayload == null)
                    {
                        var expr_19 = new MxPayload();
                        ProtoReader.NoteObject(expr_19, protoReader);
                        mxPayload = expr_19;
                    }

                    byte[] array = ProtoReader.AppendBytes(mxPayload.Data, protoReader);
                    if (array != null)
                    {
                        mxPayload.Data = array;
                    }
                }
            }

            if (mxPayload == null)
            {
                var expr_71 = new MxPayload();
                ProtoReader.NoteObject(expr_71, protoReader);
                mxPayload = expr_71;
            }

            return(mxPayload);
        }
Exemplo n.º 15
0
        Array Read_CreateInstance(object value, int appendCount, int reservedTrap, out int oldLen, ProtoReader source)
        {
            oldLen = AppendToCollection ? (((Array)value)?.Length ?? 0) : 0;
            Array result = Array.CreateInstance(_itemType, oldLen + appendCount);

            if (reservedTrap >= 0)
            {
                ProtoReader.NoteReservedTrappedObject(reservedTrap, result, source);
            }
            else
            {
                ProtoReader.NoteObject(result, source);
            }
            if (oldLen != 0)
            {
                ((Array)value).CopyTo(result, 0);
            }
            return(result);
        }
Exemplo n.º 16
0
        object CreateInstance(ProtoReader source, bool includeLocalCallback)
        {
            //Helpers.DebugWriteLine("* creating : " + forType.FullName);
            object obj;

            if (factory != null)
            {
                obj = InvokeCallback(factory, null, source.Context);
            }
            else if (useConstructor)
            {
                if (!hasConstructor)
                {
                    TypeModel.ThrowCannotCreateInstance(constructType);
                }
                // ## 苦竹 修改 ##
                //        obj = Activator.CreateInstance(constructType
                //#if !(CF || SILVERLIGHT || WINRT || PORTABLE || NETSTANDARD1_3 || NETSTANDARD1_4)
                //                    , nonPublic: true
                //#endif
                //                    );
                obj = ActivatorUtils.FastCreateInstance(constructType);
            }
            else
            {
                obj = BclHelpers.GetUninitializedObject(constructType);
            }
            ProtoReader.NoteObject(obj, source);
            if (baseCtorCallbacks != null)
            {
                for (int i = 0; i < baseCtorCallbacks.Length; i++)
                {
                    InvokeCallback(baseCtorCallbacks[i], obj, source.Context);
                }
            }
            if (includeLocalCallback && callbacks != null)
            {
                InvokeCallback(callbacks.BeforeDeserialize, obj, source.Context);
            }
            return(obj);
        }
        public object Read(object value, ProtoReader source)
        {
            // TODO what may happen if old value is already existing reference? do we need to consider it?
            var v = _subTypeHelpers.TryRead(_model[_typeKey], value?.GetType(), source);

            if (v != null)
            {
                value = v.Serializer.CreateInstance(source);
            }
            else if (value != null)
            {
                ProtoReader.NoteObject(value, source);
            }
            else
            {
                throw new ProtoException(CantCreateInstanceMessage);
            }
            // each CreateInstance notes object
            ProtoReader.NoteLateReference(_baseTypeKey, value, source);
            return(value);
        }
        Array Read_CreateInstance(object value, int[] lengths, out int oldFirstDimLength, ProtoReader source)
        {
            var valueArr = AppendToCollection ? value as Array : null;

            if (valueArr != null)
            {
                lengths[0] += oldFirstDimLength = valueArr.GetLength(0);
            }
            else
            {
                oldFirstDimLength = 0;
            }

            Array result = Array.CreateInstance(_itemType, lengths);

            ProtoReader.NoteObject(result, source);

            if (oldFirstDimLength > 0)
            {
                Array.Copy(valueArr, result, valueArr.Length);
            }

            return(result);
        }
Exemplo n.º 19
0
        public override object Read(object value, ProtoReader source)
        {
            IList list = null;

            object[] args       = null;
            bool     createdNew = false;
            bool     asList     = IsList && !SuppressIList;

            // can't call clear? => create new!
            bool forceNewInstance = !AppendToCollection && !asList;

            ListHelpers.Read(
                () =>
            {
                if (_metaType != null && source.TryReadFieldHeader(ListHelpers.FieldSubtype))
                {
                    MetaType mt = _subTypeHelpers.TryRead(_metaType, forceNewInstance ? null : value?.GetType(), source);
                    if (mt != null)
                    {
                        value      = mt.Serializer.CreateInstance(source);
                        createdNew = true;
                    }
                    return(true);
                }
                return(false);
            },
                () =>
            {
                if (value == null || (forceNewInstance && !createdNew))
                {
                    createdNew = true;
                    value      = Activator.CreateInstance(_concreteTypeDefault);
                    ProtoReader.NoteObject(value, source);
                    if (asList)
                    {
                        list = (IList)value;
                        Debug.Assert(list != null);
                    }
                }
                else
                {
                    if (!createdNew)
                    {
                        ProtoReader.NoteObject(value, source);
                    }

                    if (asList)
                    {
                        list = (IList)value;
                        Debug.Assert(list != null);
                        if (!AppendToCollection && !createdNew)
                        {
                            list.Clear();
                        }
                    }
                }

                if (!asList)
                {
                    args = new object[1];
                }
            },
                v =>
            {
                if (asList)
                {
                    list.Add(v);
                }
                else
                {
                    args[0] = v;
                    this._add.Invoke(value, args);
                }
            },
                source);

            return(value);
        }
Exemplo n.º 20
0
        private bool TryDeserializeList(TypeModel model, ProtoReader reader, BinaryDataFormat format, int tag, Type listType, Type itemType, bool isRoot, ref object value)
        {
            bool       isList;
            MethodInfo addMethod = TypeModel.ResolveListAdd(model, listType, itemType, out isList);

            if (addMethod == null)
            {
                throw new NotSupportedException("Unknown list variant: " + listType.FullName);
            }
            bool   found    = false;
            object nextItem = null;
            IList  list     = value as IList;

            object[]  args           = isList ? null : new object[1];
            BasicList arraySurrogate = listType.IsArray ? new BasicList() : null;

            while (TryDeserializeAuxiliaryType(reader, format, tag, itemType, ref nextItem, true, true, true, true, isRoot))
            {
                found = true;
                if (value == null && arraySurrogate == null)
                {
                    value = CreateListInstance(listType, itemType);
                    if (value != null)
                    {
                        ProtoReader.NoteObject(value, reader);
                    }
                    list = value as IList;
                }
                if (list != null)
                {
                    list.Add(nextItem);
                }
                else if (arraySurrogate != null)
                {
                    arraySurrogate.Add(nextItem);
                }
                else
                {
                    args[0] = nextItem;
                    addMethod.Invoke(value, args);
                }
                nextItem = null;
            }
            if (arraySurrogate != null)
            {
                Array newArray;
                if (value != null)
                {
                    if (arraySurrogate.Count == 0)
                    {   // we'll stay with what we had, thanks
                    }
                    else
                    {
                        Array existing = (Array)value;
                        newArray = Array.CreateInstance(itemType, existing.Length + arraySurrogate.Count);
                        Array.Copy(existing, newArray, existing.Length);
                        arraySurrogate.CopyTo(newArray, existing.Length);
                        value = newArray;
                    }
                }
                else
                {
                    newArray = Array.CreateInstance(itemType, arraySurrogate.Count);
                    arraySurrogate.CopyTo(newArray, 0);
                    value = newArray;
                    ProtoReader.NoteObject(value, reader);
                }
            }
            return(found);
        }
Exemplo n.º 21
0
        /// <summary>
        /// The read.
        /// </summary>
        /// <param name="platformData">
        /// The platform data.
        /// </param>
        /// <param name="protoReader">
        /// The proto reader.
        /// </param>
        /// <returns>
        /// The <see cref="PlatformData"/>.
        /// </returns>
        private static PlatformData Read(PlatformData platformData, ProtoReader protoReader)
        {
            int num;

            while ((num = protoReader.ReadFieldHeader()) > 0)
            {
                if (num != 1)
                {
                    if (num != 2)
                    {
                        if (platformData == null)
                        {
                            var expr_164 = new PlatformData();
                            ProtoReader.NoteObject(expr_164, protoReader);
                            platformData = expr_164;
                        }

                        protoReader.SkipField();
                    }
                    else
                    {
                        if (platformData == null)
                        {
                            var expr_134 = new PlatformData();
                            ProtoReader.NoteObject(expr_134, protoReader);
                            platformData = expr_134;
                        }

                        byte[] array = ProtoReader.AppendBytes(platformData.Data, protoReader);
                        if (array != null)
                        {
                            platformData.Data = array;
                        }
                    }
                }
                else
                {
                    if (platformData == null)
                    {
                        var expr_19 = new PlatformData();
                        ProtoReader.NoteObject(expr_19, protoReader);
                        platformData = expr_19;
                    }

                    int num2           = protoReader.ReadInt32();
                    var targetPlatform = TargetPlatform.Windows;
                    if (num2 != 0)
                    {
                        if (num2 != 1)
                        {
                            if (num2 != 2)
                            {
                                if (num2 != 3)
                                {
                                    if (num2 != 4)
                                    {
                                        if (num2 != 5)
                                        {
                                            if (num2 != 6)
                                            {
                                                if (num2 != 7)
                                                {
                                                    if (num2 != 8)
                                                    {
                                                        if (num2 != 9)
                                                        {
                                                            if (num2 != 10)
                                                            {
                                                                if (num2 != 11)
                                                                {
                                                                    if (num2 != 12)
                                                                    {
                                                                        protoReader.ThrowEnumException(
                                                                            typeof(TargetPlatform),
                                                                            num2);
                                                                    }
                                                                    else
                                                                    {
                                                                        targetPlatform = TargetPlatform.RaspberryPi;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    targetPlatform = TargetPlatform.WindowsPhone8;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                targetPlatform = TargetPlatform.PlayStationMobile;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            targetPlatform = TargetPlatform.Ouya;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        targetPlatform = TargetPlatform.NativeClient;
                                                    }
                                                }
                                                else
                                                {
                                                    targetPlatform = TargetPlatform.WindowsStoreApp;
                                                }
                                            }
                                            else
                                            {
                                                targetPlatform = TargetPlatform.MacOSX;
                                            }
                                        }
                                        else
                                        {
                                            targetPlatform = TargetPlatform.Linux;
                                        }
                                    }
                                    else
                                    {
                                        targetPlatform = TargetPlatform.Android;
                                    }
                                }
                                else
                                {
                                    targetPlatform = TargetPlatform.iOS;
                                }
                            }
                            else
                            {
                                targetPlatform = TargetPlatform.WindowsPhone;
                            }
                        }
                        else
                        {
                            targetPlatform = TargetPlatform.Xbox360;
                        }
                    }
                    else
                    {
                        targetPlatform = TargetPlatform.Windows;
                    }

                    platformData.Platform = targetPlatform;
                }
            }

            if (platformData == null)
            {
                var expr_18C = new PlatformData();
                ProtoReader.NoteObject(expr_18C, protoReader);
                platformData = expr_18C;
            }

            return(platformData);
        }
Exemplo n.º 22
0
        /// <summary>
        /// The read.
        /// </summary>
        /// <param name="compiledAsset">
        /// The compiled asset.
        /// </param>
        /// <param name="protoReader">
        /// The proto reader.
        /// </param>
        /// <returns>
        /// The <see cref="CompiledAsset"/>.
        /// </returns>
        private static CompiledAsset Read(CompiledAsset compiledAsset, ProtoReader protoReader)
        {
            int num;

            while ((num = protoReader.ReadFieldHeader()) > 0)
            {
                if (num != 1)
                {
                    if (num != 3)
                    {
                        if (compiledAsset == null)
                        {
                            var expr_8A = new CompiledAsset();
                            ProtoReader.NoteObject(expr_8A, protoReader);
                            compiledAsset = expr_8A;
                        }

                        protoReader.SkipField();
                    }
                    else
                    {
                        if (compiledAsset == null)
                        {
                            var expr_4C = new CompiledAsset();
                            ProtoReader.NoteObject(expr_4C, protoReader);
                            compiledAsset = expr_4C;
                        }

                        PlatformData arg_63_0 = compiledAsset.PlatformData;
                        SubItemToken token    = ProtoReader.StartSubItem(protoReader);
                        PlatformData arg_6F_0 = Read(arg_63_0, protoReader);
                        ProtoReader.EndSubItem(token, protoReader);
                        PlatformData platformData = arg_6F_0;
                        if (platformData != null)
                        {
                            compiledAsset.PlatformData = platformData;
                        }
                    }
                }
                else
                {
                    if (compiledAsset == null)
                    {
                        var expr_19 = new CompiledAsset();
                        ProtoReader.NoteObject(expr_19, protoReader);
                        compiledAsset = expr_19;
                    }

                    string text = protoReader.ReadString();
                    if (text != null)
                    {
                        compiledAsset.Loader = text;
                    }
                }
            }

            if (compiledAsset == null)
            {
                var expr_B2 = new CompiledAsset();
                ProtoReader.NoteObject(expr_B2, protoReader);
                compiledAsset = expr_B2;
            }

            return(compiledAsset);
        }
Exemplo n.º 23
0
        /// <summary>
        /// The read.
        /// </summary>
        /// <param name="mxMessage">
        /// The mx message.
        /// </param>
        /// <param name="protoReader">
        /// The proto reader.
        /// </param>
        /// <returns>
        /// The <see cref="MxMessage"/>.
        /// </returns>
        private static MxMessage Read(MxMessage mxMessage, ProtoReader protoReader)
        {
            int num;

            while ((num = protoReader.ReadFieldHeader()) > 0)
            {
                if (num != 1)
                {
                    if (num != 2)
                    {
                        if (num != 3)
                        {
                            if (num != 4)
                            {
                                if (num != 6)
                                {
                                    if (mxMessage == null)
                                    {
                                        var expr_170 = new MxMessage();
                                        ProtoReader.NoteObject(expr_170, protoReader);
                                        mxMessage = expr_170;
                                    }

                                    protoReader.SkipField();
                                }
                                else
                                {
                                    if (mxMessage == null)
                                    {
                                        var expr_D9 = new MxMessage();
                                        ProtoReader.NoteObject(expr_D9, protoReader);
                                        mxMessage = expr_D9;
                                    }

                                    MxPayload[] payloads = mxMessage.Payloads;
                                    var         list     = new List <MxPayload>();
                                    int         num2     = protoReader.FieldNumber;
                                    do
                                    {
                                        List <MxPayload> arg_111_0 = list;
                                        MxPayload        arg_104_0 = null;
                                        SubItemToken     token     = ProtoReader.StartSubItem(protoReader);
                                        MxPayload        arg_111_1 = Read(arg_104_0, protoReader);
                                        ProtoReader.EndSubItem(token, protoReader);
                                        arg_111_0.Add(arg_111_1);
                                    }while (protoReader.TryReadFieldHeader(num2));
                                    MxPayload[] expr_124 = payloads;
                                    var         array    =
                                        new MxPayload[(num2 = (expr_124 != null) ? expr_124.Length : 0) + list.Count];
                                    if (num2 != 0)
                                    {
                                        payloads.CopyTo(array, 0);
                                    }

                                    list.CopyTo(array, num2);
                                    array = array;
                                    if (array != null)
                                    {
                                        mxMessage.Payloads = array;
                                    }
                                }
                            }
                            else
                            {
                                if (mxMessage == null)
                                {
                                    var expr_A9 = new MxMessage();
                                    ProtoReader.NoteObject(expr_A9, protoReader);
                                    mxMessage = expr_A9;
                                }

                                uint num3 = protoReader.ReadUInt32();
                                mxMessage.AckBitfield = num3;
                            }
                        }
                        else
                        {
                            if (mxMessage == null)
                            {
                                var expr_79 = new MxMessage();
                                ProtoReader.NoteObject(expr_79, protoReader);
                                mxMessage = expr_79;
                            }

                            uint num3 = protoReader.ReadUInt32();
                            mxMessage.Ack = num3;
                        }
                    }
                    else
                    {
                        if (mxMessage == null)
                        {
                            var expr_49 = new MxMessage();
                            ProtoReader.NoteObject(expr_49, protoReader);
                            mxMessage = expr_49;
                        }

                        uint num3 = protoReader.ReadUInt32();
                        mxMessage.Sequence = num3;
                    }
                }
                else
                {
                    if (mxMessage == null)
                    {
                        var expr_19 = new MxMessage();
                        ProtoReader.NoteObject(expr_19, protoReader);
                        mxMessage = expr_19;
                    }

                    uint num3 = protoReader.ReadUInt32();
                    mxMessage.ProtocolID = num3;
                }
            }

            if (mxMessage == null)
            {
                var expr_198 = new MxMessage();
                ProtoReader.NoteObject(expr_198, protoReader);
                mxMessage = expr_198;
            }

            return(mxMessage);
        }