public Read ( |
||
input | ||
Результат | void |
private void ReadObjectString(BinaryHeaderEnum binaryHeaderEnum) { if (_objectString == null) { _objectString = new BinaryObjectString(); } if (binaryHeaderEnum == BinaryHeaderEnum.ObjectString) { _objectString.Read(this); } else { if (_crossAppDomainString == null) { _crossAppDomainString = new BinaryCrossAppDomainString(); } _crossAppDomainString.Read(this); _objectString._value = _objectReader.CrossAppDomainArray(_crossAppDomainString._value) as string; if (_objectString._value == null) { throw new SerializationException(SR.Format(SR.Serialization_CrossAppDomainError, "String", _crossAppDomainString._value)); } _objectString._objectId = _crossAppDomainString._objectId; } PRs.Init(); PRs._parseTypeEnum = InternalParseTypeE.Object; PRs._objectId = _objectReader.GetId(_objectString._objectId); if (PRs._objectId == _topId) { PRs._objectPositionEnum = InternalObjectPositionE.Top; } PRs._objectTypeEnum = InternalObjectTypeE.Object; ObjectProgress objectOp = (ObjectProgress)_stack.Peek(); PRs._value = _objectString._value; PRs._keyDt = "System.String"; PRs._dtType = Converter.s_typeofString; PRs._dtTypeCode = InternalPrimitiveTypeE.Invalid; PRs._varValue = _objectString._value; //Need to set it because ObjectReader is picking up value from variant, not pr.PRvalue if (objectOp == null) { // Top level String PRs._parseTypeEnum = InternalParseTypeE.Object; PRs._name = "System.String"; } else { // Nested in an Object PRs._parseTypeEnum = InternalParseTypeE.Member; PRs._memberValueEnum = InternalMemberValueE.InlineValue; switch (objectOp._objectTypeEnum) { case InternalObjectTypeE.Object: PRs._name = objectOp._name; PRs._memberTypeEnum = InternalMemberTypeE.Field; break; case InternalObjectTypeE.Array: PRs._memberTypeEnum = InternalMemberTypeE.Item; break; default: throw new SerializationException(SR.Format(SR.Serialization_ObjectTypeEnum, objectOp._objectTypeEnum.ToString())); } } _objectReader.Parse(PRs); }
private void ReadObjectString(BinaryHeaderEnum binaryHeaderEnum) { SerTrace.Log(this, "ReadObjectString"); if (objectString == null) { objectString = new BinaryObjectString(); } if (binaryHeaderEnum == BinaryHeaderEnum.ObjectString) { objectString.Read(this); objectString.Dump(); } else { if (crossAppDomainString == null) { crossAppDomainString = new BinaryCrossAppDomainString(); } crossAppDomainString.Read(this); crossAppDomainString.Dump(); objectString.value = objectReader.CrossAppDomainArray(crossAppDomainString.value) as String; if (objectString.value == null) { throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_CrossAppDomainError"), "String", crossAppDomainString.value)); } objectString.objectId = crossAppDomainString.objectId; } prs.Init(); prs.PRparseTypeEnum = InternalParseTypeE.Object; prs.PRobjectId = objectReader.GetId(objectString.objectId); if (prs.PRobjectId == topId) { prs.PRobjectPositionEnum = InternalObjectPositionE.Top; } prs.PRobjectTypeEnum = InternalObjectTypeE.Object; ObjectProgress objectOp = (ObjectProgress)stack.Peek(); prs.PRvalue = objectString.value; prs.PRkeyDt = "System.String"; prs.PRdtType = Converter.typeofString; prs.PRdtTypeCode = InternalPrimitiveTypeE.Invalid; prs.PRvarValue = objectString.value; //Need to set it because ObjectReader is picking up value from variant, not pr.PRvalue if (objectOp == null) { // Top level String SerTrace.Log(this, "ReadObjectString, Non-Nested"); prs.PRparseTypeEnum = InternalParseTypeE.Object; prs.PRname = "System.String"; } else { // Nested in an Object SerTrace.Log(this, "ReadObjectString, Nested"); prs.PRparseTypeEnum = InternalParseTypeE.Member; prs.PRmemberValueEnum = InternalMemberValueE.InlineValue; switch (objectOp.objectTypeEnum) { case InternalObjectTypeE.Object: prs.PRname = objectOp.name; prs.PRmemberTypeEnum = InternalMemberTypeE.Field; break; case InternalObjectTypeE.Array: prs.PRmemberTypeEnum = InternalMemberTypeE.Item; break; default: throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_ObjectTypeEnum"), ((Enum)objectOp.objectTypeEnum).ToString())); } } objectReader.Parse(prs); }