Read() public method

public Read ( __BinaryParser input ) : void
input __BinaryParser
return void
        [System.Security.SecurityCritical]  // auto-generated
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;
            SerTrace.Log( this, "ReadArray ");
            BinaryArray record = new BinaryArray(binaryHeaderEnum);
            record.Read(this);
#if _DEBUG                        
            record.Dump();

            SerTrace.Log( this, "Read 1 ",((Enum)binaryHeaderEnum).ToString());
#endif
            if (record.binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (record.assemId < 1)
                    throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId",record.typeInformation));

                assemblyInfo = (BinaryAssemblyInfo)AssemIdToAssemblyTable[record.assemId];
                SerTrace.Log( this, "ReadArray  lookup assemIdToAssembly assemId ",record.assemId," assembly ",assemblyInfo.assemblyString);                                
            }
            else
                assemblyInfo = SystemAssemblyInfo; //Urt assembly

            ObjectProgress op = GetOp();
            ParseRecord pr = op.pr;

            op.objectTypeEnum = InternalObjectTypeE.Array;
            op.binaryTypeEnum = record.binaryTypeEnum;
            op.typeInformation = record.typeInformation;

            ObjectProgress objectOp = (ObjectProgress)stack.PeekPeek();
            if ((objectOp == null) || (record.objectId > 0))
            {
                // Non-Nested Object
                op.name = "System.Array";
                pr.PRparseTypeEnum = InternalParseTypeE.Object;
                op.memberValueEnum = InternalMemberValueE.Empty;                                    
            }
            else
            {
                // Nested Object            
                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;                  
                    pr.PRkeyDt = objectOp.name;
                    pr.PRdtType = objectOp.dtType;
                    break;
                case InternalObjectTypeE.Array:
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                    op.memberTypeEnum = InternalMemberTypeE.Item;                   
                    break;
                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_ObjectTypeEnum",((Enum)objectOp.objectTypeEnum).ToString()));                                              
                }
            }


            pr.PRobjectId = objectReader.GetId((long)record.objectId);
            if (pr.PRobjectId == topId)
                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
            else if ((headerId > 0) &&(pr.PRobjectId == headerId))
                pr.PRobjectPositionEnum = InternalObjectPositionE.Headers; // Headers are an array of header objects
            else
                pr.PRobjectPositionEnum    = InternalObjectPositionE.Child;

            pr.PRobjectTypeEnum = InternalObjectTypeE.Array;

            BinaryConverter.TypeFromInfo(record.binaryTypeEnum, record.typeInformation, objectReader, assemblyInfo,
                                         out pr.PRarrayElementTypeCode, out pr.PRarrayElementTypeString,
                                         out pr.PRarrayElementType, out pr.PRisArrayVariant);

            pr.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;


            pr.PRrank = record.rank;
            pr.PRlengthA = record.lengthA;
            pr.PRlowerBoundA = record.lowerBoundA;
            bool isPrimitiveArray = false;

            switch (record.binaryArrayTypeEnum)
            {
            case BinaryArrayTypeEnum.Single:
            case BinaryArrayTypeEnum.SingleOffset:                  
                op.numItems = record.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Single;
                if (Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode) &&
                    (record.lowerBoundA[0] == 0))
                {
                    isPrimitiveArray = true;
                    ReadArrayAsBytes(pr);
                }
                break;
            case BinaryArrayTypeEnum.Jagged:
            case BinaryArrayTypeEnum.JaggedOffset:                  
                op.numItems = record.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Jagged;                 
                break;
            case BinaryArrayTypeEnum.Rectangular:
            case BinaryArrayTypeEnum.RectangularOffset:                 
                int arrayLength = 1;
                for (int i=0; i<record.rank; i++)
                    arrayLength = arrayLength*record.lengthA[i];
                op.numItems = arrayLength;
                pr.PRarrayTypeEnum = InternalArrayTypeE.Rectangular;                                        
                break;
            default:
                throw new SerializationException(Environment.GetResourceString("Serialization_ArrayType",((Enum)record.binaryArrayTypeEnum).ToString()));
            }

            if (!isPrimitiveArray)
                stack.Push(op);
            else
            {
                PutOp(op);
            }

            SerTrace.Log( this, "ReadArray ",((Enum)record.binaryArrayTypeEnum).ToString()," length ",op.numItems);             
            objectReader.Parse(pr);

            if (isPrimitiveArray)
            {
                pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                objectReader.Parse(pr);
            }
        }
示例#2
0
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;
            BinaryArray record = new BinaryArray(binaryHeaderEnum);
            record.Read(this);

            if (record._binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (record._assemId < 1)
                {
                    throw new SerializationException(SR.Format(SR.Serialization_AssemblyId, record._typeInformation));
                }
                assemblyInfo = (BinaryAssemblyInfo)AssemIdToAssemblyTable[record._assemId];
            }
            else
            {
                assemblyInfo = SystemAssemblyInfo; //Urt assembly
            }

            ObjectProgress op = GetOp();
            ParseRecord pr = op._pr;

            op._objectTypeEnum = InternalObjectTypeE.Array;
            op._binaryTypeEnum = record._binaryTypeEnum;
            op._typeInformation = record._typeInformation;

            ObjectProgress objectOp = (ObjectProgress)_stack.PeekPeek();
            if ((objectOp == null) || (record._objectId > 0))
            {
                // Non-Nested Object
                op._name = "System.Array";
                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;
                        pr._keyDt = objectOp._name;
                        pr._dtType = objectOp._dtType;
                        break;
                    case InternalObjectTypeE.Array:
                        pr._memberTypeEnum = InternalMemberTypeE.Item;
                        op._memberTypeEnum = InternalMemberTypeE.Item;
                        break;
                    default:
                        throw new SerializationException(SR.Format(SR.Serialization_ObjectTypeEnum, objectOp._objectTypeEnum.ToString()));
                }
            }

            pr._objectId = _objectReader.GetId(record._objectId);
            if (pr._objectId == _topId)
            {
                pr._objectPositionEnum = InternalObjectPositionE.Top;
            }
            else if ((_headerId > 0) && (pr._objectId == _headerId))
            {
                pr._objectPositionEnum = InternalObjectPositionE.Headers; // Headers are an array of header objects
            }
            else
            {
                pr._objectPositionEnum = InternalObjectPositionE.Child;
            }

            pr._objectTypeEnum = InternalObjectTypeE.Array;

            BinaryTypeConverter.TypeFromInfo(record._binaryTypeEnum, record._typeInformation, _objectReader, assemblyInfo,
                                         out pr._arrayElementTypeCode, out pr._arrayElementTypeString,
                                         out pr._arrayElementType, out pr._isArrayVariant);

            pr._dtTypeCode = InternalPrimitiveTypeE.Invalid;

            pr._rank = record._rank;
            pr._lengthA = record._lengthA;
            pr._lowerBoundA = record._lowerBoundA;
            bool isPrimitiveArray = false;

            switch (record._binaryArrayTypeEnum)
            {
                case BinaryArrayTypeEnum.Single:
                case BinaryArrayTypeEnum.SingleOffset:
                    op._numItems = record._lengthA[0];
                    pr._arrayTypeEnum = InternalArrayTypeE.Single;
                    if (Converter.IsWriteAsByteArray(pr._arrayElementTypeCode) &&
                        (record._lowerBoundA[0] == 0))
                    {
                        isPrimitiveArray = true;
                        ReadArrayAsBytes(pr);
                    }
                    break;
                case BinaryArrayTypeEnum.Jagged:
                case BinaryArrayTypeEnum.JaggedOffset:
                    op._numItems = record._lengthA[0];
                    pr._arrayTypeEnum = InternalArrayTypeE.Jagged;
                    break;
                case BinaryArrayTypeEnum.Rectangular:
                case BinaryArrayTypeEnum.RectangularOffset:
                    int arrayLength = 1;
                    for (int i = 0; i < record._rank; i++)
                        arrayLength = arrayLength * record._lengthA[i];
                    op._numItems = arrayLength;
                    pr._arrayTypeEnum = InternalArrayTypeE.Rectangular;
                    break;
                default:
                    throw new SerializationException(SR.Format(SR.Serialization_ArrayType, record._binaryArrayTypeEnum.ToString()));
            }

            if (!isPrimitiveArray)
            {
                _stack.Push(op);
            }
            else
            {
                PutOp(op);
            }

            _objectReader.Parse(pr);

            if (isPrimitiveArray)
            {
                pr._parseTypeEnum = InternalParseTypeE.ObjectEnd;
                _objectReader.Parse(pr);
            }
        }
示例#3
0
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;
            BinaryArray        record       = new BinaryArray(binaryHeaderEnum);

            record.Read(this);

            if (record._binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (record._assemId < 1)
                {
                    throw new SerializationException(SR.Format(SR.Serialization_AssemblyId, record._typeInformation));
                }
                assemblyInfo = (BinaryAssemblyInfo)AssemIdToAssemblyTable[record._assemId];
            }
            else
            {
                assemblyInfo = SystemAssemblyInfo; //Urt assembly
            }

            ObjectProgress op = GetOp();
            ParseRecord    pr = op._pr;

            op._objectTypeEnum  = InternalObjectTypeE.Array;
            op._binaryTypeEnum  = record._binaryTypeEnum;
            op._typeInformation = record._typeInformation;

            ObjectProgress objectOp = (ObjectProgress)_stack.PeekPeek();

            if ((objectOp == null) || (record._objectId > 0))
            {
                // Non-Nested Object
                op._name            = "System.Array";
                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;
                    pr._keyDt          = objectOp._name;
                    pr._dtType         = objectOp._dtType;
                    break;

                case InternalObjectTypeE.Array:
                    pr._memberTypeEnum = InternalMemberTypeE.Item;
                    op._memberTypeEnum = InternalMemberTypeE.Item;
                    break;

                default:
                    throw new SerializationException(SR.Format(SR.Serialization_ObjectTypeEnum, objectOp._objectTypeEnum.ToString()));
                }
            }

            pr._objectId = _objectReader.GetId(record._objectId);
            if (pr._objectId == _topId)
            {
                pr._objectPositionEnum = InternalObjectPositionE.Top;
            }
            else if ((_headerId > 0) && (pr._objectId == _headerId))
            {
                pr._objectPositionEnum = InternalObjectPositionE.Headers; // Headers are an array of header objects
            }
            else
            {
                pr._objectPositionEnum = InternalObjectPositionE.Child;
            }

            pr._objectTypeEnum = InternalObjectTypeE.Array;

            BinaryTypeConverter.TypeFromInfo(record._binaryTypeEnum, record._typeInformation, _objectReader, assemblyInfo,
                                             out pr._arrayElementTypeCode, out pr._arrayElementTypeString,
                                             out pr._arrayElementType, out pr._isArrayVariant);

            pr._dtTypeCode = InternalPrimitiveTypeE.Invalid;

            pr._rank        = record._rank;
            pr._lengthA     = record._lengthA;
            pr._lowerBoundA = record._lowerBoundA;
            bool isPrimitiveArray = false;

            switch (record._binaryArrayTypeEnum)
            {
            case BinaryArrayTypeEnum.Single:
            case BinaryArrayTypeEnum.SingleOffset:
                op._numItems      = record._lengthA[0];
                pr._arrayTypeEnum = InternalArrayTypeE.Single;
                if (Converter.IsWriteAsByteArray(pr._arrayElementTypeCode) &&
                    (record._lowerBoundA[0] == 0))
                {
                    isPrimitiveArray = true;
                    ReadArrayAsBytes(pr);
                }
                break;

            case BinaryArrayTypeEnum.Jagged:
            case BinaryArrayTypeEnum.JaggedOffset:
                op._numItems      = record._lengthA[0];
                pr._arrayTypeEnum = InternalArrayTypeE.Jagged;
                break;

            case BinaryArrayTypeEnum.Rectangular:
            case BinaryArrayTypeEnum.RectangularOffset:
                int arrayLength = 1;
                for (int i = 0; i < record._rank; i++)
                {
                    arrayLength = arrayLength * record._lengthA[i];
                }
                op._numItems      = arrayLength;
                pr._arrayTypeEnum = InternalArrayTypeE.Rectangular;
                break;

            default:
                throw new SerializationException(SR.Format(SR.Serialization_ArrayType, record._binaryArrayTypeEnum.ToString()));
            }

            if (!isPrimitiveArray)
            {
                _stack.Push(op);
            }
            else
            {
                PutOp(op);
            }

            _objectReader.Parse(pr);

            if (isPrimitiveArray)
            {
                pr._parseTypeEnum = InternalParseTypeE.ObjectEnd;
                _objectReader.Parse(pr);
            }
        }
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;
            BinaryArray array = new BinaryArray(binaryHeaderEnum);
            array.Read(this);
            if (array.binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (array.assemId < 1)
                {
                    throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId", new object[] { array.typeInformation }));
                }
                assemblyInfo = (BinaryAssemblyInfo) this.AssemIdToAssemblyTable[array.assemId];
            }
            else
            {
                assemblyInfo = this.SystemAssemblyInfo;
            }
            ObjectProgress op = this.GetOp();
            ParseRecord pr = op.pr;
            op.objectTypeEnum = InternalObjectTypeE.Array;
            op.binaryTypeEnum = array.binaryTypeEnum;
            op.typeInformation = array.typeInformation;
            ObjectProgress progress2 = (ObjectProgress) this.stack.PeekPeek();
            if ((progress2 == null) || (array.objectId > 0))
            {
                op.name = "System.Array";
                pr.PRparseTypeEnum = InternalParseTypeE.Object;
                op.memberValueEnum = InternalMemberValueE.Empty;
            }
            else
            {
                pr.PRparseTypeEnum = InternalParseTypeE.Member;
                pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                op.memberValueEnum = InternalMemberValueE.Nested;
                switch (progress2.objectTypeEnum)
                {
                    case InternalObjectTypeE.Object:
                        pr.PRname = progress2.name;
                        pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
                        op.memberTypeEnum = InternalMemberTypeE.Field;
                        pr.PRkeyDt = progress2.name;
                        pr.PRdtType = progress2.dtType;
                        goto Label_0177;

                    case InternalObjectTypeE.Array:
                        pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                        op.memberTypeEnum = InternalMemberTypeE.Item;
                        goto Label_0177;
                }
                throw new SerializationException(Environment.GetResourceString("Serialization_ObjectTypeEnum", new object[] { progress2.objectTypeEnum.ToString() }));
            }
        Label_0177:
            pr.PRobjectId = this.objectReader.GetId((long) array.objectId);
            if (pr.PRobjectId == this.topId)
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
            }
            else if ((this.headerId > 0L) && (pr.PRobjectId == this.headerId))
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Headers;
            }
            else
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Child;
            }
            pr.PRobjectTypeEnum = InternalObjectTypeE.Array;
            BinaryConverter.TypeFromInfo(array.binaryTypeEnum, array.typeInformation, this.objectReader, assemblyInfo, out pr.PRarrayElementTypeCode, out pr.PRarrayElementTypeString, out pr.PRarrayElementType, out pr.PRisArrayVariant);
            pr.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
            pr.PRrank = array.rank;
            pr.PRlengthA = array.lengthA;
            pr.PRlowerBoundA = array.lowerBoundA;
            bool flag = false;
            switch (array.binaryArrayTypeEnum)
            {
                case BinaryArrayTypeEnum.Single:
                case BinaryArrayTypeEnum.SingleOffset:
                    op.numItems = array.lengthA[0];
                    pr.PRarrayTypeEnum = InternalArrayTypeE.Single;
                    if (Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode) && (array.lowerBoundA[0] == 0))
                    {
                        flag = true;
                        this.ReadArrayAsBytes(pr);
                    }
                    break;

                case BinaryArrayTypeEnum.Jagged:
                case BinaryArrayTypeEnum.JaggedOffset:
                    op.numItems = array.lengthA[0];
                    pr.PRarrayTypeEnum = InternalArrayTypeE.Jagged;
                    break;

                case BinaryArrayTypeEnum.Rectangular:
                case BinaryArrayTypeEnum.RectangularOffset:
                {
                    int num = 1;
                    for (int i = 0; i < array.rank; i++)
                    {
                        num *= array.lengthA[i];
                    }
                    op.numItems = num;
                    pr.PRarrayTypeEnum = InternalArrayTypeE.Rectangular;
                    break;
                }
                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_ArrayType", new object[] { array.binaryArrayTypeEnum.ToString() }));
            }
            if (!flag)
            {
                this.stack.Push(op);
            }
            else
            {
                this.PutOp(op);
            }
            this.objectReader.Parse(pr);
            if (flag)
            {
                pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                this.objectReader.Parse(pr);
            }
        }
示例#5
0
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryArray binaryArray = new BinaryArray(binaryHeaderEnum);

            binaryArray.Read(this);
            BinaryAssemblyInfo assemblyInfo;

            if (binaryArray.binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (binaryArray.assemId < 1)
                {
                    throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId", binaryArray.typeInformation));
                }
                assemblyInfo = (BinaryAssemblyInfo)this.AssemIdToAssemblyTable[binaryArray.assemId];
            }
            else
            {
                assemblyInfo = this.SystemAssemblyInfo;
            }
            ObjectProgress op = this.GetOp();
            ParseRecord    pr = op.pr;

            op.objectTypeEnum  = InternalObjectTypeE.Array;
            op.binaryTypeEnum  = binaryArray.binaryTypeEnum;
            op.typeInformation = binaryArray.typeInformation;
            ObjectProgress objectProgress = (ObjectProgress)this.stack.PeekPeek();

            if (objectProgress == null || binaryArray.objectId > 0)
            {
                op.name            = "System.Array";
                pr.PRparseTypeEnum = InternalParseTypeE.Object;
                op.memberValueEnum = InternalMemberValueE.Empty;
            }
            else
            {
                pr.PRparseTypeEnum   = InternalParseTypeE.Member;
                pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                op.memberValueEnum   = InternalMemberValueE.Nested;
                switch (objectProgress.objectTypeEnum)
                {
                case InternalObjectTypeE.Object:
                    pr.PRname           = objectProgress.name;
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
                    op.memberTypeEnum   = InternalMemberTypeE.Field;
                    pr.PRkeyDt          = objectProgress.name;
                    pr.PRdtType         = objectProgress.dtType;
                    break;

                case InternalObjectTypeE.Array:
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                    op.memberTypeEnum   = InternalMemberTypeE.Item;
                    break;

                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_ObjectTypeEnum", (object)objectProgress.objectTypeEnum.ToString()));
                }
            }
            pr.PRobjectId           = this.objectReader.GetId((long)binaryArray.objectId);
            pr.PRobjectPositionEnum = pr.PRobjectId != this.topId ? (this.headerId <= 0L || pr.PRobjectId != this.headerId ? InternalObjectPositionE.Child : InternalObjectPositionE.Headers) : InternalObjectPositionE.Top;
            pr.PRobjectTypeEnum     = InternalObjectTypeE.Array;
            BinaryConverter.TypeFromInfo(binaryArray.binaryTypeEnum, binaryArray.typeInformation, this.objectReader, assemblyInfo, out pr.PRarrayElementTypeCode, out pr.PRarrayElementTypeString, out pr.PRarrayElementType, out pr.PRisArrayVariant);
            pr.PRdtTypeCode  = InternalPrimitiveTypeE.Invalid;
            pr.PRrank        = binaryArray.rank;
            pr.PRlengthA     = binaryArray.lengthA;
            pr.PRlowerBoundA = binaryArray.lowerBoundA;
            bool flag = false;

            switch (binaryArray.binaryArrayTypeEnum)
            {
            case BinaryArrayTypeEnum.Single:
            case BinaryArrayTypeEnum.SingleOffset:
                op.numItems        = binaryArray.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Single;
                if (Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode) && binaryArray.lowerBoundA[0] == 0)
                {
                    flag = true;
                    this.ReadArrayAsBytes(pr);
                    break;
                }
                break;

            case BinaryArrayTypeEnum.Jagged:
            case BinaryArrayTypeEnum.JaggedOffset:
                op.numItems        = binaryArray.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Jagged;
                break;

            case BinaryArrayTypeEnum.Rectangular:
            case BinaryArrayTypeEnum.RectangularOffset:
                int num = 1;
                for (int index = 0; index < binaryArray.rank; ++index)
                {
                    num *= binaryArray.lengthA[index];
                }
                op.numItems        = num;
                pr.PRarrayTypeEnum = InternalArrayTypeE.Rectangular;
                break;

            default:
                throw new SerializationException(Environment.GetResourceString("Serialization_ArrayType", (object)binaryArray.binaryArrayTypeEnum.ToString()));
            }
            if (!flag)
            {
                this.stack.Push((object)op);
            }
            else
            {
                this.PutOp(op);
            }
            this.objectReader.Parse(pr);
            if (!flag)
            {
                return;
            }
            pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
            this.objectReader.Parse(pr);
        }
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;
            BinaryArray        array        = new BinaryArray(binaryHeaderEnum);

            array.Read(this);
            if (array.binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (array.assemId < 1)
                {
                    throw new SerializationException(Environment.GetResourceString("Serialization_AssemblyId", new object[] { array.typeInformation }));
                }
                assemblyInfo = (BinaryAssemblyInfo)this.AssemIdToAssemblyTable[array.assemId];
            }
            else
            {
                assemblyInfo = this.SystemAssemblyInfo;
            }
            ObjectProgress op = this.GetOp();
            ParseRecord    pr = op.pr;

            op.objectTypeEnum  = InternalObjectTypeE.Array;
            op.binaryTypeEnum  = array.binaryTypeEnum;
            op.typeInformation = array.typeInformation;
            ObjectProgress progress2 = (ObjectProgress)this.stack.PeekPeek();

            if ((progress2 == null) || (array.objectId > 0))
            {
                op.name            = "System.Array";
                pr.PRparseTypeEnum = InternalParseTypeE.Object;
                op.memberValueEnum = InternalMemberValueE.Empty;
            }
            else
            {
                pr.PRparseTypeEnum   = InternalParseTypeE.Member;
                pr.PRmemberValueEnum = InternalMemberValueE.Nested;
                op.memberValueEnum   = InternalMemberValueE.Nested;
                switch (progress2.objectTypeEnum)
                {
                case InternalObjectTypeE.Object:
                    pr.PRname           = progress2.name;
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Field;
                    op.memberTypeEnum   = InternalMemberTypeE.Field;
                    pr.PRkeyDt          = progress2.name;
                    pr.PRdtType         = progress2.dtType;
                    goto Label_0177;

                case InternalObjectTypeE.Array:
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                    op.memberTypeEnum   = InternalMemberTypeE.Item;
                    goto Label_0177;
                }
                throw new SerializationException(Environment.GetResourceString("Serialization_ObjectTypeEnum", new object[] { progress2.objectTypeEnum.ToString() }));
            }
Label_0177:
            pr.PRobjectId = this.objectReader.GetId((long)array.objectId);
            if (pr.PRobjectId == this.topId)
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
            }
            else if ((this.headerId > 0L) && (pr.PRobjectId == this.headerId))
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Headers;
            }
            else
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Child;
            }
            pr.PRobjectTypeEnum = InternalObjectTypeE.Array;
            BinaryConverter.TypeFromInfo(array.binaryTypeEnum, array.typeInformation, this.objectReader, assemblyInfo, out pr.PRarrayElementTypeCode, out pr.PRarrayElementTypeString, out pr.PRarrayElementType, out pr.PRisArrayVariant);
            pr.PRdtTypeCode  = InternalPrimitiveTypeE.Invalid;
            pr.PRrank        = array.rank;
            pr.PRlengthA     = array.lengthA;
            pr.PRlowerBoundA = array.lowerBoundA;
            bool flag = false;

            switch (array.binaryArrayTypeEnum)
            {
            case BinaryArrayTypeEnum.Single:
            case BinaryArrayTypeEnum.SingleOffset:
                op.numItems        = array.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Single;
                if (Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode) && (array.lowerBoundA[0] == 0))
                {
                    flag = true;
                    this.ReadArrayAsBytes(pr);
                }
                break;

            case BinaryArrayTypeEnum.Jagged:
            case BinaryArrayTypeEnum.JaggedOffset:
                op.numItems        = array.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Jagged;
                break;

            case BinaryArrayTypeEnum.Rectangular:
            case BinaryArrayTypeEnum.RectangularOffset:
            {
                int num = 1;
                for (int i = 0; i < array.rank; i++)
                {
                    num *= array.lengthA[i];
                }
                op.numItems        = num;
                pr.PRarrayTypeEnum = InternalArrayTypeE.Rectangular;
                break;
            }

            default:
                throw new SerializationException(Environment.GetResourceString("Serialization_ArrayType", new object[] { array.binaryArrayTypeEnum.ToString() }));
            }
            if (!flag)
            {
                this.stack.Push(op);
            }
            else
            {
                this.PutOp(op);
            }
            this.objectReader.Parse(pr);
            if (flag)
            {
                pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                this.objectReader.Parse(pr);
            }
        }
        private void ReadArray(BinaryHeaderEnum binaryHeaderEnum)
        {
            BinaryAssemblyInfo assemblyInfo = null;

            SerTrace.Log(this, "ReadArray ");
            BinaryArray record = new BinaryArray(binaryHeaderEnum);

            record.Read(this);
            record.Dump();

            SerTrace.Log(this, "Read 1 ", ((Enum)binaryHeaderEnum).ToString());

            if (record.binaryTypeEnum == BinaryTypeEnum.ObjectUser)
            {
                if (record.assemId < 1)
                {
                    throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_AssemblyId"), record.typeInformation));
                }

                assemblyInfo = (BinaryAssemblyInfo)AssemIdToAssemblyTable[record.assemId];
                SerTrace.Log(this, "ReadArray  lookup assemIdToAssembly assemId ", record.assemId, " assembly ", assemblyInfo.assemblyString);
            }
            else
            {
                assemblyInfo = SystemAssemblyInfo;                 //Urt assembly
            }
            ObjectProgress op = GetOp();
            ParseRecord    pr = op.pr;

            op.objectTypeEnum  = InternalObjectTypeE.Array;
            op.binaryTypeEnum  = record.binaryTypeEnum;
            op.typeInformation = record.typeInformation;

            ObjectProgress objectOp = (ObjectProgress)stack.PeekPeek();

            if ((objectOp == null) || (record.objectId > 0))
            {
                // Non-Nested Object
                op.name            = "System.Array";
                pr.PRparseTypeEnum = InternalParseTypeE.Object;
                op.memberValueEnum = InternalMemberValueE.Empty;
            }
            else
            {
                // Nested Object
                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;
                    pr.PRkeyDt          = objectOp.name;
                    pr.PRdtType         = objectOp.dtType;
                    break;

                case InternalObjectTypeE.Array:
                    pr.PRmemberTypeEnum = InternalMemberTypeE.Item;
                    op.memberTypeEnum   = InternalMemberTypeE.Item;
                    break;

                default:
                    throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_ObjectTypeEnum"), ((Enum)objectOp.objectTypeEnum).ToString()));
                }
            }


            pr.PRobjectId = objectReader.GetId((long)record.objectId);
            if (pr.PRobjectId == topId)
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Top;
            }
            else if ((headerId > 0) && (pr.PRobjectId == headerId))
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Headers;                 // Headers are an array of header objects
            }
            else
            {
                pr.PRobjectPositionEnum = InternalObjectPositionE.Child;
            }

            pr.PRobjectTypeEnum = InternalObjectTypeE.Array;

            BinaryConverter.TypeFromInfo(record.binaryTypeEnum, record.typeInformation, objectReader, assemblyInfo,
                                         out pr.PRarrayElementTypeCode, out pr.PRarrayElementTypeString,
                                         out pr.PRarrayElementType, out pr.PRisArrayVariant);

            pr.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;


            pr.PRrank        = record.rank;
            pr.PRlengthA     = record.lengthA;
            pr.PRlowerBoundA = record.lowerBoundA;
            bool isPrimitiveArray = false;

            switch (record.binaryArrayTypeEnum)
            {
            case BinaryArrayTypeEnum.Single:
            case BinaryArrayTypeEnum.SingleOffset:
                op.numItems        = record.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Single;
                if (Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode) &&
                    (record.lowerBoundA[0] == 0))
                {
                    isPrimitiveArray = true;
                    ReadArrayAsBytes(pr);
                }
                break;

            case BinaryArrayTypeEnum.Jagged:
            case BinaryArrayTypeEnum.JaggedOffset:
                op.numItems        = record.lengthA[0];
                pr.PRarrayTypeEnum = InternalArrayTypeE.Jagged;
                break;

            case BinaryArrayTypeEnum.Rectangular:
            case BinaryArrayTypeEnum.RectangularOffset:
                int arrayLength = 1;
                for (int i = 0; i < record.rank; i++)
                {
                    arrayLength = arrayLength * record.lengthA[i];
                }
                op.numItems        = arrayLength;
                pr.PRarrayTypeEnum = InternalArrayTypeE.Rectangular;
                break;

            default:
                throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_ArrayType"), ((Enum)record.binaryArrayTypeEnum).ToString()));
            }

            if (!isPrimitiveArray)
            {
                stack.Push(op);
            }
            else
            {
                PutOp(op);
            }

            SerTrace.Log(this, "ReadArray ", ((Enum)record.binaryArrayTypeEnum).ToString(), " length ", op.numItems);
            objectReader.Parse(pr);

            if (isPrimitiveArray)
            {
                pr.PRparseTypeEnum = InternalParseTypeE.ObjectEnd;
                objectReader.Parse(pr);
            }
        }