Run() 개인적인 메소드

private Run ( ) : void
리턴 void
예제 #1
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", (object)serParser));
     }
     this.bFullDeserialization = false;
     this.TopObject            = (object)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)
     {
         this.TopObject = (object)this.binaryMethodCall.ReadArray(this.TopObject as object[], this.handlerObject);
     }
     else if (this.bMethodReturn)
     {
         this.TopObject = (object)this.binaryMethodReturn.ReadArray(this.TopObject as object[], methodCallMessage, this.handlerObject);
     }
     return(this.TopObject);
 }
 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;
 }
예제 #3
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;
        }
        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; 
        }