本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run方法的典型用法代码示例。如果您正苦于以下问题:C# __BinaryParser.Run方法的具体用法?C# __BinaryParser.Run怎么用?C# __BinaryParser.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Serialization.Formatters.Binary.__BinaryParser
的用法示例。
在下文中一共展示了__BinaryParser.Run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
// 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;
}
示例2: Deserialize
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: Deserialize
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;
}