示例#1
0
        // End of object encountered in stream
        private void ParseObjectEnd(ParseRecord pr)
        {
            ParseRecord objectPr = (ParseRecord)_stack.Peek() ?? pr;

            if (objectPr._objectPositionEnum == InternalObjectPositionE.Top)
            {
                if (ReferenceEquals(objectPr._dtType, Converter.s_typeofString))
                {
                    objectPr._newObj = objectPr._value;
                    TopObject        = objectPr._newObj;
                    return;
                }
            }

            _stack.Pop();
            ParseRecord parentPr = (ParseRecord)_stack.Peek();

            if (objectPr._newObj == null)
            {
                return;
            }

            if (objectPr._objectTypeEnum == InternalObjectTypeE.Array)
            {
                if (objectPr._objectPositionEnum == InternalObjectPositionE.Top)
                {
                    TopObject = objectPr._newObj;
                }

                RegisterObject(objectPr._newObj, objectPr, parentPr);
                return;
            }

            objectPr._objectInfo.PopulateObjectMembers(objectPr._newObj, objectPr._memberData);

            // Registration is after object is populated
            if ((!objectPr._isRegistered) && (objectPr._objectId > 0))
            {
                RegisterObject(objectPr._newObj, objectPr, parentPr);
            }

            if (objectPr._isValueTypeFixup)
            {
                ValueFixup fixup = (ValueFixup)ValueFixupStack.Pop(); //Value fixup
                fixup.Fixup(objectPr, parentPr);                      // Value fixup
            }

            if (objectPr._objectPositionEnum == InternalObjectPositionE.Top)
            {
                TopObject = objectPr._newObj;
            }

            objectPr._objectInfo.ObjectEnd();
        }
示例#2
0
        private void ParseObjectEnd(ParseRecord pr)
        {
            ParseRecord parseRecord = (ParseRecord)this.stack.Peek();

            if (parseRecord == null)
            {
                parseRecord = pr;
            }
            if (parseRecord.PRobjectPositionEnum == InternalObjectPositionE.Top && parseRecord.PRdtType == Converter.typeofString)
            {
                parseRecord.PRnewObj = parseRecord.PRvalue;
                this.TopObject       = parseRecord.PRnewObj;
                return;
            }
            this.stack.Pop();
            ParseRecord parseRecord2 = (ParseRecord)this.stack.Peek();

            if (parseRecord.PRnewObj == null)
            {
                return;
            }
            if (parseRecord.PRobjectTypeEnum == InternalObjectTypeE.Array)
            {
                if (parseRecord.PRobjectPositionEnum == InternalObjectPositionE.Top)
                {
                    this.TopObject = parseRecord.PRnewObj;
                }
                this.RegisterObject(parseRecord.PRnewObj, parseRecord, parseRecord2);
                return;
            }
            parseRecord.PRobjectInfo.PopulateObjectMembers(parseRecord.PRnewObj, parseRecord.PRmemberData);
            if (!parseRecord.PRisRegistered && parseRecord.PRobjectId > 0L)
            {
                this.RegisterObject(parseRecord.PRnewObj, parseRecord, parseRecord2);
            }
            if (parseRecord.PRisValueTypeFixup)
            {
                ValueFixup valueFixup = (ValueFixup)this.ValueFixupStack.Pop();
                valueFixup.Fixup(parseRecord, parseRecord2);
            }
            if (parseRecord.PRobjectPositionEnum == InternalObjectPositionE.Top)
            {
                this.TopObject = parseRecord.PRnewObj;
            }
            parseRecord.PRobjectInfo.ObjectEnd();
        }