本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.ParseRecord.Trace方法的典型用法代码示例。如果您正苦于以下问题:C# ParseRecord.Trace方法的具体用法?C# ParseRecord.Trace怎么用?C# ParseRecord.Trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Serialization.Formatters.Binary.ParseRecord
的用法示例。
在下文中一共展示了ParseRecord.Trace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseArrayMember
// Array object item encountered in stream
private void ParseArrayMember(ParseRecord pr)
{
SerTrace.Log( this, "ParseArrayMember Entry");
ParseRecord objectPr = (ParseRecord)stack.Peek();
// Set up for inserting value into correct array position
if (objectPr.PRarrayTypeEnum == InternalArrayTypeE.Rectangular)
{
if (objectPr.PRmemberIndex > 0)
NextRectangleMap(objectPr); // Rectangle array, calculate position in array
if (objectPr.PRisLowerBound)
{
for (int i=0; i<objectPr.PRrank; i++)
{
if (objectPr.PRpositionA == null)
objectPr.PRindexMap[i] = objectPr.PRrectangularMap[i] + objectPr.PRlowerBoundA[i];
else
objectPr.PRindexMap[i] = objectPr.PRpositionA[i];
}
}
}
else
{
if (!objectPr.PRisLowerBound)
{
if (objectPr.PRpositionA == null)
objectPr.PRindexMap[0] = objectPr.PRmemberIndex; // Zero based array
else
objectPr.PRindexMap[0] = objectPr.PRpositionA[0]; // item position specified in SOAP stream
}
else
objectPr.PRindexMap[0] = objectPr.PRlowerBoundA[0]+objectPr.PRmemberIndex; // Lower Bound based array
}
IndexTraceMessage("ParseArrayMember isLowerBound "+objectPr.PRisLowerBound+" indexMap ", objectPr.PRindexMap);
// Set Array element according to type of element
if (pr.PRmemberValueEnum == InternalMemberValueE.Reference)
{
// Object Reference
// See if object has already been instantiated
Object refObj = m_objectManager.GetObject(pr.PRidRef);
if (refObj == null)
{
// Object not instantiated
// Array fixup manager
IndexTraceMessage("ParseArrayMember Record Fixup "+objectPr.PRnewObj.GetType(), objectPr.PRindexMap);
int[] fixupIndex = new int[objectPr.PRrank];
Array.Copy(objectPr.PRindexMap, 0, fixupIndex, 0, objectPr.PRrank);
SerTrace.Log( this, "ParseArrayMember RecordArrayElementFixup objectId ",objectPr.PRobjectId," idRef ",pr.PRidRef);
m_objectManager.RecordArrayElementFixup(objectPr.PRobjectId, fixupIndex, pr.PRidRef);
}
else
{
IndexTraceMessage("ParseArrayMember SetValue ObjectReference "+objectPr.PRnewObj.GetType()+" "+refObj, objectPr.PRindexMap);
if (objectPr.PRobjectA != null)
objectPr.PRobjectA[objectPr.PRindexMap[0]] = refObj;
else
((Array)objectPr.PRnewObj).SetValue(refObj, objectPr.PRindexMap); // Object has been instantiated
}
}
else if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
{
//Set up dtType for ParseObject
SerTrace.Log( this, "ParseArrayMember Nested ");
if (pr.PRdtType == null)
{
pr.PRdtType = objectPr.PRarrayElementType;
}
ParseObject(pr);
stack.Push(pr);
if ((objectPr.PRarrayElementType.IsValueType) && (pr.PRarrayElementTypeCode == InternalPrimitiveTypeE.Invalid))
{
SerTrace.Log( "ParseArrayMember ValueType ObjectPr ",objectPr.PRnewObj," index ",objectPr.PRmemberIndex);
pr.PRisValueTypeFixup = true; //Valuefixup
ValueFixupStack.Push(new ValueFixup((Array)objectPr.PRnewObj, objectPr.PRindexMap)); //valuefixup
pr.PRisRegistered = true;
// No need to register a value object, because there cant be 2 references to same instance of value type
// (we know its not boxed here..array element type IsValueType, not Object)
//RegisterObject(pr.PRnewObj, pr, objectPr);
}
else
{
SerTrace.Log( "ParseArrayMember SetValue Nested, memberIndex ",objectPr.PRmemberIndex);
IndexTraceMessage("ParseArrayMember SetValue Nested ContainerObject "+objectPr.PRnewObj.GetType()+" "+objectPr.PRnewObj+" item Object "+pr.PRnewObj+" index ", objectPr.PRindexMap);
stack.Dump();
SerTrace.Log( "ParseArrayMember SetValue Nested ContainerObject objectPr ",objectPr.Trace());
SerTrace.Log( "ParseArrayMember SetValue Nested ContainerObject pr ",pr.Trace());
if (objectPr.PRobjectA != null)
objectPr.PRobjectA[objectPr.PRindexMap[0]] = pr.PRnewObj;
else
//.........这里部分代码省略.........
示例2: ParseMember
// Object member encountered in stream
private void ParseMember(ParseRecord pr)
{
SerTrace.Log( this, "ParseMember Entry ");
ParseRecord objectPr = (ParseRecord)stack.Peek();
String objName = null;
if (objectPr != null)
objName = objectPr.PRname;
SerTrace.Log( this, "ParseMember ",objectPr.PRobjectId," ",pr.PRname);
SerTrace.Log( this, "ParseMember objectPr ",objectPr.Trace());
SerTrace.Log( this, "ParseMember pr ",pr.Trace());
switch (pr.PRmemberTypeEnum)
{
case InternalMemberTypeE.Item:
ParseArrayMember(pr);
return;
case InternalMemberTypeE.Field:
break;
}
//if ((pr.PRdtType == null) && !objectPr.PRobjectInfo.isSi)
if ((pr.PRdtType == null) && objectPr.PRobjectInfo.isTyped)
{
SerTrace.Log( this, "ParseMember pr.PRdtType null and not isSi");
pr.PRdtType = objectPr.PRobjectInfo.GetType(pr.PRname);
if (pr.PRdtType == null)
throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_TypeResolved"), objectPr.PRnewObj+" "+pr.PRname));
pr.PRdtTypeCode = Converter.ToCode(pr.PRdtType);
}
if (pr.PRmemberValueEnum == InternalMemberValueE.Null)
{
// Value is Null
SerTrace.Log( this, "ParseMember null member: ",pr.PRname);
SerTrace.Log( this, "AddValue 1");
objectPr.PRobjectInfo.AddValue(pr.PRname, null, ref objectPr.PRsi, ref objectPr.PRmemberData);
}
else if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
{
SerTrace.Log( this, "ParseMember Nested Type member: ",pr.PRname," objectPr.PRnewObj ",objectPr.PRnewObj);
ParseObject(pr);
stack.Push(pr);
SerTrace.Log( this, "AddValue 2 ",pr.PRnewObj," is value type ",pr.PRnewObj.GetType().IsValueType);
if ((pr.PRobjectInfo != null) && (pr.PRobjectInfo.objectType.IsValueType))
{
SerTrace.Log( "ParseMember ValueType ObjectPr ",objectPr.PRnewObj," memberName ",pr.PRname," nested object ",pr.PRnewObj);
pr.PRisValueTypeFixup = true; //Valuefixup
ValueFixupStack.Push(new ValueFixup(objectPr.PRnewObj, pr.PRname, objectPr.PRobjectInfo));//valuefixup
}
else
{
SerTrace.Log( this, "AddValue 2A ");
objectPr.PRobjectInfo.AddValue(pr.PRname, pr.PRnewObj, ref objectPr.PRsi, ref objectPr.PRmemberData);
}
}
else if (pr.PRmemberValueEnum == InternalMemberValueE.Reference)
{
SerTrace.Log( this, "ParseMember Reference Type member: ",pr.PRname);
// See if object has already been instantiated
Object refObj = m_objectManager.GetObject(pr.PRidRef);
if (refObj == null)
{
SerTrace.Log( this, "ParseMember RecordFixup: ",pr.PRname);
SerTrace.Log( this, "AddValue 3");
objectPr.PRobjectInfo.AddValue(pr.PRname, null, ref objectPr.PRsi, ref objectPr.PRmemberData);
objectPr.PRobjectInfo.RecordFixup(objectPr.PRobjectId, pr.PRname, pr.PRidRef); // Object not instantiated
}
else
{
SerTrace.Log( this, "ParseMember Referenced Object Known ",pr.PRname," ",refObj);
SerTrace.Log( this, "AddValue 5");
objectPr.PRobjectInfo.AddValue(pr.PRname, refObj, ref objectPr.PRsi, ref objectPr.PRmemberData);
}
}
else if (pr.PRmemberValueEnum == InternalMemberValueE.InlineValue)
{
// Primitive type or String
SerTrace.Log( this, "ParseMember primitive or String member: ",pr.PRname);
if (pr.PRdtType == Converter.typeofString)
{
ParseString(pr, objectPr);
SerTrace.Log( this, "AddValue 6");
objectPr.PRobjectInfo.AddValue(pr.PRname, pr.PRvalue, ref objectPr.PRsi, ref objectPr.PRmemberData);
}
else if (pr.PRdtTypeCode == InternalPrimitiveTypeE.Invalid)
{
// The member field was an object put the value is Inline either bin.Base64 or invalid
if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
{
SerTrace.Log( this, "AddValue 7");
//.........这里部分代码省略.........
示例3: ParseObjectEnd
// End of object encountered in stream
private void ParseObjectEnd(ParseRecord pr)
{
SerTrace.Log( this, "ParseObjectEnd Entry ",pr.Trace());
ParseRecord objectPr = (ParseRecord)stack.Peek();
if (objectPr == null)
objectPr = pr;
//BCLDebug.Assert(objectPr != null, "[System.Runtime.Serialization.Formatters.ParseObjectEnd]objectPr != null");
SerTrace.Log( this, "ParseObjectEnd objectPr ",objectPr.Trace());
if (objectPr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
SerTrace.Log( this, "ParseObjectEnd Top Object dtType ",objectPr.PRdtType);
if (objectPr.PRdtType == Converter.typeofString)
{
SerTrace.Log( this, "ParseObjectEnd Top String");
objectPr.PRnewObj = objectPr.PRvalue;
isTopObjectResolved = true;
topObject = objectPr.PRnewObj;
return;
}
}
stack.Pop();
ParseRecord parentPr = (ParseRecord)stack.Peek();
if (objectPr.PRobjectTypeEnum == InternalObjectTypeE.Array)
{
if (objectPr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
SerTrace.Log( this, "ParseObjectEnd Top Object (Array) Resolved");
isTopObjectResolved = true;
topObject = objectPr.PRnewObj;
}
SerTrace.Log( this, "ParseArray RegisterObject ",objectPr.PRobjectId," ",objectPr.PRnewObj.GetType());
RegisterObject(objectPr.PRnewObj, objectPr, parentPr);
return;
}
objectPr.PRobjectInfo.PopulateObjectMembers(objectPr.PRnewObj, objectPr.PRmemberData);
// Registration is after object is populated
if ((!objectPr.PRisRegistered) && (objectPr.PRobjectId > 0))
{
SerTrace.Log( this, "ParseObject Register Object ",objectPr.PRobjectId," ",objectPr.PRnewObj.GetType());
RegisterObject(objectPr.PRnewObj, objectPr, parentPr);
}
if (objectPr.PRisValueTypeFixup)
{
SerTrace.Log( this, "ParseObjectEnd ValueTypeFixup ",objectPr.PRnewObj.GetType());
ValueFixup fixup = (ValueFixup)ValueFixupStack.Pop(); //Value fixup
fixup.Fixup(objectPr, parentPr); // Value fixup
}
if (objectPr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
SerTrace.Log( this, "ParseObjectEnd Top Object Resolved ",objectPr.PRnewObj.GetType());
isTopObjectResolved = true;
topObject = objectPr.PRnewObj;
}
objectPr.PRobjectInfo.ObjectEnd();
SerTrace.Log( this, "ParseObjectEnd Exit ",objectPr.PRnewObj.GetType()," id: ",objectPr.PRobjectId);
}