本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.ParseRecord类的典型用法代码示例。如果您正苦于以下问题:C# ParseRecord类的具体用法?C# ParseRecord怎么用?C# ParseRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParseRecord类属于System.Runtime.Serialization.Formatters.Binary命名空间,在下文中一共展示了ParseRecord类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Fixup
internal void Fixup(ParseRecord record, ParseRecord parent)
{
object pRnewObj = record.PRnewObj;
switch (this.valueFixupEnum)
{
case ValueFixupEnum.Array:
this.arrayObj.SetValue(pRnewObj, this.indexMap);
return;
case ValueFixupEnum.Header:
{
Type type = typeof(Header);
if (valueInfo == null)
{
MemberInfo[] member = type.GetMember("Value");
if (member.Length != 1)
{
throw new SerializationException(Environment.GetResourceString("Serialization_HeaderReflection", new object[] { member.Length }));
}
valueInfo = member[0];
break;
}
break;
}
case ValueFixupEnum.Member:
if (!this.objectInfo.isSi)
{
MemberInfo memberInfo = this.objectInfo.GetMemberInfo(this.memberName);
if (memberInfo != null)
{
this.objectInfo.objectManager.RecordFixup(parent.PRobjectId, memberInfo, record.PRobjectId);
}
return;
}
this.objectInfo.objectManager.RecordDelayedFixup(parent.PRobjectId, this.memberName, record.PRobjectId);
return;
default:
return;
}
FormatterServices.SerializationSetValue(valueInfo, this.header, pRnewObj);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:42,代码来源:ValueFixup.cs
示例2: ParseSerializedStreamHeader
// Parse the SerializedStreamHeader element. This is the first element in the stream if present
private void ParseSerializedStreamHeader(ParseRecord pr)
{
SerTrace.Log( this, "SerializedHeader ",pr);
stack.Push(pr);
}
开发者ID:ArildF,项目名称:masters,代码行数:6,代码来源:binaryobjectreader.cs
示例3: ReadArrayAsBytes
[System.Security.SecurityCritical] // auto-generated
private void ReadArrayAsBytes(ParseRecord pr)
{
if (pr.PRarrayElementTypeCode == InternalPrimitiveTypeE.Byte)
pr.PRnewObj = ReadBytes(pr.PRlengthA[0]);
else if (pr.PRarrayElementTypeCode == InternalPrimitiveTypeE.Char)
pr.PRnewObj = ReadChars(pr.PRlengthA[0]);
else
{
int typeLength = Converter.TypeLength(pr.PRarrayElementTypeCode);
pr.PRnewObj = Converter.CreatePrimitiveArray(pr.PRarrayElementTypeCode, pr.PRlengthA[0]);
//pr.PRnewObj = Array.CreateInstance(pr.PRarrayElementType, pr.PRlengthA[0]);
Contract.Assert((pr.PRnewObj != null),"[BinaryParser expected a Primitive Array]");
Array array = (Array)pr.PRnewObj;
int arrayOffset = 0;
if (byteBuffer == null)
byteBuffer = new byte[chunkSize];
while (arrayOffset < array.Length)
{
int numArrayItems = Math.Min(chunkSize/typeLength, array.Length-arrayOffset);
int bufferUsed = numArrayItems*typeLength;
ReadBytes(byteBuffer, 0, bufferUsed);
#if BIGENDIAN
// we know that we are reading a primitive type, so just do a simple swap
for (int i = 0; i < bufferUsed; i += typeLength)
{
for (int j = 0; j < typeLength / 2; j++)
{
byte tmp = byteBuffer[i + j];
byteBuffer[i + j] = byteBuffer[i + typeLength - 1 - j];
byteBuffer[i + typeLength - 1 - j] = tmp;
}
}
#endif
Buffer.InternalBlockCopy(byteBuffer, 0, array, arrayOffset*typeLength, bufferUsed);
arrayOffset += numArrayItems;
}
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:43,代码来源:binaryparser.cs
示例4: ParseObject
private void ParseObject(ParseRecord pr)
{
if (!this.bFullDeserialization)
{
this.InitFullDeserialization();
}
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
this.topId = pr.PRobjectId;
}
if (pr.PRparseTypeEnum == InternalParseTypeE.Object)
{
this.stack.Push(pr);
}
if (pr.PRobjectTypeEnum == InternalObjectTypeE.Array)
{
this.ParseArray(pr);
}
else if (pr.PRdtType == null)
{
pr.PRnewObj = new TypeLoadExceptionHolder(pr.PRkeyDt);
}
else if (object.ReferenceEquals(pr.PRdtType, Converter.typeofString))
{
if (pr.PRvalue != null)
{
pr.PRnewObj = pr.PRvalue;
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
this.TopObject = pr.PRnewObj;
}
else
{
this.stack.Pop();
this.RegisterObject(pr.PRnewObj, pr, (ParseRecord) this.stack.Peek());
}
}
}
else
{
this.CheckSerializable(pr.PRdtType);
if (this.IsRemoting && (this.formatterEnums.FEsecurityLevel != TypeFilterLevel.Full))
{
pr.PRnewObj = FormatterServices.GetSafeUninitializedObject(pr.PRdtType);
}
else
{
pr.PRnewObj = FormatterServices.GetUninitializedObject(pr.PRdtType);
}
this.m_objectManager.RaiseOnDeserializingEvent(pr.PRnewObj);
if (pr.PRnewObj == null)
{
throw new SerializationException(Environment.GetResourceString("Serialization_TopObjectInstantiate", new object[] { pr.PRdtType }));
}
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
this.TopObject = pr.PRnewObj;
}
if (pr.PRobjectInfo == null)
{
pr.PRobjectInfo = ReadObjectInfo.Create(pr.PRdtType, this.m_surrogates, this.m_context, this.m_objectManager, this.serObjectInfoInit, this.m_formatterConverter, this.bSimpleAssembly);
}
this.CheckSecurity(pr);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:65,代码来源:ObjectReader.cs
示例5: ParseMemberEnd
private void ParseMemberEnd(ParseRecord pr)
{
switch (pr.PRmemberTypeEnum)
{
case InternalMemberTypeE.Field:
if (pr.PRmemberValueEnum != InternalMemberValueE.Nested)
{
break;
}
this.ParseObjectEnd(pr);
return;
case InternalMemberTypeE.Item:
this.ParseArrayMemberEnd(pr);
return;
default:
this.ParseError(pr, (ParseRecord) this.stack.Peek());
break;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:21,代码来源:ObjectReader.cs
示例6: ParseError
private void ParseError(ParseRecord processing, ParseRecord onStack)
{
throw new SerializationException(Environment.GetResourceString("Serialization_ParseError", new object[] { string.Concat(new object[] { onStack.PRname, " ", onStack.PRparseTypeEnum, " ", processing.PRname, " ", processing.PRparseTypeEnum }) }));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:ObjectReader.cs
示例7: ParseArrayMember
private void ParseArrayMember(ParseRecord pr)
{
ParseRecord record = (ParseRecord) this.stack.Peek();
if (record.PRarrayTypeEnum == InternalArrayTypeE.Rectangular)
{
if (record.PRmemberIndex > 0)
{
this.NextRectangleMap(record);
}
if (record.PRisLowerBound)
{
for (int i = 0; i < record.PRrank; i++)
{
record.PRindexMap[i] = record.PRrectangularMap[i] + record.PRlowerBoundA[i];
}
}
}
else if (!record.PRisLowerBound)
{
record.PRindexMap[0] = record.PRmemberIndex;
}
else
{
record.PRindexMap[0] = record.PRlowerBoundA[0] + record.PRmemberIndex;
}
if (pr.PRmemberValueEnum == InternalMemberValueE.Reference)
{
object obj2 = this.m_objectManager.GetObject(pr.PRidRef);
if (obj2 == null)
{
int[] destinationArray = new int[record.PRrank];
Array.Copy(record.PRindexMap, 0, destinationArray, 0, record.PRrank);
this.m_objectManager.RecordArrayElementFixup(record.PRobjectId, destinationArray, pr.PRidRef);
}
else if (record.PRobjectA != null)
{
record.PRobjectA[record.PRindexMap[0]] = obj2;
}
else
{
((Array) record.PRnewObj).SetValue(obj2, record.PRindexMap);
}
}
else if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
{
if (pr.PRdtType == null)
{
pr.PRdtType = record.PRarrayElementType;
}
this.ParseObject(pr);
this.stack.Push(pr);
if (record.PRarrayElementType != null)
{
if (record.PRarrayElementType.IsValueType && (pr.PRarrayElementTypeCode == InternalPrimitiveTypeE.Invalid))
{
pr.PRisValueTypeFixup = true;
this.ValueFixupStack.Push(new ValueFixup((Array) record.PRnewObj, record.PRindexMap));
}
else if (record.PRobjectA != null)
{
record.PRobjectA[record.PRindexMap[0]] = pr.PRnewObj;
}
else
{
((Array) record.PRnewObj).SetValue(pr.PRnewObj, record.PRindexMap);
}
}
}
else if (pr.PRmemberValueEnum == InternalMemberValueE.InlineValue)
{
if (object.ReferenceEquals(record.PRarrayElementType, Converter.typeofString) || object.ReferenceEquals(pr.PRdtType, Converter.typeofString))
{
this.ParseString(pr, record);
if (record.PRobjectA != null)
{
record.PRobjectA[record.PRindexMap[0]] = pr.PRvalue;
}
else
{
((Array) record.PRnewObj).SetValue(pr.PRvalue, record.PRindexMap);
}
}
else if (record.PRisArrayVariant)
{
if (pr.PRkeyDt == null)
{
throw new SerializationException(Environment.GetResourceString("Serialization_ArrayTypeObject"));
}
object pRvalue = null;
if (object.ReferenceEquals(pr.PRdtType, Converter.typeofString))
{
this.ParseString(pr, record);
pRvalue = pr.PRvalue;
}
else if (object.ReferenceEquals(pr.PRdtTypeCode, InternalPrimitiveTypeE.Invalid))
{
this.CheckSerializable(pr.PRdtType);
if (this.IsRemoting && (this.formatterEnums.FEsecurityLevel != TypeFilterLevel.Full))
{
pRvalue = FormatterServices.GetSafeUninitializedObject(pr.PRdtType);
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:ObjectReader.cs
示例8: Parse
internal void Parse(ParseRecord pr)
{
switch (pr.PRparseTypeEnum)
{
case InternalParseTypeE.SerializedStreamHeader:
this.ParseSerializedStreamHeader(pr);
return;
case InternalParseTypeE.Object:
this.ParseObject(pr);
return;
case InternalParseTypeE.Member:
this.ParseMember(pr);
return;
case InternalParseTypeE.ObjectEnd:
this.ParseObjectEnd(pr);
return;
case InternalParseTypeE.MemberEnd:
this.ParseMemberEnd(pr);
return;
case InternalParseTypeE.SerializedStreamHeaderEnd:
this.ParseSerializedStreamHeaderEnd(pr);
return;
case InternalParseTypeE.Envelope:
case InternalParseTypeE.EnvelopeEnd:
case InternalParseTypeE.Body:
case InternalParseTypeE.BodyEnd:
return;
}
throw new SerializationException(Environment.GetResourceString("Serialization_XMLElement", new object[] { pr.PRname }));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:36,代码来源:ObjectReader.cs
示例9: 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
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:binaryobjectreader.cs
示例10: NextRectangleMap
// Builds a map for each item in an incoming rectangle array. The map specifies where the item is placed in the output Array Object
private void NextRectangleMap(ParseRecord pr)
{
// For each invocation, calculate the next rectangular array position
// example
// indexMap 0 [0,0,0]
// indexMap 1 [0,0,1]
// indexMap 2 [0,0,2]
// indexMap 3 [0,0,3]
// indexMap 4 [0,1,0]
for (int irank = pr.PRrank-1; irank>-1; irank--)
{
// Find the current or lower dimension which can be incremented.
if (pr.PRrectangularMap[irank] < pr.PRlengthA[irank]-1)
{
// The current dimension is at maximum. Increase the next lower dimension by 1
pr.PRrectangularMap[irank]++;
if (irank < pr.PRrank-1)
{
// The current dimension and higher dimensions are zeroed.
for (int i = irank+1; i<pr.PRrank; i++)
pr.PRrectangularMap[i] = 0;
}
Array.Copy(pr.PRrectangularMap, pr.PRindexMap, pr.PRrank);
break;
}
}
}
开发者ID:ArildF,项目名称:masters,代码行数:30,代码来源:binaryobjectreader.cs
示例11: ParseArray
// Array object encountered in stream
private void ParseArray(ParseRecord pr)
{
SerTrace.Log( this, "ParseArray Entry");
long genId = pr.PRobjectId;
if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
{
SerTrace.Log( this, "ParseArray bin.base64 ",pr.PRvalue.Length," ",pr.PRvalue);
// ByteArray
if (pr.PRvalue.Length > 0)
pr.PRnewObj = Convert.FromBase64String(pr.PRvalue);
else
pr.PRnewObj = new Byte[0];
if (stack.Peek() == pr)
{
SerTrace.Log( this, "ParseArray, bin.base64 has been stacked");
stack.Pop();
}
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
topObject = pr.PRnewObj;
ParseRecord parentPr = (ParseRecord)stack.Peek();
// Base64 can be registered at this point because it is populated
SerTrace.Log( this, "ParseArray RegisterObject ",pr.PRobjectId," ",pr.PRnewObj.GetType());
RegisterObject(pr.PRnewObj, pr, parentPr);
}
else if ((pr.PRnewObj != null) && Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode))
{
// Primtive typed Array has already been read
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
topObject = pr.PRnewObj;
ParseRecord parentPr = (ParseRecord)stack.Peek();
// Primitive typed array can be registered at this point because it is populated
SerTrace.Log( this, "ParseArray RegisterObject ",pr.PRobjectId," ",pr.PRnewObj.GetType());
RegisterObject(pr.PRnewObj, pr, parentPr);
}
else if ((pr.PRarrayTypeEnum == InternalArrayTypeE.Jagged) || (pr.PRarrayTypeEnum == InternalArrayTypeE.Single))
{
// Multidimensional jagged array or single array
SerTrace.Log( this, "ParseArray Before Jagged,Simple create ",pr.PRarrayElementType," ",pr.PRlengthA[0]);
bool bCouldBeValueType = true;
if ((pr.PRlowerBoundA == null) || (pr.PRlowerBoundA[0] == 0))
{
if (pr.PRarrayElementType == Converter.typeofString)
{
pr.PRobjectA = new String[pr.PRlengthA[0]];
pr.PRnewObj = pr.PRobjectA;
bCouldBeValueType = false;
}
else if (pr.PRarrayElementType == Converter.typeofObject)
{
pr.PRobjectA = new Object[pr.PRlengthA[0]];
pr.PRnewObj = pr.PRobjectA;
bCouldBeValueType = false;
}
else
pr.PRnewObj = Array.CreateInstance(pr.PRarrayElementType, pr.PRlengthA[0]);
pr.PRisLowerBound = false;
}
else
{
pr.PRnewObj = Array.CreateInstance(pr.PRarrayElementType, pr.PRlengthA, pr.PRlowerBoundA);
pr.PRisLowerBound = true;
}
if (pr.PRarrayTypeEnum == InternalArrayTypeE.Single)
{
if (!pr.PRisLowerBound && (Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode)))
{
pr.PRprimitiveArray = new PrimitiveArray(pr.PRarrayElementTypeCode, (Array)pr.PRnewObj);
}
else if (bCouldBeValueType)
{
if (!pr.PRarrayElementType.IsValueType)
pr.PRobjectA = (Object[])pr.PRnewObj;
}
}
SerTrace.Log( this, "ParseArray Jagged,Simple Array ",pr.PRnewObj.GetType());
// For binary, headers comes in as an array of header objects
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Headers)
{
SerTrace.Log( this, "ParseArray header array");
headers = (Header[])pr.PRnewObj;
}
pr.PRindexMap = new int[1];
}
else if (pr.PRarrayTypeEnum == InternalArrayTypeE.Rectangular)
{
// Rectangle array
//.........这里部分代码省略.........
开发者ID:ArildF,项目名称:masters,代码行数:101,代码来源:binaryobjectreader.cs
示例12: 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);
}
开发者ID:ArildF,项目名称:masters,代码行数:71,代码来源:binaryobjectreader.cs
示例13: ParseObject
// New object encountered in stream
private void ParseObject(ParseRecord pr)
{
SerTrace.Log( this, "ParseObject Entry ");
if (!bFullDeserialization)
InitFullDeserialization();
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
topId = pr.PRobjectId;
if (pr.PRparseTypeEnum == InternalParseTypeE.Object)
{
stack.Push(pr); // Nested objects member names are already on stack
}
if (pr.PRobjectTypeEnum == InternalObjectTypeE.Array)
{
ParseArray(pr);
SerTrace.Log( this, "ParseObject Exit, ParseArray ");
return;
}
if (pr.PRdtType == null)
throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_TopObjectInstantiate"),pr.PRname));
if (pr.PRdtType == Converter.typeofString)
{
// String as a top level object
if (pr.PRvalue != null)
{
pr.PRnewObj = pr.PRvalue;
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
SerTrace.Log( this, "ParseObject String as top level, Top Object Resolved");
isTopObjectResolved = true;
topObject = pr.PRnewObj;
//stack.Pop();
return;
}
else
{
SerTrace.Log( this, "ParseObject String as an object");
stack.Pop();
RegisterObject(pr.PRnewObj, pr, (ParseRecord)stack.Peek());
return;
}
}
else
{
// xml Doesn't have the value until later
return;
}
}
else {
pr.PRnewObj = FormatterServices.GetUninitializedObject(pr.PRdtType);
}
if (pr.PRnewObj == null)
throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_TopObjectInstantiate"),pr.PRdtType));
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
isTopObjectResolved = true;
topObject = pr.PRnewObj;
}
if (pr.PRobjectInfo == null)
pr.PRobjectInfo = ReadObjectInfo.Create(pr.PRdtType, m_surrogates, m_context, m_objectManager, serObjectInfoInit, m_formatterConverter, bSimpleAssembly);
CheckSecurity(pr);
SerTrace.Log( this, "ParseObject Exit ");
}
开发者ID:ArildF,项目名称:masters,代码行数:73,代码来源:binaryobjectreader.cs
示例14: CheckSecurity
internal void CheckSecurity(ParseRecord pr)
{
InternalST.SoapAssert(pr!=null, "[BinaryObjectReader.CheckSecurity]pr!=null");
Type t = pr.PRdtType;
if (t != null && IsRemoting){
if (typeof(MarshalByRefObject).IsAssignableFrom(t))
throw new ArgumentException(String.Format(Environment.GetResourceString("Serialization_MBRAsMBV"), t.FullName));
}
//If we passed the security check, they can do whatever they'd like,
//so we'll just short-circuit this.
if (deserializationSecurityException==null) {
return;
}
// BaseTypes and Array of basetypes allowed
if (t != null)
{
if (t.IsPrimitive || t == Converter.typeofString)
return;
if (typeof(Enum).IsAssignableFrom(t))
return;
if (t.IsArray)
{
Type type = t.GetElementType();
if (type.IsPrimitive || type == Converter.typeofString)
return;
}
}
throw deserializationSecurityException;
}
开发者ID:ArildF,项目名称:masters,代码行数:36,代码来源:binaryobjectreader.cs
示例15: ParseSerializedStreamHeaderEnd
// Parse the SerializedStreamHeader end element. This is the last element in the stream if present
private void ParseSerializedStreamHeaderEnd(ParseRecord pr)
{
SerTrace.Log( this, "SerializedHeaderEnd ",pr);
stack.Pop();
}
开发者ID:ArildF,项目名称:masters,代码行数:6,代码来源:binaryobjectreader.cs
示例16: RegisterObject
private void RegisterObject(object obj, ParseRecord pr, ParseRecord objectPr, bool bIsString)
{
if (!pr.PRisRegistered)
{
pr.PRisRegistered = true;
SerializationInfo pRsi = null;
long idOfContainingObj = 0L;
MemberInfo member = null;
int[] arrayIndex = null;
if (objectPr != null)
{
arrayIndex = objectPr.PRindexMap;
idOfContainingObj = objectPr.PRobjectId;
if ((objectPr.PRobjectInfo != null) && !objectPr.PRobjectInfo.isSi)
{
member = objectPr.PRobjectInfo.GetMemberInfo(pr.PRname);
}
}
pRsi = pr.PRsi;
if (bIsString)
{
this.m_objectManager.RegisterString((string) obj, pr.PRobjectId, pRsi, idOfContainingObj, member);
}
else
{
this.m_objectManager.RegisterObject(obj, pr.PRobjectId, pRsi, idOfContainingObj, member, arrayIndex);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:ObjectReader.cs
示例17: NextRectangleMap
private void NextRectangleMap(ParseRecord pr)
{
for (int i = pr.PRrank - 1; i > -1; i--)
{
if (pr.PRrectangularMap[i] < (pr.PRlengthA[i] - 1))
{
pr.PRrectangularMap[i]++;
if (i < (pr.PRrank - 1))
{
for (int j = i + 1; j < pr.PRrank; j++)
{
pr.PRrectangularMap[j] = 0;
}
}
Array.Copy(pr.PRrectangularMap, pr.PRindexMap, pr.PRrank);
return;
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:ObjectReader.cs
示例18: ParseArrayMemberEnd
private void ParseArrayMemberEnd(ParseRecord pr)
{
SerTrace.Log( this, "ParseArrayMemberEnd");
// If this is a nested array object, then pop the stack
if (pr.PRmemberValueEnum == InternalMemberValueE.Nested)
{
ParseObjectEnd(pr);
}
}
开发者ID:ArildF,项目名称:masters,代码行数:9,代码来源:binaryobjectreader.cs
示例19: ParseArray
private void ParseArray(ParseRecord pr)
{
long pRobjectId = pr.PRobjectId;
if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
{
if (pr.PRvalue.Length > 0)
{
pr.PRnewObj = Convert.FromBase64String(pr.PRvalue);
}
else
{
pr.PRnewObj = new byte[0];
}
if (this.stack.Peek() == pr)
{
this.stack.Pop();
}
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
this.TopObject = pr.PRnewObj;
}
ParseRecord objectPr = (ParseRecord) this.stack.Peek();
this.RegisterObject(pr.PRnewObj, pr, objectPr);
}
else if ((pr.PRnewObj != null) && Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode))
{
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
{
this.TopObject = pr.PRnewObj;
}
ParseRecord record2 = (ParseRecord) this.stack.Peek();
this.RegisterObject(pr.PRnewObj, pr, record2);
}
else if ((pr.PRarrayTypeEnum == InternalArrayTypeE.Jagged) || (pr.PRarrayTypeEnum == InternalArrayTypeE.Single))
{
bool flag = true;
if ((pr.PRlowerBoundA == null) || (pr.PRlowerBoundA[0] == 0))
{
if (object.ReferenceEquals(pr.PRarrayElementType, Converter.typeofString))
{
pr.PRobjectA = new string[pr.PRlengthA[0]];
pr.PRnewObj = pr.PRobjectA;
flag = false;
}
else if (object.ReferenceEquals(pr.PRarrayElementType, Converter.typeofObject))
{
pr.PRobjectA = new object[pr.PRlengthA[0]];
pr.PRnewObj = pr.PRobjectA;
flag = false;
}
else if (pr.PRarrayElementType != null)
{
pr.PRnewObj = Array.UnsafeCreateInstance(pr.PRarrayElementType, pr.PRlengthA[0]);
}
pr.PRisLowerBound = false;
}
else
{
if (pr.PRarrayElementType != null)
{
pr.PRnewObj = Array.UnsafeCreateInstance(pr.PRarrayElementType, pr.PRlengthA, pr.PRlowerBoundA);
}
pr.PRisLowerBound = true;
}
if (pr.PRarrayTypeEnum == InternalArrayTypeE.Single)
{
if (!pr.PRisLowerBound && Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode))
{
pr.PRprimitiveArray = new PrimitiveArray(pr.PRarrayElementTypeCode, (Array) pr.PRnewObj);
}
else if ((flag && (pr.PRarrayElementType != null)) && (!pr.PRarrayElementType.IsValueType && !pr.PRisLowerBound))
{
pr.PRobjectA = (object[]) pr.PRnewObj;
}
}
if (pr.PRobjectPositionEnum == InternalObjectPositionE.Headers)
{
this.headers = (Header[]) pr.PRnewObj;
}
pr.PRindexMap = new int[1];
}
else
{
if (pr.PRarrayTypeEnum != InternalArrayTypeE.Rectangular)
{
throw new SerializationException(Environment.GetResourceString("Serialization_ArrayType", new object[] { pr.PRarrayTypeEnum }));
}
pr.PRisLowerBound = false;
if (pr.PRlowerBoundA != null)
{
for (int j = 0; j < pr.PRrank; j++)
{
if (pr.PRlowerBoundA[j] != 0)
{
pr.PRisLowerBound = true;
}
}
}
if (pr.PRarrayElementType != null)
{
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:ObjectReader.cs
|
请发表评论