Create() static private method

static private Create ( Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly ) : ReadObjectInfo
objectType System.Type
surrogateSelector ISurrogateSelector
context System.Runtime.Serialization.StreamingContext
objectManager System.Runtime.Serialization.ObjectManager
serObjectInfoInit SerObjectInfoInit
converter IFormatterConverter
bSimpleAssembly bool
return ReadObjectInfo
示例#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
        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);
        }
示例#3
0
 internal ReadObjectInfo CreateReadObjectInfo(Type objectType)
 {
     return(ReadObjectInfo.Create(objectType, _surrogates, _context, _objectManager, _serObjectInfoInit, _formatterConverter, _isSimpleAssembly));
 }
示例#4
0
 internal ReadObjectInfo CreateReadObjectInfo(Type objectType, string[] memberNames, Type[] memberTypes)
 {
     return(ReadObjectInfo.Create(objectType, memberNames, memberTypes, _surrogates, _context, _objectManager, _serObjectInfoInit, _formatterConverter, _isSimpleAssembly));
 }
示例#5
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);
     }
 }
示例#6
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));
 }