コード例 #1
0
 internal ReadObjectInfo CreateReadObjectInfo(
     [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type?objectType,
     string[] memberNames,
     Type[]?memberTypes)
 {
     return(ReadObjectInfo.Create(objectType, memberNames, memberTypes, _surrogates, _context, _objectManager, _serObjectInfoInit, _formatterConverter, _isSimpleAssembly));
 }
コード例 #2
0
 internal ValueFixup(object memberObject, string memberName, ReadObjectInfo objectInfo)
 {
     this.valueFixupEnum = ValueFixupEnum.Member;
     this.memberObject = memberObject;
     this.memberName = memberName;
     this.objectInfo = objectInfo;
 }
コード例 #3
0
 internal ObjectMap(string objectName, string[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, object[] typeInformationA, int[] memberAssemIds, ObjectReader objectReader, int objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
 {
     this.objectName       = objectName;
     this.memberNames      = memberNames;
     this.binaryTypeEnumA  = binaryTypeEnumA;
     this.typeInformationA = typeInformationA;
     this.objectReader     = objectReader;
     this.objectId         = objectId;
     this.assemblyInfo     = assemblyInfo;
     if (assemblyInfo == null)
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_Assembly", (object)objectName));
     }
     this.objectType  = objectReader.GetType(assemblyInfo, objectName);
     this.memberTypes = new Type[memberNames.Length];
     for (int index = 0; index < memberNames.Length; ++index)
     {
         InternalPrimitiveTypeE primitiveTypeEnum;
         string typeString;
         Type   type;
         bool   isVariant;
         BinaryConverter.TypeFromInfo(binaryTypeEnumA[index], typeInformationA[index], objectReader, (BinaryAssemblyInfo)assemIdToAssemblyTable[memberAssemIds[index]], out primitiveTypeEnum, out typeString, out type, out isVariant);
         this.memberTypes[index] = type;
     }
     this.objectInfo = objectReader.CreateReadObjectInfo(this.objectType, memberNames, (Type[])null);
     if (this.objectInfo.isSi)
     {
         return;
     }
     this.objectInfo.GetMemberTypes(memberNames, this.objectInfo.objectType);
 }
コード例 #4
0
ファイル: BinaryObjectInfo.cs プロジェクト: rsumner31/corefx2
        internal static ReadObjectInfo Create(Type objectType, string[] memberNames, Type[] memberTypes, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly)
        {
            ReadObjectInfo roi = GetObjectInfo(serObjectInfoInit);

            roi.Init(objectType, memberNames, memberTypes, surrogateSelector, context, objectManager, serObjectInfoInit, converter, bSimpleAssembly);
            return(roi);
        }
コード例 #5
0
ファイル: ObjectMap.cs プロジェクト: z77ma/runtime
        internal ObjectMap(string objectName, string[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, object?[] typeInformationA, int[] memberAssemIds, ObjectReader objectReader, int objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
        {
            _objectName       = objectName;
            _memberNames      = memberNames;
            _binaryTypeEnumA  = binaryTypeEnumA;
            _typeInformationA = typeInformationA;
            _objectReader     = objectReader;
            _objectId         = objectId;
            _assemblyInfo     = assemblyInfo;

            if (assemblyInfo == null)
            {
                throw new SerializationException(SR.Format(SR.Serialization_Assembly, objectName));
            }

            _objectType  = objectReader.GetType(assemblyInfo, objectName);
            _memberTypes = new Type[memberNames.Length];

            for (int i = 0; i < memberNames.Length; i++)
            {
                BinaryTypeConverter.TypeFromInfo(
                    binaryTypeEnumA[i], typeInformationA[i], objectReader, (BinaryAssemblyInfo?)assemIdToAssemblyTable[memberAssemIds[i]],
                    out _, out _, out Type? type, out _);
                _memberTypes[i] = type;
            }

            _objectInfo = objectReader.CreateReadObjectInfo(_objectType, memberNames, null);
            if (!_objectInfo._isSi)
            {
                _objectInfo.GetMemberTypes(memberNames, _objectInfo._objectType);  // Check version match
            }
        }
コード例 #6
0
ファイル: BinaryUtilClasses.cs プロジェクト: jnm2/corefx
        // 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;
        }
コード例 #7
0
ファイル: ObjectMap.cs プロジェクト: z77ma/runtime
        internal ObjectMap(
            string objectName,
            [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType,
            string[] memberNames,
            ObjectReader objectReader,
            int objectId,
            BinaryAssemblyInfo assemblyInfo)
        {
            _objectName   = objectName;
            _objectType   = objectType;
            _memberNames  = memberNames;
            _objectReader = objectReader;
            _objectId     = objectId;
            _assemblyInfo = assemblyInfo;

            _objectInfo  = objectReader.CreateReadObjectInfo(objectType);
            _memberTypes = _objectInfo.GetMemberTypes(memberNames, objectType) !;

            _binaryTypeEnumA  = new BinaryTypeEnum[_memberTypes.Length];
            _typeInformationA = new object[_memberTypes.Length];

            for (int i = 0; i < _memberTypes.Length; i++)
            {
                BinaryTypeEnum binaryTypeEnum = BinaryTypeConverter.GetParserBinaryTypeInfo(_memberTypes[i] !, out object?typeInformation);
                _binaryTypeEnumA[i]  = binaryTypeEnum;
                _typeInformationA[i] = typeInformation;
            }
        }
コード例 #8
0
 internal ObjectMap(string objectName, string[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, object[] typeInformationA, int[] memberAssemIds, ObjectReader objectReader, int objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
 {
     this.isInitObjectInfo = true;
     this.objectName = objectName;
     this.memberNames = memberNames;
     this.binaryTypeEnumA = binaryTypeEnumA;
     this.typeInformationA = typeInformationA;
     this.objectReader = objectReader;
     this.objectId = objectId;
     this.assemblyInfo = assemblyInfo;
     if (assemblyInfo == null)
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_Assembly", new object[] { objectName }));
     }
     this.objectType = objectReader.GetType(assemblyInfo, objectName);
     this.memberTypes = new Type[memberNames.Length];
     for (int i = 0; i < memberNames.Length; i++)
     {
         InternalPrimitiveTypeE ee;
         string str;
         Type type;
         bool flag;
         BinaryConverter.TypeFromInfo(binaryTypeEnumA[i], typeInformationA[i], objectReader, (BinaryAssemblyInfo) assemIdToAssemblyTable[memberAssemIds[i]], out ee, out str, out type, out flag);
         this.memberTypes[i] = type;
     }
     this.objectInfo = objectReader.CreateReadObjectInfo(this.objectType, memberNames, null);
     if (!this.objectInfo.isSi)
     {
         this.objectInfo.GetMemberTypes(memberNames, this.objectInfo.objectType);
     }
 }
コード例 #9
0
        internal static ReadObjectInfo Create(Type objectType, ISurrogateSelector?surrogateSelector, StreamingContext context, ObjectManager?objectManager, SerObjectInfoInit?serObjectInfoInit, IFormatterConverter?converter, bool bSimpleAssembly)
        {
            ReadObjectInfo roi = GetObjectInfo(serObjectInfoInit);

            roi.Init(objectType, surrogateSelector, context, objectManager, serObjectInfoInit, converter, bSimpleAssembly);
            return(roi);
        }
コード例 #10
0
 internal ObjectMap(string objectName, string[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, object[] typeInformationA, int[] memberAssemIds, ObjectReader objectReader, int objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
 {
     this.isInitObjectInfo = true;
     this.objectName       = objectName;
     this.memberNames      = memberNames;
     this.binaryTypeEnumA  = binaryTypeEnumA;
     this.typeInformationA = typeInformationA;
     this.objectReader     = objectReader;
     this.objectId         = objectId;
     this.assemblyInfo     = assemblyInfo;
     if (assemblyInfo == null)
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_Assembly", new object[] { objectName }));
     }
     this.objectType  = objectReader.GetType(assemblyInfo, objectName);
     this.memberTypes = new Type[memberNames.Length];
     for (int i = 0; i < memberNames.Length; i++)
     {
         InternalPrimitiveTypeE ee;
         string str;
         Type   type;
         bool   flag;
         BinaryConverter.TypeFromInfo(binaryTypeEnumA[i], typeInformationA[i], objectReader, (BinaryAssemblyInfo)assemIdToAssemblyTable[memberAssemIds[i]], out ee, out str, out type, out flag);
         this.memberTypes[i] = type;
     }
     this.objectInfo = objectReader.CreateReadObjectInfo(this.objectType, memberNames, null);
     if (!this.objectInfo.isSi)
     {
         this.objectInfo.GetMemberTypes(memberNames, this.objectInfo.objectType);
     }
 }
コード例 #11
0
 internal ValueFixup(object memberObject, string memberName, ReadObjectInfo objectInfo)
 {
     this.valueFixupEnum = ValueFixupEnum.Member;
     this.memberObject   = memberObject;
     this.memberName     = memberName;
     this.objectInfo     = objectInfo;
 }
コード例 #12
0
ファイル: BinaryUtilClasses.cs プロジェクト: pgovind/runtime
 internal ValueFixup(object?memberObject, string memberName, ReadObjectInfo objectInfo)
 {
     _valueFixupEnum = ValueFixupEnum.Member;
     _memberObject   = memberObject;
     _memberName     = memberName;
     _objectInfo     = objectInfo;
 }
コード例 #13
0
        private static ReadObjectInfo GetObjectInfo(SerObjectInfoInit serObjectInfoInit)
        {
            ReadObjectInfo roi = new ReadObjectInfo();

            roi.objectInfoId = readObjectInfoCounter++;
            return(roi);
        }
コード例 #14
0
        internal static ReadObjectInfo Create(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly)
        {
            ReadObjectInfo objectInfo = ReadObjectInfo.GetObjectInfo(serObjectInfoInit);

            objectInfo.Init(objectType, surrogateSelector, context, objectManager, serObjectInfoInit, converter, bSimpleAssembly);
            return(objectInfo);
        }
コード例 #15
0
ファイル: BinaryObjectInfo.cs プロジェクト: rsumner31/corefx2
        private static ReadObjectInfo GetObjectInfo(SerObjectInfoInit serObjectInfoInit)
        {
            ReadObjectInfo roi = new ReadObjectInfo();

            roi._objectInfoId = Interlocked.Increment(ref _readObjectInfoCounter);
            return(roi);
        }
コード例 #16
0
 internal ValueFixup(Object memberObject, String memberName, ReadObjectInfo objectInfo)
 {
     SerTrace.Log(this, "Member Constructor ", memberObject);
     valueFixupEnum    = ValueFixupEnum.Member;
     this.memberObject = memberObject;
     this.memberName   = memberName;
     this.objectInfo   = objectInfo;
 }
コード例 #17
0
        internal static ReadObjectInfo Create(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly)
        {
            ReadObjectInfo      objectInfo         = ReadObjectInfo.GetObjectInfo(serObjectInfoInit);
            Type                objectType1        = objectType;
            ISurrogateSelector  surrogateSelector1 = surrogateSelector;
            StreamingContext    context1           = context;
            ObjectManager       objectManager1     = objectManager;
            SerObjectInfoInit   serObjectInfoInit1 = serObjectInfoInit;
            IFormatterConverter converter1         = converter;
            int num = bSimpleAssembly ? 1 : 0;

            objectInfo.Init(objectType1, surrogateSelector1, context1, objectManager1, serObjectInfoInit1, converter1, num != 0);
            return(objectInfo);
        }
コード例 #18
0
        internal static ReadObjectInfo Create(
            [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type?objectType,
            string[] memberNames,
            Type[]?memberTypes,
            ISurrogateSelector?surrogateSelector,
            StreamingContext context,
            ObjectManager?objectManager,
            SerObjectInfoInit?serObjectInfoInit,
            IFormatterConverter?converter,
            bool bSimpleAssembly)
        {
            ReadObjectInfo roi = GetObjectInfo(serObjectInfoInit);

            roi.Init(objectType, memberNames, memberTypes, surrogateSelector, context, objectManager, serObjectInfoInit, converter, bSimpleAssembly);
            return(roi);
        }
コード例 #19
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;
 }
コード例 #20
0
 internal ObjectMap(string objectName, Type objectType, string[] memberNames, ObjectReader objectReader, int objectId, BinaryAssemblyInfo assemblyInfo)
 {
     this.isInitObjectInfo = true;
     this.objectName = objectName;
     this.objectType = objectType;
     this.memberNames = memberNames;
     this.objectReader = objectReader;
     this.objectId = objectId;
     this.assemblyInfo = assemblyInfo;
     this.objectInfo = objectReader.CreateReadObjectInfo(objectType);
     this.memberTypes = this.objectInfo.GetMemberTypes(memberNames, objectType);
     this.binaryTypeEnumA = new BinaryTypeEnum[this.memberTypes.Length];
     this.typeInformationA = new object[this.memberTypes.Length];
     for (int i = 0; i < this.memberTypes.Length; i++)
     {
         object typeInformation = null;
         this.binaryTypeEnumA[i] = BinaryConverter.GetParserBinaryTypeInfo(this.memberTypes[i], out typeInformation);
         this.typeInformationA[i] = typeInformation;
     }
 }
コード例 #21
0
 internal ObjectMap(string objectName, Type objectType, string[] memberNames, ObjectReader objectReader, int objectId, BinaryAssemblyInfo assemblyInfo)
 {
     this.isInitObjectInfo = true;
     this.objectName       = objectName;
     this.objectType       = objectType;
     this.memberNames      = memberNames;
     this.objectReader     = objectReader;
     this.objectId         = objectId;
     this.assemblyInfo     = assemblyInfo;
     this.objectInfo       = objectReader.CreateReadObjectInfo(objectType);
     this.memberTypes      = this.objectInfo.GetMemberTypes(memberNames, objectType);
     this.binaryTypeEnumA  = new BinaryTypeEnum[this.memberTypes.Length];
     this.typeInformationA = new object[this.memberTypes.Length];
     for (int i = 0; i < this.memberTypes.Length; i++)
     {
         object typeInformation = null;
         this.binaryTypeEnumA[i]  = BinaryConverter.GetParserBinaryTypeInfo(this.memberTypes[i], out typeInformation);
         this.typeInformationA[i] = typeInformation;
     }
 }
コード例 #22
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; 
        }
コード例 #23
0
        internal ValueFixup(Object memberObject, String memberName, ReadObjectInfo objectInfo) 
        {
#if _DEBUG 
            SerTrace.Log(this, "Member Constructor ",memberObject);
#endif
            valueFixupEnum = ValueFixupEnum.Member;
            this.memberObject = memberObject; 
            this.memberName = memberName;
            this.objectInfo = objectInfo; 
        } 
コード例 #24
0
 internal ReadObjectInfo CreateReadObjectInfo(Type objectType)
 {
     return(ReadObjectInfo.Create(objectType, _surrogates, _context, _objectManager, _serObjectInfoInit, _formatterConverter, _isSimpleAssembly));
 }
コード例 #25
0
 private static ReadObjectInfo GetObjectInfo(SerObjectInfoInit serObjectInfoInit)
 {
     ReadObjectInfo roi =  new ReadObjectInfo();
     roi.objectInfoId = readObjectInfoCounter++;
     return roi;
 }
コード例 #26
0
 internal ReadObjectInfo CreateReadObjectInfo(Type objectType)
 {
     return(ReadObjectInfo.Create(objectType, this.m_surrogates, this.m_context, this.m_objectManager, this.serObjectInfoInit, this.m_formatterConverter, this.bSimpleAssembly));
 }
コード例 #27
0
 private void ParseObject(ParseRecord pr)
 {
     if (!this.bFullDeserialization)
     {
         this.InitFullDeserialization();
     }
     if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
     {
         this.topId = pr.PRobjectId;
     }
     if (pr.PRparseTypeEnum == InternalParseTypeE.Object)
     {
         this.stack.Push(pr);
     }
     if (pr.PRobjectTypeEnum == InternalObjectTypeE.Array)
     {
         this.ParseArray(pr);
     }
     else if (pr.PRdtType == null)
     {
         pr.PRnewObj = new TypeLoadExceptionHolder(pr.PRkeyDt);
     }
     else if (object.ReferenceEquals(pr.PRdtType, Converter.typeofString))
     {
         if (pr.PRvalue != null)
         {
             pr.PRnewObj = pr.PRvalue;
             if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
             {
                 this.TopObject = pr.PRnewObj;
             }
             else
             {
                 this.stack.Pop();
                 this.RegisterObject(pr.PRnewObj, pr, (ParseRecord)this.stack.Peek());
             }
         }
     }
     else
     {
         this.CheckSerializable(pr.PRdtType);
         if (this.IsRemoting && (this.formatterEnums.FEsecurityLevel != TypeFilterLevel.Full))
         {
             pr.PRnewObj = FormatterServices.GetSafeUninitializedObject(pr.PRdtType);
         }
         else
         {
             pr.PRnewObj = FormatterServices.GetUninitializedObject(pr.PRdtType);
         }
         this.m_objectManager.RaiseOnDeserializingEvent(pr.PRnewObj);
         if (pr.PRnewObj == null)
         {
             throw new SerializationException(Environment.GetResourceString("Serialization_TopObjectInstantiate", new object[] { pr.PRdtType }));
         }
         if (pr.PRobjectPositionEnum == InternalObjectPositionE.Top)
         {
             this.TopObject = pr.PRnewObj;
         }
         if (pr.PRobjectInfo == null)
         {
             pr.PRobjectInfo = ReadObjectInfo.Create(pr.PRdtType, this.m_surrogates, this.m_context, this.m_objectManager, this.serObjectInfoInit, this.m_formatterConverter, this.bSimpleAssembly);
         }
         this.CheckSecurity(pr);
     }
 }
コード例 #28
0
        [System.Security.SecurityCritical]  // auto-generated
        internal ObjectMap(String objectName, Type objectType, String[] memberNames, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo)
        {
            SerTrace.Log( this, "Constructor 1 objectName ",objectName, ", objectType ",objectType); 
            this.objectName = objectName;
            this.objectType = objectType; 
            this.memberNames = memberNames; 
            this.objectReader = objectReader;
            this.objectId = objectId; 
            this.assemblyInfo = assemblyInfo;

            objectInfo = objectReader.CreateReadObjectInfo(objectType);
            memberTypes = objectInfo.GetMemberTypes(memberNames, objectType); 

            binaryTypeEnumA = new BinaryTypeEnum[memberTypes.Length]; 
            typeInformationA = new Object[memberTypes.Length]; 

            for (int i=0; i<memberTypes.Length; i++) 
            {
                Object typeInformation = null;
                BinaryTypeEnum binaryTypeEnum = BinaryConverter.GetParserBinaryTypeInfo(memberTypes[i], out typeInformation);
                binaryTypeEnumA[i] = binaryTypeEnum; 
                typeInformationA[i] = typeInformation;
            } 
        } 
コード例 #29
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;
        }
コード例 #30
0
 internal ValueFixup(object memberObject, string memberName, ReadObjectInfo objectInfo)
 {
     _valueFixupEnum = ValueFixupEnum.Member;
     _memberObject = memberObject;
     _memberName = memberName;
     _objectInfo = objectInfo;
 }
コード例 #31
0
 private static ReadObjectInfo GetObjectInfo(SerObjectInfoInit serObjectInfoInit)
 {
     ReadObjectInfo roi =  new ReadObjectInfo();
     roi.objectInfoId = Interlocked.Increment(ref readObjectInfoCounter);
     return roi;
 }
コード例 #32
0
ファイル: BinaryObjectReader.cs プロジェクト: zpk513/corefx
 internal ReadObjectInfo CreateReadObjectInfo(Type objectType, string[] memberNames, Type[] memberTypes)
 {
     return(ReadObjectInfo.Create(objectType, memberNames, memberTypes, _surrogates, _context, _objectManager, _serObjectInfoInit, _formatterConverter, _isSimpleAssembly));
 }
コード例 #33
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;
        }
コード例 #34
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;
 }
コード例 #35
0
        private void ParseObject(ParseRecord pr)
        {
            if (!_fullDeserialization)
            {
                InitFullDeserialization();
            }

            if (pr._objectPositionEnum == InternalObjectPositionE.Top)
            {
                _topId = pr._objectId;
            }

            if (pr._parseTypeEnum == InternalParseTypeE.Object)
            {
                _stack !.Push(pr); // Nested objects member names are already on stack
            }

            if (pr._objectTypeEnum == InternalObjectTypeE.Array)
            {
                ParseArray(pr);
                return;
            }

            // If the Type is null, this means we have a typeload issue
            // mark the object with TypeLoadExceptionHolder
            if (pr._dtType == null)
            {
                pr._newObj = new TypeLoadExceptionHolder(pr._keyDt);
                return;
            }

            if (ReferenceEquals(pr._dtType, Converter.s_typeofString))
            {
                // String as a top level object
                if (pr._value != null)
                {
                    pr._newObj = pr._value;
                    if (pr._objectPositionEnum == InternalObjectPositionE.Top)
                    {
                        TopObject = pr._newObj;
                        return;
                    }
                    else
                    {
                        _stack !.Pop();
                        RegisterObject(pr._newObj, pr, (ParseRecord?)_stack.Peek());
                        return;
                    }
                }
                else
                {
                    // xml Doesn't have the value until later
                    return;
                }
            }
            else
            {
                CheckSerializable(pr._dtType);
                pr._newObj = FormatterServices.GetUninitializedObject(pr._dtType);

                Debug.Assert(_objectManager != null);
                // Run the OnDeserializing methods
                _objectManager.RaiseOnDeserializingEvent(pr._newObj);
            }

            if (pr._newObj == null)
            {
                throw new SerializationException(SR.Format(SR.Serialization_TopObjectInstantiate, pr._dtType));
            }

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

            pr._objectInfo ??= ReadObjectInfo.Create(pr._dtType, _surrogates, _context, _objectManager, _serObjectInfoInit, _formatterConverter, _isSimpleAssembly);
        }
コード例 #36
0
        [System.Security.SecurityCritical]  // auto-generated 
        internal ObjectMap(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, int[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
        {
            SerTrace.Log( this, "Constructor 2 objectName ",objectName);
            this.objectName = objectName; 
            this.memberNames = memberNames;
            this.binaryTypeEnumA = binaryTypeEnumA; 
            this.typeInformationA = typeInformationA; 
            this.objectReader = objectReader;
            this.objectId = objectId; 
            this.assemblyInfo = assemblyInfo;

            if (assemblyInfo == null)
                throw new SerializationException(Environment.GetResourceString("Serialization_Assembly",objectName)); 

            objectType = objectReader.GetType(assemblyInfo, objectName); 
 
            memberTypes = new Type[memberNames.Length];
 
            for (int i=0; i<memberNames.Length; i++)
            {
                InternalPrimitiveTypeE primitiveTypeEnum;
                String typeString; 
                Type type;
                bool isVariant; 
 
                BinaryConverter.TypeFromInfo(binaryTypeEnumA[i], typeInformationA[i], objectReader, (BinaryAssemblyInfo)assemIdToAssemblyTable[memberAssemIds[i]],
                                             out primitiveTypeEnum, out typeString, out type, out isVariant); 
                //if ((object)type == null)
                //    throw new SerializationException(String.Format(Environment.GetResourceString("Serialization_TypeResolved"),objectName+" "+memberNames[i]+" "+typeInformationA[i]));
                memberTypes[i] = type;
            } 

            objectInfo = objectReader.CreateReadObjectInfo(objectType, memberNames, null); 
            if (!objectInfo.isSi) 
                objectInfo.GetMemberTypes(memberNames, objectInfo.objectType);  // Check version match
        }