Пример #1
0
        // Initialize ParseRecord. Called when reusing.
        internal void Init()
        {
            // Enums
            _parseTypeEnum      = InternalParseTypeE.Empty;
            _objectTypeEnum     = InternalObjectTypeE.Empty;
            _arrayTypeEnum      = InternalArrayTypeE.Empty;
            _memberTypeEnum     = InternalMemberTypeE.Empty;
            _memberValueEnum    = InternalMemberValueE.Empty;
            _objectPositionEnum = InternalObjectPositionE.Empty;

            // Object
            _name = null;

            // Value
            _value = null;

            // dt attribute
            _keyDt      = null;
            _dtType     = null;
            _dtTypeCode = InternalPrimitiveTypeE.Invalid;

            // Object ID
            _objectId = 0;

            // Reference ID
            _idRef = 0;

            // Array

            // Array Element Type
            _arrayElementTypeString = null;
            _arrayElementType       = null;
            _isArrayVariant         = false;
            _arrayElementTypeCode   = InternalPrimitiveTypeE.Invalid;

            // Parsed array information
            _rank        = 0;
            _lengthA     = null;
            _lowerBoundA = null;

            // Array map for placing array elements in array
            _indexMap       = null;
            _memberIndex    = 0;
            _linearlength   = 0;
            _rectangularMap = null;
            _isLowerBound   = false;

            // ValueType Fixup needed
            _isValueTypeFixup = false;

            _newObj         = null;
            _objectA        = null;
            _primitiveArray = null;
            _objectInfo     = null;
            _isRegistered   = false;
            _memberData     = null;
            _si             = null;

            _consecutiveNullArrayEntryCount = 0;
        }
 internal void Init()
 {
     this.PRparseTypeEnum      = InternalParseTypeE.Empty;
     this.PRobjectTypeEnum     = InternalObjectTypeE.Empty;
     this.PRarrayTypeEnum      = InternalArrayTypeE.Empty;
     this.PRmemberTypeEnum     = InternalMemberTypeE.Empty;
     this.PRmemberValueEnum    = InternalMemberValueE.Empty;
     this.PRobjectPositionEnum = InternalObjectPositionE.Empty;
     this.PRname                   = null;
     this.PRvalue                  = null;
     this.PRkeyDt                  = null;
     this.PRdtType                 = null;
     this.PRdtTypeCode             = InternalPrimitiveTypeE.Invalid;
     this.PRisEnum                 = false;
     this.PRobjectId               = 0L;
     this.PRidRef                  = 0L;
     this.PRarrayElementTypeString = null;
     this.PRarrayElementType       = null;
     this.PRisArrayVariant         = false;
     this.PRarrayElementTypeCode   = InternalPrimitiveTypeE.Invalid;
     this.PRrank                   = 0;
     this.PRlengthA                = null;
     this.PRpositionA              = null;
     this.PRlowerBoundA            = null;
     this.PRupperBoundA            = null;
     this.PRindexMap               = null;
     this.PRmemberIndex            = 0;
     this.PRlinearlength           = 0;
     this.PRrectangularMap         = null;
     this.PRisLowerBound           = false;
     this.PRtopId                  = 0L;
     this.PRheaderId               = 0L;
     this.PRisValueTypeFixup       = false;
     this.PRnewObj                 = null;
     this.PRobjectA                = null;
     this.PRprimitiveArray         = null;
     this.PRobjectInfo             = null;
     this.PRisRegistered           = false;
     this.PRmemberData             = null;
     this.PRsi        = null;
     this.PRnullCount = 0;
 }
        // Initialize ParseRecord. Called when reusing.
        internal void Init()
        {
            // Enums
            _parseTypeEnum = InternalParseTypeE.Empty;
            _objectTypeEnum = InternalObjectTypeE.Empty;
            _arrayTypeEnum = InternalArrayTypeE.Empty;
            _memberTypeEnum = InternalMemberTypeE.Empty;
            _memberValueEnum = InternalMemberValueE.Empty;
            _objectPositionEnum = InternalObjectPositionE.Empty;

            // Object
            _name = null;

            // Value
            _value = null;

            // dt attribute
            _keyDt = null;
            _dtType = null;
            _dtTypeCode = InternalPrimitiveTypeE.Invalid;

            // Object ID
            _objectId = 0;

            // Reference ID
            _idRef = 0;

            // Array

            // Array Element Type
            _arrayElementTypeString = null;
            _arrayElementType = null;
            _isArrayVariant = false;
            _arrayElementTypeCode = InternalPrimitiveTypeE.Invalid;

            // Parsed array information
            _rank = 0;
            _lengthA = null;
            _lowerBoundA = null;

            // Array map for placing array elements in array
            _indexMap = null;
            _memberIndex = 0;
            _linearlength = 0;
            _rectangularMap = null;
            _isLowerBound = false;

            // ValueType Fixup needed
            _isValueTypeFixup = false;

            _newObj = null;
            _objectA = null;
            _primitiveArray = null;
            _objectInfo = null;
            _isRegistered = false;
            _memberData = null;
            _si = null;

            _consecutiveNullArrayEntryCount = 0;
        }
Пример #4
0
        // Initialize ParseRecord. Called when reusing.
        internal void Init()
        {
            // Enums
            PRparseTypeEnum      = InternalParseTypeE.Empty;
            PRobjectTypeEnum     = InternalObjectTypeE.Empty;
            PRarrayTypeEnum      = InternalArrayTypeE.Empty;
            PRmemberTypeEnum     = InternalMemberTypeE.Empty;
            PRmemberValueEnum    = InternalMemberValueE.Empty;
            PRobjectPositionEnum = InternalObjectPositionE.Empty;

            // Object
            PRname = null;

            // Value
            PRvalue = null;

            // dt attribute
            PRkeyDt      = null;
            PRdtType     = null;
            PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
            PRisEnum     = false;

            // Object ID
            PRobjectId = 0;

            // Reference ID
            PRidRef = 0;

            // Array

            // Array Element Type
            PRarrayElementTypeString = null;
            PRarrayElementType       = null;
            PRisArrayVariant         = false;
            PRarrayElementTypeCode   = InternalPrimitiveTypeE.Invalid;


            // Parsed array information
            PRrank        = 0;
            PRlengthA     = null;
            PRpositionA   = null;
            PRlowerBoundA = null;
            PRupperBoundA = null;

            // Array map for placing array elements in array
            PRindexMap       = null;
            PRmemberIndex    = 0;
            PRlinearlength   = 0;
            PRrectangularMap = null;
            PRisLowerBound   = false;

            // SerializedStreamHeader information
            PRtopId    = 0;
            PRheaderId = 0;

            // ValueType Fixup needed
            PRisValueTypeFixup = false;

            PRnewObj         = null;
            PRobjectA        = null;
            PRprimitiveArray = null;
            PRobjectInfo     = null;
            PRisRegistered   = false;
            PRmemberData     = null;
            PRsi             = null;

            PRnullCount = 0;
        }
        // Initialize ParseRecord. Called when reusing. 
        internal void Init()
        {
            // Enums
            PRparseTypeEnum = InternalParseTypeE.Empty; 
            PRobjectTypeEnum = InternalObjectTypeE.Empty;
            PRarrayTypeEnum = InternalArrayTypeE.Empty; 
            PRmemberTypeEnum = InternalMemberTypeE.Empty; 
            PRmemberValueEnum = InternalMemberValueE.Empty;
            PRobjectPositionEnum = InternalObjectPositionE.Empty; 

            // Object
            PRname = null;
 
            // Value
            PRvalue = null; 
 
            // dt attribute
            PRkeyDt = null; 
            PRdtType = null;
            PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
            PRisEnum = false;
 
            // Object ID
            PRobjectId = 0; 
 
            // Reference ID
            PRidRef = 0; 

            // Array

            // Array Element Type 
            PRarrayElementTypeString = null;
            PRarrayElementType = null; 
            PRisArrayVariant = false; 
            PRarrayElementTypeCode = InternalPrimitiveTypeE.Invalid;
 

            // Parsed array information
            PRrank = 0;
            PRlengthA = null; 
            PRpositionA = null;
            PRlowerBoundA = null; 
            PRupperBoundA = null; 

            // Array map for placing array elements in array 
            PRindexMap = null;
            PRmemberIndex = 0;
            PRlinearlength = 0;
            PRrectangularMap = null; 
            PRisLowerBound = false;
 
            // SerializedStreamHeader information 
            PRtopId = 0;
            PRheaderId = 0; 

            // ValueType Fixup needed
            PRisValueTypeFixup = false;
 
            PRnewObj = null;
            PRobjectA = null; 
            PRprimitiveArray = null; 
            PRobjectInfo = null;
            PRisRegistered = false; 
            PRmemberData = null;
            PRsi = null;

            PRnullCount = 0; 
        }
 internal void Init()
 {
     this.PRparseTypeEnum = InternalParseTypeE.Empty;
     this.PRobjectTypeEnum = InternalObjectTypeE.Empty;
     this.PRarrayTypeEnum = InternalArrayTypeE.Empty;
     this.PRmemberTypeEnum = InternalMemberTypeE.Empty;
     this.PRmemberValueEnum = InternalMemberValueE.Empty;
     this.PRobjectPositionEnum = InternalObjectPositionE.Empty;
     this.PRname = null;
     this.PRvalue = null;
     this.PRkeyDt = null;
     this.PRdtType = null;
     this.PRdtTypeCode = InternalPrimitiveTypeE.Invalid;
     this.PRisEnum = false;
     this.PRobjectId = 0L;
     this.PRidRef = 0L;
     this.PRarrayElementTypeString = null;
     this.PRarrayElementType = null;
     this.PRisArrayVariant = false;
     this.PRarrayElementTypeCode = InternalPrimitiveTypeE.Invalid;
     this.PRrank = 0;
     this.PRlengthA = null;
     this.PRpositionA = null;
     this.PRlowerBoundA = null;
     this.PRupperBoundA = null;
     this.PRindexMap = null;
     this.PRmemberIndex = 0;
     this.PRlinearlength = 0;
     this.PRrectangularMap = null;
     this.PRisLowerBound = false;
     this.PRtopId = 0L;
     this.PRheaderId = 0L;
     this.PRisValueTypeFixup = false;
     this.PRnewObj = null;
     this.PRobjectA = null;
     this.PRprimitiveArray = null;
     this.PRobjectInfo = null;
     this.PRisRegistered = false;
     this.PRmemberData = null;
     this.PRsi = null;
     this.PRnullCount = 0;
 }
Пример #7
0
        private void ParseArray(ParseRecord pr)
        {
            long num1 = pr.PRobjectId;

            if (pr.PRarrayTypeEnum == InternalArrayTypeE.Base64)
            {
                pr.PRnewObj = pr.PRvalue.Length <= 0 ? (object)new byte[0] : (object)Convert.FromBase64String(pr.PRvalue);
                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 objectPr = (ParseRecord)this.stack.Peek();
                this.RegisterObject(pr.PRnewObj, pr, objectPr);
            }
            else if (pr.PRarrayTypeEnum == InternalArrayTypeE.Jagged || pr.PRarrayTypeEnum == InternalArrayTypeE.Single)
            {
                bool flag = true;
                if (pr.PRlowerBoundA == null || pr.PRlowerBoundA[0] == 0)
                {
                    if (pr.PRarrayElementType == Converter.typeofString)
                    {
                        ParseRecord parseRecord1 = pr;
                        string[]    strArray     = new string[parseRecord1.PRlengthA[0]];
                        parseRecord1.PRobjectA = (object[])strArray;
                        ParseRecord parseRecord2 = pr;
                        object[]    objArray     = parseRecord2.PRobjectA;
                        parseRecord2.PRnewObj = (object)objArray;
                        flag = false;
                    }
                    else if (pr.PRarrayElementType == Converter.typeofObject)
                    {
                        ParseRecord parseRecord1 = pr;
                        object[]    objArray1    = new object[parseRecord1.PRlengthA[0]];
                        parseRecord1.PRobjectA = objArray1;
                        ParseRecord parseRecord2 = pr;
                        object[]    objArray2    = parseRecord2.PRobjectA;
                        parseRecord2.PRnewObj = (object)objArray2;
                        flag = false;
                    }
                    else if (pr.PRarrayElementType != null)
                    {
                        pr.PRnewObj = (object)Array.UnsafeCreateInstance(pr.PRarrayElementType, pr.PRlengthA[0]);
                    }
                    pr.PRisLowerBound = false;
                }
                else
                {
                    if (pr.PRarrayElementType != null)
                    {
                        pr.PRnewObj = (object)Array.UnsafeCreateInstance(pr.PRarrayElementType, pr.PRlengthA, pr.PRlowerBoundA);
                    }
                    pr.PRisLowerBound = true;
                }
                if (pr.PRarrayTypeEnum == InternalArrayTypeE.Single)
                {
                    if (!pr.PRisLowerBound && Converter.IsWriteAsByteArray(pr.PRarrayElementTypeCode))
                    {
                        ParseRecord    parseRecord    = pr;
                        PrimitiveArray primitiveArray = new PrimitiveArray(parseRecord.PRarrayElementTypeCode, (Array)pr.PRnewObj);
                        parseRecord.PRprimitiveArray = primitiveArray;
                    }
                    else if (flag && pr.PRarrayElementType != null && (!pr.PRarrayElementType.IsValueType && !pr.PRisLowerBound))
                    {
                        ParseRecord parseRecord = pr;
                        object[]    objArray    = (object[])parseRecord.PRnewObj;
                        parseRecord.PRobjectA = objArray;
                    }
                }
                if (pr.PRobjectPositionEnum == InternalObjectPositionE.Headers)
                {
                    this.headers = (Header[])pr.PRnewObj;
                }
                pr.PRindexMap = new int[1];
            }
            else if (pr.PRarrayTypeEnum == InternalArrayTypeE.Rectangular)
            {
                pr.PRisLowerBound = false;
                if (pr.PRlowerBoundA != null)
                {
                    for (int index = 0; index < pr.PRrank; ++index)
                    {
                        if (pr.PRlowerBoundA[index] != 0)
                        {
                            pr.PRisLowerBound = true;
                        }
                    }
                }
                if (pr.PRarrayElementType != null)
                {
                    pr.PRnewObj = pr.PRisLowerBound ? (object)Array.UnsafeCreateInstance(pr.PRarrayElementType, pr.PRlengthA, pr.PRlowerBoundA) : (object)Array.UnsafeCreateInstance(pr.PRarrayElementType, pr.PRlengthA);
                }
                int num2 = 1;
                for (int index = 0; index < pr.PRrank; ++index)
                {
                    num2 *= pr.PRlengthA[index];
                }
                ParseRecord parseRecord1 = pr;
                int[]       numArray1    = new int[parseRecord1.PRrank];
                parseRecord1.PRindexMap = numArray1;
                ParseRecord parseRecord2 = pr;
                int[]       numArray2    = new int[parseRecord2.PRrank];
                parseRecord2.PRrectangularMap = numArray2;
                pr.PRlinearlength             = num2;
            }
            else
            {
                throw new SerializationException(Environment.GetResourceString("Serialization_ArrayType", (object)pr.PRarrayTypeEnum));
            }
            this.CheckSecurity(pr);
        }