public void Read(__BinaryParser input)
 {
     this.messageEnum = (MessageEnum) input.ReadInt32();
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.NoReturnValue))
     {
         this.returnValue = null;
     }
     else if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueVoid))
     {
         this.returnValue = instanceOfVoid;
     }
     else if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ReturnValueInline))
     {
         this.returnValue = IOUtil.ReadWithCode(input);
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         this.scallContext = (string) IOUtil.ReadWithCode(input);
         LogicalCallContext context = new LogicalCallContext {
             RemotingData = { LogicalCallID = this.scallContext }
         };
         this.callContext = context;
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         this.args = IOUtil.ReadArgs(input);
     }
 }
 public void Read(__BinaryParser input)
 {
     this.objectId = input.ReadInt32();
     this.name = input.ReadString();
     this.numMembers = input.ReadInt32();
     this.memberNames = new string[this.numMembers];
     this.binaryTypeEnumA = new BinaryTypeEnum[this.numMembers];
     this.typeInformationA = new object[this.numMembers];
     this.memberAssemIds = new int[this.numMembers];
     for (int i = 0; i < this.numMembers; i++)
     {
         this.memberNames[i] = input.ReadString();
     }
     for (int j = 0; j < this.numMembers; j++)
     {
         this.binaryTypeEnumA[j] = (BinaryTypeEnum) input.ReadByte();
     }
     for (int k = 0; k < this.numMembers; k++)
     {
         if ((this.binaryTypeEnumA[k] != BinaryTypeEnum.ObjectUrt) && (this.binaryTypeEnumA[k] != BinaryTypeEnum.ObjectUser))
         {
             this.typeInformationA[k] = BinaryConverter.ReadTypeInfo(this.binaryTypeEnumA[k], input, out this.memberAssemIds[k]);
         }
         else
         {
             BinaryConverter.ReadTypeInfo(this.binaryTypeEnumA[k], input, out this.memberAssemIds[k]);
         }
     }
     if (this.binaryHeaderEnum == BinaryHeaderEnum.ObjectWithMapTypedAssemId)
     {
         this.assemId = input.ReadInt32();
     }
 }
 internal static object[] ReadArgs(__BinaryParser input)
 {
     int num = input.ReadInt32();
     object[] objArray = new object[num];
     for (int i = 0; i < num; i++)
     {
         objArray[i] = ReadWithCode(input);
     }
     return objArray;
 }
        public void Read(__BinaryParser input)
        {
            switch (this.binaryHeaderEnum)
            {
                case BinaryHeaderEnum.ArraySinglePrimitive:
                    this.objectId = input.ReadInt32();
                    this.lengthA = new int[] { input.ReadInt32() };
                    this.binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                    this.rank = 1;
                    this.lowerBoundA = new int[this.rank];
                    this.binaryTypeEnum = BinaryTypeEnum.Primitive;
                    this.typeInformation = (InternalPrimitiveTypeE) input.ReadByte();
                    return;

                case BinaryHeaderEnum.ArraySingleObject:
                    this.objectId = input.ReadInt32();
                    this.lengthA = new int[] { input.ReadInt32() };
                    this.binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                    this.rank = 1;
                    this.lowerBoundA = new int[this.rank];
                    this.binaryTypeEnum = BinaryTypeEnum.Object;
                    this.typeInformation = null;
                    return;

                case BinaryHeaderEnum.ArraySingleString:
                    this.objectId = input.ReadInt32();
                    this.lengthA = new int[] { input.ReadInt32() };
                    this.binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
                    this.rank = 1;
                    this.lowerBoundA = new int[this.rank];
                    this.binaryTypeEnum = BinaryTypeEnum.String;
                    this.typeInformation = null;
                    return;
            }
            this.objectId = input.ReadInt32();
            this.binaryArrayTypeEnum = (BinaryArrayTypeEnum) input.ReadByte();
            this.rank = input.ReadInt32();
            this.lengthA = new int[this.rank];
            this.lowerBoundA = new int[this.rank];
            for (int i = 0; i < this.rank; i++)
            {
                this.lengthA[i] = input.ReadInt32();
            }
            if (((this.binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset) || (this.binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset)) || (this.binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset))
            {
                for (int j = 0; j < this.rank; j++)
                {
                    this.lowerBoundA[j] = input.ReadInt32();
                }
            }
            this.binaryTypeEnum = (BinaryTypeEnum) input.ReadByte();
            this.typeInformation = BinaryConverter.ReadTypeInfo(this.binaryTypeEnum, input, out this.assemId);
        }
        internal static object ReadWithCode(__BinaryParser input)
        {
            InternalPrimitiveTypeE code = (InternalPrimitiveTypeE) input.ReadByte();
            switch (code)
            {
                case InternalPrimitiveTypeE.Null:
                    return null;

                case InternalPrimitiveTypeE.String:
                    return input.ReadString();
            }
            return input.ReadValue(code);
        }
 public void Read(__BinaryParser input)
 {
     this.objectId = input.ReadInt32();
     this.name = input.ReadString();
     this.numMembers = input.ReadInt32();
     this.memberNames = new string[this.numMembers];
     for (int i = 0; i < this.numMembers; i++)
     {
         this.memberNames[i] = input.ReadString();
     }
     if (this.binaryHeaderEnum == BinaryHeaderEnum.ObjectWithMapAssemId)
     {
         this.assemId = input.ReadInt32();
     }
 }
 public void Read(__BinaryParser input)
 {
     byte[] buffer = input.ReadBytes(0x11);
     if (buffer.Length < 0x11)
     {
         __Error.EndOfFile();
     }
     this.majorVersion = GetInt32(buffer, 9);
     if (this.majorVersion > this.binaryFormatterMajorVersion)
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", new object[] { BitConverter.ToString(buffer) }));
     }
     this.binaryHeaderEnum = (BinaryHeaderEnum) buffer[0];
     this.topId = GetInt32(buffer, 1);
     this.headerId = GetInt32(buffer, 5);
     this.minorVersion = GetInt32(buffer, 13);
 }
 internal void Read(__BinaryParser input)
 {
     this.messageEnum = (MessageEnum) input.ReadInt32();
     this.methodName = (string) IOUtil.ReadWithCode(input);
     this.typeName = (string) IOUtil.ReadWithCode(input);
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ContextInline))
     {
         this.scallContext = (string) IOUtil.ReadWithCode(input);
         LogicalCallContext context = new LogicalCallContext {
             RemotingData = { LogicalCallID = this.scallContext }
         };
         this.callContext = context;
     }
     if (IOUtil.FlagTest(this.messageEnum, MessageEnum.ArgsInline))
     {
         this.args = IOUtil.ReadArgs(input);
     }
 }
        public void Read(__BinaryParser input, BinaryHeaderEnum binaryHeaderEnum)
        {
            switch (binaryHeaderEnum)
            {
                case BinaryHeaderEnum.ObjectNull:
                    this.nullCount = 1;
                    return;

                case BinaryHeaderEnum.MessageEnd:
                case BinaryHeaderEnum.Assembly:
                    break;

                case BinaryHeaderEnum.ObjectNullMultiple256:
                    this.nullCount = input.ReadByte();
                    return;

                case BinaryHeaderEnum.ObjectNullMultiple:
                    this.nullCount = input.ReadInt32();
                    break;

                default:
                    return;
            }
        }
 public void Read(__BinaryParser input)
 {
     this.Read(input, BinaryHeaderEnum.ObjectNull);
 }
        internal Object Deserialize(HeaderHandler handler, __BinaryParser serParser, bool fCheck)
        {
            if (serParser == null)
                throw new ArgumentNullException("serParser", Environment.GetResourceString("ArgumentNull_WithParamName", serParser)); 
            Contract.EndContractBlock();
 
#if _DEBUG 
            SerTrace.Log( this, "Deserialize Entry handler", handler);
#endif 
            bFullDeserialization = false;
            TopObject = null;
            topId = 0;
#if FEATURE_REMOTING 
            bMethodCall = false;
            bMethodReturn = false; 
            bIsCrossAppDomain = isCrossAppDomain; 
#endif
            bSimpleAssembly =  (formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple); 

            if (fCheck)
            {
                try{ 
                    CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
                }catch(Exception e) 
                { 
                    deserializationSecurityException = e;
                } 
            }

            this.handler = handler;
 

            if (bFullDeserialization) 
            { 
                // Reinitialize
#if FEATURE_REMOTING 
                m_objectManager = new ObjectManager(m_surrogates, m_context, false, bIsCrossAppDomain);
#else
                m_objectManager = new ObjectManager(m_surrogates, m_context, false, false);
#endif 
                serObjectInfoInit = new SerObjectInfoInit();
            } 
 
            // Will call back to ParseObject, ParseHeader for each object found
            serParser.Run(); 

#if _DEBUG
            SerTrace.Log( this, "Deserialize Finished Parsing DoFixups");
#endif 

            if (bFullDeserialization) 
                m_objectManager.DoFixups(); 

 
#if FEATURE_REMOTING
            if (!bMethodCall && !bMethodReturn)
#endif
            { 
                if (TopObject == null)
                    throw new SerializationException(Environment.GetResourceString("Serialization_TopObject")); 
 
                //if TopObject has a surrogate then the actual object may be changed during special fixup
                //So refresh it using topID. 
                if (HasSurrogate(TopObject.GetType())  && topId != 0)//Not yet resolved
                    TopObject = m_objectManager.GetObject(topId);

                if (TopObject is IObjectReference) 
                {
                    TopObject = ((IObjectReference)TopObject).GetRealObject(m_context); 
                } 
            }
 
            SerTrace.Log( this, "Deserialize Exit ",TopObject);

            if (bFullDeserialization)
            { 
                m_objectManager.RaiseDeserializationEvent(); // This will raise both IDeserialization and [OnDeserialized] events
            } 
 
            // Return the headers if there is a handler
            if (handler != null) 
            {
                handlerObject = handler(headers);
            }
#if FEATURE_REMOTING 
            if (bMethodCall)
            { 
                Object[] methodCallArray = TopObject as Object[]; 
                TopObject = binaryMethodCall.ReadArray(methodCallArray, handlerObject);
            } 
            else if (bMethodReturn)
            {
                Object[] methodReturnArray = TopObject as Object[];
                TopObject = binaryMethodReturn.ReadArray(methodReturnArray, methodCallMessage, handlerObject); 
            }
#endif 
            return TopObject; 
        }
        internal static object ReadTypeInfo(BinaryTypeEnum binaryTypeEnum, __BinaryParser input, out int assemId)
        {
            object obj2 = null;
            int num = 0;
            switch (binaryTypeEnum)
            {
                case BinaryTypeEnum.Primitive:
                case BinaryTypeEnum.PrimitiveArray:
                    obj2 = (InternalPrimitiveTypeE) input.ReadByte();
                    break;

                case BinaryTypeEnum.String:
                case BinaryTypeEnum.Object:
                case BinaryTypeEnum.ObjectArray:
                case BinaryTypeEnum.StringArray:
                    break;

                case BinaryTypeEnum.ObjectUrt:
                    obj2 = input.ReadString();
                    break;

                case BinaryTypeEnum.ObjectUser:
                    obj2 = input.ReadString();
                    num = input.ReadInt32();
                    break;

                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_TypeRead", new object[] { binaryTypeEnum.ToString() }));
            }
            assemId = num;
            return obj2;
        }
 [System.Security.SecurityCritical] // implements Critical method
 public void Read(__BinaryParser input)
 {
     objectId = input.ReadInt32(); 
     mapId = input.ReadInt32();
 } 
 public void Read(__BinaryParser input)
 {
     this.assemId = input.ReadInt32();
     this.assemblyString = input.ReadString();
 }
 public  void Read(__BinaryParser input, BinaryHeaderEnum binaryHeaderEnum) 
 {
     //binaryHeaderEnum = input.ReadByte(); already read 
     switch (binaryHeaderEnum) 
     {
         case BinaryHeaderEnum.ObjectNull: 
             nullCount = 1;
             break;
         case BinaryHeaderEnum.ObjectNullMultiple256:
             nullCount = input.ReadByte(); 
             //Console.WriteLine("Read nullCount "+nullCount);
             break; 
         case BinaryHeaderEnum.ObjectNullMultiple: 
             nullCount = input.ReadInt32();
             //Console.WriteLine("Read nullCount "+nullCount); 
             break;
     }
 }
        [System.Security.SecurityCritical] // implements Critical method
        public  void Read(__BinaryParser input) 
        {
            byte [] headerBytes = input.ReadBytes(17); 
            // Throw if we couldnt read header bytes 
            if (headerBytes.Length < 17)
                __Error.EndOfFile(); 

            majorVersion = GetInt32(headerBytes, 9);
            if (majorVersion > binaryFormatterMajorVersion)
                throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", BitConverter.ToString(headerBytes))); 

            // binaryHeaderEnum has already been read 
            binaryHeaderEnum = (BinaryHeaderEnum)headerBytes[0]; 
            topId = GetInt32(headerBytes, 1);
            headerId = GetInt32(headerBytes, 5); 
            minorVersion = GetInt32(headerBytes, 13);
        }
 public void Read(__BinaryParser input)
 {
     this.value = input.ReadValue(this.typeInformation);
 }
 public void Read(__BinaryParser input)
 {
     this.crossAppDomainArrayIndex = input.ReadInt32();
 }
 public void Read(__BinaryParser input)
 {
     this.objectId = input.ReadInt32();
     this.value    = input.ReadString();
 }
예제 #20
0
 internal object Deserialize(HeaderHandler handler, __BinaryParser serParser, bool fCheck, bool isCrossAppDomain, IMethodCallMessage methodCallMessage)
 {
     if (serParser == null)
     {
         throw new ArgumentNullException("serParser", Environment.GetResourceString("ArgumentNull_WithParamName", new object[]
         {
             serParser
         }));
     }
     this.bFullDeserialization = false;
     this.TopObject            = null;
     this.topId             = 0L;
     this.bMethodCall       = false;
     this.bMethodReturn     = false;
     this.bIsCrossAppDomain = isCrossAppDomain;
     this.bSimpleAssembly   = (this.formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple);
     if (fCheck)
     {
         CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
     }
     this.handler = handler;
     serParser.Run();
     if (this.bFullDeserialization)
     {
         this.m_objectManager.DoFixups();
     }
     if (!this.bMethodCall && !this.bMethodReturn)
     {
         if (this.TopObject == null)
         {
             throw new SerializationException(Environment.GetResourceString("Serialization_TopObject"));
         }
         if (this.HasSurrogate(this.TopObject.GetType()) && this.topId != 0L)
         {
             this.TopObject = this.m_objectManager.GetObject(this.topId);
         }
         if (this.TopObject is IObjectReference)
         {
             this.TopObject = ((IObjectReference)this.TopObject).GetRealObject(this.m_context);
         }
     }
     if (this.bFullDeserialization)
     {
         this.m_objectManager.RaiseDeserializationEvent();
     }
     if (handler != null)
     {
         this.handlerObject = handler(this.headers);
     }
     if (this.bMethodCall)
     {
         object[] callA = this.TopObject as object[];
         this.TopObject = this.binaryMethodCall.ReadArray(callA, this.handlerObject);
     }
     else if (this.bMethodReturn)
     {
         object[] returnA = this.TopObject as object[];
         this.TopObject = this.binaryMethodReturn.ReadArray(returnA, methodCallMessage, this.handlerObject);
     }
     return(this.TopObject);
 }
예제 #21
0
 public void Read(__BinaryParser input)
 {
     this.primitiveTypeEnum = (InternalPrimitiveTypeE)input.ReadByte();
     this.value             = input.ReadValue(this.primitiveTypeEnum);
 }
예제 #22
0
 public void Read(__BinaryParser input)
 {
 }
 public void Read(__BinaryParser input)
 {
     this.assemId        = input.ReadInt32();
     this.assemblyString = input.ReadString();
 }
예제 #24
0
 public void Read(__BinaryParser input)
 {
     this.assemId       = input.ReadInt32();
     this.assemblyIndex = input.ReadInt32();
 }
 internal static Object[] ReadArgs(__BinaryParser input)
 { 
     int length = input.ReadInt32();
     Object[] args = new Object[length];
     for (int i=0; i<length; i++)
         args[i] = ReadWithCode(input); 
     return args;
 } 
 [System.Security.SecurityCritical] // implements Critical method
 public void Read(__BinaryParser input)
 {
     //binaryHeaderEnum = input.ReadByte(); already read 
     value = input.ReadValue(typeInformation);
 } 
        [System.Security.SecurityCritical]  // auto-generated 
        public void Read(__BinaryParser input)
        { 
             messageEnum = (MessageEnum)input.ReadInt32();

             if (IOUtil.FlagTest(messageEnum, MessageEnum.NoReturnValue))
                 returnValue = null; 
             else if (IOUtil.FlagTest(messageEnum, MessageEnum.ReturnValueVoid))
             { 
                 returnValue = instanceOfVoid; 
             }
             else if (IOUtil.FlagTest(messageEnum, MessageEnum.ReturnValueInline)) 
                 returnValue = IOUtil.ReadWithCode(input);

#if FEATURE_REMOTING
             if (IOUtil.FlagTest(messageEnum, MessageEnum.ContextInline)) 
             {
                 scallContext = (String)IOUtil.ReadWithCode(input); 
                 LogicalCallContext lcallContext = new LogicalCallContext(); 
                 lcallContext.RemotingData.LogicalCallID = scallContext;
                 callContext = lcallContext; 
             }
#endif
             if (IOUtil.FlagTest(messageEnum, MessageEnum.ArgsInline))
                 args = IOUtil.ReadArgs(input); 
        }
 [System.Security.SecurityCritical] // implements Critical method
 public void Read(__BinaryParser input) 
 {
     //binaryHeaderEnum = input.ReadByte(); already read 
 } 
예제 #29
0
 public void Read(__BinaryParser input)
 {
     this.idRef = input.ReadInt32();
 }
 [System.Security.SecurityCritical] // implements Critical method 
 public void Read(__BinaryParser input)
 { 
     assemId = input.ReadInt32(); 
     assemblyIndex = input.ReadInt32();
 } 
 [System.Security.SecurityCritical] // implements Critical method 
 public void Read(__BinaryParser input) 
 {
     crossAppDomainArrayIndex = input.ReadInt32(); 
 }
        [System.Security.SecurityCritical]  // auto-generated
        internal void Read(__BinaryParser input) 
        {
             messageEnum = (MessageEnum)input.ReadInt32();
             //uri = (String)IOUtil.ReadWithCode(input);
             methodName = (String)IOUtil.ReadWithCode(input); 
             typeName = (String)IOUtil.ReadWithCode(input);
 
#if FEATURE_REMOTING 
             if (IOUtil.FlagTest(messageEnum, MessageEnum.ContextInline))
             { 
                 scallContext = (String)IOUtil.ReadWithCode(input);
                 LogicalCallContext lcallContext = new LogicalCallContext();
                 lcallContext.RemotingData.LogicalCallID = scallContext;
                 callContext = lcallContext; 
             }
#endif 
 
             if (IOUtil.FlagTest(messageEnum, MessageEnum.ArgsInline))
                 args = IOUtil.ReadArgs(input); 
        }
 [System.Security.SecurityCritical] // implements Critical method
 public void Read(__BinaryParser input)
 {
     primitiveTypeEnum = (InternalPrimitiveTypeE)input.ReadByte(); //PDJ 
     value = input.ReadValue(primitiveTypeEnum);
 } 
 public void Read(__BinaryParser input)
 {
     this.Read(input, BinaryHeaderEnum.ObjectNull);
 }
        [System.Security.SecurityCritical] // implements Critical method
        public void Read(__BinaryParser input) 
        { 
            objectId = input.ReadInt32();
            name = input.ReadString(); 
            numMembers = input.ReadInt32();
            memberNames = new String[numMembers];
            for (int i=0; i<numMembers; i++)
            { 
                memberNames[i] = input.ReadString();
                SerTrace.Log(this, "BinaryObjectWithMap Read ",i," ",memberNames[i]); 
            } 

            if (binaryHeaderEnum == BinaryHeaderEnum.ObjectWithMapAssemId) 
            {
                assemId = input.ReadInt32();
            }
        } 
예제 #36
0
        // Deserialize the stream into an object graph.
        internal Object Deserialize(HeaderHandler handler, __BinaryParser serParser, bool fCheck, IMethodCallMessage methodCallMessage)
        {

            SerTrace.Log( this, "Deserialize Entry handler", handler);

            BCLDebug.Assert((IsCrossAppDomain() && (crossAppDomainArray != null))
                            || (!IsCrossAppDomain()),
                             "[System.Runtime.Serialization.Formatters.BinaryObjectReader missing crossAppDomainArray]");

            bFullDeserialization = false;
            bMethodCall = false;
            bMethodReturn = false;
            bSimpleAssembly =  (formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple);

            if (serParser == null)
                throw new ArgumentNullException("serParser", String.Format(Environment.GetResourceString("ArgumentNull_WithParamName"), serParser));

            if (fCheck)
            {
                try{
                    CodeAccessPermission.DemandInternal(PermissionType.SecuritySerialization);          
                }catch(Exception e)
                {
                    deserializationSecurityException = e;
                }
            }

            this.handler = handler;

            if (bFullDeserialization)
            {
                // Reinitialize
                m_objectManager = new ObjectManager(m_surrogates, m_context, false);
                serObjectInfoInit = new SerObjectInfoInit();
            }


            // Will call back to ParseObject, ParseHeader for each object found
            serParser.Run();

            SerTrace.Log( this, "Deserialize Finished Parsing DoFixups");

            if (bFullDeserialization)
                m_objectManager.DoFixups();

            if (!bMethodCall && !bMethodReturn)
            {
                if (topObject == null)
                    throw new SerializationException(Environment.GetResourceString("Serialization_TopObject"));

                if (topObject is IObjectReference)
                {
                    topObject = ((IObjectReference)topObject).GetRealObject(m_context);
                }
            }

            SerTrace.Log( this, "Deserialize Exit ",topObject);

            if (bFullDeserialization)
                m_objectManager.RaiseDeserializationEvent();

            // Return the headers if there is a handler
            if (handler != null)
            {
                handlerObject = handler(headers);
            }

            if (bMethodCall)
            {
                Object[] methodCallArray = topObject as Object[];
                topObject = binaryMethodCall.ReadArray(methodCallArray, handlerObject);
            }
            else if (bMethodReturn)
            {
                Object[] methodReturnArray = topObject as Object[];
                topObject = binaryMethodReturn.ReadArray(methodReturnArray, methodCallMessage, handlerObject);
            }

            return topObject;
        }
        [System.Security.SecurityCritical] // implements Critical method 
        public void Read(__BinaryParser input)
        { 
            // binaryHeaderEnum has already been read 
            objectId = input.ReadInt32();
            name = input.ReadString(); 
            numMembers = input.ReadInt32();
            memberNames = new String[numMembers];
            binaryTypeEnumA = new BinaryTypeEnum[numMembers];
            typeInformationA = new Object[numMembers]; 
            memberAssemIds = new Int32[numMembers];
            for (int i=0; i<numMembers; i++) 
                memberNames[i] = input.ReadString(); 
            for (int i=0; i<numMembers; i++)
                binaryTypeEnumA[i] = (BinaryTypeEnum)input.ReadByte(); 
            for (int i=0; i<numMembers; i++)
                if (binaryTypeEnumA[i] != BinaryTypeEnum.ObjectUrt && binaryTypeEnumA[i] != BinaryTypeEnum.ObjectUser)
                    typeInformationA[i] = BinaryConverter.ReadTypeInfo(binaryTypeEnumA[i], input, out memberAssemIds[i]);
                else 
                    BinaryConverter.ReadTypeInfo(binaryTypeEnumA[i], input, out memberAssemIds[i]);
 
            if (binaryHeaderEnum == BinaryHeaderEnum.ObjectWithMapTypedAssemId) 
            {
                assemId = input.ReadInt32(); 
            }
        }
 internal object Deserialize(HeaderHandler handler, __BinaryParser serParser, bool fCheck, bool isCrossAppDomain, IMethodCallMessage methodCallMessage)
 {
     if (serParser == null)
     {
         throw new ArgumentNullException("serParser", Environment.GetResourceString("ArgumentNull_WithParamName", new object[] { serParser }));
     }
     this.bFullDeserialization = false;
     this.TopObject = null;
     this.topId = 0L;
     this.bMethodCall = false;
     this.bMethodReturn = false;
     this.bIsCrossAppDomain = isCrossAppDomain;
     this.bSimpleAssembly = this.formatterEnums.FEassemblyFormat == FormatterAssemblyStyle.Simple;
     if (fCheck)
     {
         CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
     }
     this.handler = handler;
     if (this.bFullDeserialization)
     {
         this.m_objectManager = new ObjectManager(this.m_surrogates, this.m_context, false, this.bIsCrossAppDomain);
         this.serObjectInfoInit = new SerObjectInfoInit();
     }
     serParser.Run();
     if (this.bFullDeserialization)
     {
         this.m_objectManager.DoFixups();
     }
     if (!this.bMethodCall && !this.bMethodReturn)
     {
         if (this.TopObject == null)
         {
             throw new SerializationException(Environment.GetResourceString("Serialization_TopObject"));
         }
         if (this.HasSurrogate(this.TopObject.GetType()) && (this.topId != 0L))
         {
             this.TopObject = this.m_objectManager.GetObject(this.topId);
         }
         if (this.TopObject is IObjectReference)
         {
             this.TopObject = ((IObjectReference) this.TopObject).GetRealObject(this.m_context);
         }
     }
     if (this.bFullDeserialization)
     {
         this.m_objectManager.RaiseDeserializationEvent();
     }
     if (handler != null)
     {
         this.handlerObject = handler(this.headers);
     }
     if (this.bMethodCall)
     {
         object[] topObject = this.TopObject as object[];
         this.TopObject = this.binaryMethodCall.ReadArray(topObject, this.handlerObject);
     }
     else if (this.bMethodReturn)
     {
         object[] returnA = this.TopObject as object[];
         this.TopObject = this.binaryMethodReturn.ReadArray(returnA, methodCallMessage, this.handlerObject);
     }
     return this.TopObject;
 }
 [System.Security.SecurityCritical] // implements Critical method
 public void Read(__BinaryParser input)
 {
     switch (binaryHeaderEnum) 
     {
         case BinaryHeaderEnum.ArraySinglePrimitive: 
             objectId = input.ReadInt32(); 
             lengthA = new int[1];
             lengthA[0] = input.ReadInt32(); 
             binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
             rank = 1;
             lowerBoundA = new Int32[rank];
             binaryTypeEnum = BinaryTypeEnum.Primitive; 
             typeInformation = (InternalPrimitiveTypeE)input.ReadByte();
             break; 
         case BinaryHeaderEnum.ArraySingleString: 
             objectId = input.ReadInt32();
             lengthA = new int[1]; 
             lengthA[0] = (int)input.ReadInt32();
             binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
             rank = 1;
             lowerBoundA = new Int32[rank]; 
             binaryTypeEnum = BinaryTypeEnum.String;
             typeInformation = null; 
             break; 
         case BinaryHeaderEnum.ArraySingleObject:
             objectId = input.ReadInt32(); 
             lengthA = new int[1];
             lengthA[0] = (int)input.ReadInt32();
             binaryArrayTypeEnum = BinaryArrayTypeEnum.Single;
             rank = 1; 
             lowerBoundA = new Int32[rank];
             binaryTypeEnum = BinaryTypeEnum.Object; 
             typeInformation = null; 
             break;
 default: 
             objectId = input.ReadInt32();
             binaryArrayTypeEnum = (BinaryArrayTypeEnum)input.ReadByte();
             rank = input.ReadInt32();
             lengthA = new Int32[rank]; 
             lowerBoundA = new Int32[rank];
             for (int i=0; i<rank; i++) 
                 lengthA[i] = input.ReadInt32(); 
             if ((binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset) ||
                 (binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset) || 
                 (binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset))
             {
                 for (int i=0; i<rank; i++)
                     lowerBoundA[i] = input.ReadInt32(); 
             }
             binaryTypeEnum = (BinaryTypeEnum)input.ReadByte(); 
             typeInformation = BinaryConverter.ReadTypeInfo(binaryTypeEnum, input, out assemId); 
             break;
     } 
 }
 [System.Security.SecurityCritical] // implements Critical method
 public void Read(__BinaryParser input) 
 { 
     objectId = input.ReadInt32();
     value = input.ReadString(); 
 }
예제 #41
0
 public void Read(__BinaryParser input)
 {
     this.objectId = input.ReadInt32();
     this.mapId    = input.ReadInt32();
 }