private void PutOp(ObjectProgress op) { if (_opPool == null) { _opPool = new SerStack("opPool"); } _opPool.Push(op); }
private void PutNameInfo(NameInfo nameInfo) => _niPool.Push(nameInfo);
// Parse the SerializedStreamHeader element. This is the first element in the stream if present private void ParseSerializedStreamHeader(ParseRecord pr) => _stack.Push(pr);
private void ReadObject() { if (_binaryObject == null) { _binaryObject = new BinaryObject(); } _binaryObject.Read(this); ObjectMap objectMap = (ObjectMap)ObjectMapIdTable[_binaryObject._mapId]; if (objectMap == null) { throw new SerializationException(SR.Format(SR.Serialization_Map, _binaryObject._mapId)); } ObjectProgress op = GetOp(); ParseRecord pr = op._pr; _stack.Push(op); op._objectTypeEnum = InternalObjectTypeE.Object; op._binaryTypeEnumA = objectMap._binaryTypeEnumA; op._memberNames = objectMap._memberNames; op._memberTypes = objectMap._memberTypes; op._typeInformationA = objectMap._typeInformationA; op._memberLength = op._binaryTypeEnumA.Length; ObjectProgress objectOp = (ObjectProgress)_stack.PeekPeek(); if ((objectOp == null) || (objectOp._isInitial)) { // Non-Nested Object op._name = objectMap._objectName; pr._parseTypeEnum = InternalParseTypeE.Object; op._memberValueEnum = InternalMemberValueE.Empty; } else { // Nested Object pr._parseTypeEnum = InternalParseTypeE.Member; pr._memberValueEnum = InternalMemberValueE.Nested; op._memberValueEnum = InternalMemberValueE.Nested; switch (objectOp._objectTypeEnum) { case InternalObjectTypeE.Object: pr._name = objectOp._name; pr._memberTypeEnum = InternalMemberTypeE.Field; op._memberTypeEnum = InternalMemberTypeE.Field; break; case InternalObjectTypeE.Array: pr._memberTypeEnum = InternalMemberTypeE.Item; op._memberTypeEnum = InternalMemberTypeE.Item; break; default: throw new SerializationException(SR.Format(SR.Serialization_Map, objectOp._objectTypeEnum.ToString())); } } pr._objectId = _objectReader.GetId(_binaryObject._objectId); pr._objectInfo = objectMap.CreateObjectInfo(ref pr._si, ref pr._memberData); if (pr._objectId == _topId) { pr._objectPositionEnum = InternalObjectPositionE.Top; } pr._objectTypeEnum = InternalObjectTypeE.Object; pr._keyDt = objectMap._objectName; pr._dtType = objectMap._objectType; pr._dtTypeCode = InternalPrimitiveTypeE.Invalid; _objectReader.Parse(pr); }
private void ReadObject() { SerTrace.Log(this, "ReadObject"); if (binaryObject == null) { binaryObject = new BinaryObject(); } binaryObject.Read(this); binaryObject.Dump(); ObjectMap objectMap = (ObjectMap)ObjectMapIdTable[binaryObject.mapId]; if (objectMap == null) { throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_Map"), binaryObject.mapId)); } ObjectProgress op = GetOp(); ParseRecord pr = op.pr; stack.Push(op); op.objectTypeEnum = InternalObjectTypeE.Object; op.binaryTypeEnumA = objectMap.binaryTypeEnumA; op.memberNames = objectMap.memberNames; op.memberTypes = objectMap.memberTypes; op.typeInformationA = objectMap.typeInformationA; op.memberLength = op.binaryTypeEnumA.Length; ObjectProgress objectOp = (ObjectProgress)stack.PeekPeek(); if ((objectOp == null) || (objectOp.isInitial)) { // Non-Nested Object SerTrace.Log(this, "ReadObject non-nested "); op.name = objectMap.objectName; pr.PRparseTypeEnum = InternalParseTypeE.Object; op.memberValueEnum = InternalMemberValueE.Empty; } else { // Nested Object SerTrace.Log(this, "ReadObject nested "); pr.PRparseTypeEnum = InternalParseTypeE.Member; pr.PRmemberValueEnum = InternalMemberValueE.Nested; op.memberValueEnum = InternalMemberValueE.Nested; switch (objectOp.objectTypeEnum) { case InternalObjectTypeE.Object: pr.PRname = objectOp.name; pr.PRmemberTypeEnum = InternalMemberTypeE.Field; op.memberTypeEnum = InternalMemberTypeE.Field; break; case InternalObjectTypeE.Array: pr.PRmemberTypeEnum = InternalMemberTypeE.Item; op.memberTypeEnum = InternalMemberTypeE.Item; break; default: throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_Map"), ((Enum)objectOp.objectTypeEnum).ToString())); } } pr.PRobjectId = objectReader.GetId((long)binaryObject.objectId); SerTrace.Log(this, "ReadObject binaryObject.objectId ", pr.PRobjectId); pr.PRobjectInfo = objectMap.CreateObjectInfo(ref pr.PRsi, ref pr.PRmemberData); if (pr.PRobjectId == topId) { pr.PRobjectPositionEnum = InternalObjectPositionE.Top; } pr.PRobjectTypeEnum = InternalObjectTypeE.Object; pr.PRkeyDt = objectMap.objectName; pr.PRdtType = objectMap.objectType; pr.PRdtTypeCode = InternalPrimitiveTypeE.Invalid; objectReader.Parse(pr); }