示例#1
0
    protected override object Deserialize(XmlSerializationReader reader)
    {
        var settings = (Settings)base.Deserialize(reader);

        settings.InnerSettings.RemoveAt(0);
        return(settings);
    }
示例#2
0
 public ReferenceFixup(string id, Fixup nestedFixup, object nestedTarget, XmlSerializationReader reader)
 {
     _ID           = id;
     _nestedFixup  = nestedFixup;
     _nestedTarget = nestedTarget;
     _reader       = reader;
 }
        public new object Deserialize(XmlSerializationReader reader)
        {
            var result = base.Deserialize(reader);

            EachWith <OnDeserializedAttribute>(result);
            return(result);
        }
示例#4
0
        public object Deserialize(XmlReader xmlReader, string encodingStyle)
        {
            Debug.Assert(null != _logicalType, "Reflection info not initialized before calling Serialize");

            try
            {
                // Initialize the parser
                bool soap12;
                XmlSerializationReader serialReader = initXmlSerializationReader(xmlReader, encodingStyle, out soap12);
                xmlReader.MoveToContent();

                // Get the correct deserializing type
                LogicalType deserializingType = resolveDeserializingType(xmlReader, serialReader, soap12);

                // Deserialize the element
                object deserializedObject;
                if (_isEncoded && (isNullableWithStructValue(deserializingType) || isComplexObjectValue(deserializingType)))
                {
                    Type instType = deserializingType.IsNullableType ?
                                    deserializingType.NullableValueType.Type :
                                    deserializingType.Type;

                    object fixupTarget = SerializationHelper.CreateInstance(instType);
                    serialReader.DeserializeElement(deserializingType.Members, fixupTarget);
                    serialReader.runFixups();

                    deserializedObject = fixupTarget;
                }
                else
                {
                    ObjectFixup fixup = new ObjectFixup(deserializingType);
                    serialReader.DeserializeElement(deserializingType.TypeAccessor, fixup);
                    serialReader.runFixups();
                    deserializedObject = fixup.Object;
                }

                serialReader.CheckUnreferencedObjects(deserializedObject);
                return(deserializedObject);
            }
            catch (Exception e)
            {
                if (e is TargetInvocationException)
                {
                    e = e.InnerException;
                }

#if !FEATURE_LEGACYNETCF
                if (xmlReader is XmlTextReader)
                {
                    XmlTextReader XmlTextReader = (XmlTextReader)xmlReader;
                    throw new InvalidOperationException(SR.Format(SR.XmlSerializeErrorDetails, XmlTextReader.LineNumber.ToString(NumberFormatInfo.InvariantInfo), XmlTextReader.LinePosition.ToString(NumberFormatInfo.InvariantInfo)), e);
                }
                else
#endif
                {
                    throw new InvalidOperationException(SR.XmlSerializeError, e);
                }
            }
        }
示例#5
0
        protected override object Deserialize(XmlSerializationReader reader)
        {
            object target = base.Deserialize(reader);

            //Do the post member conversion logic here....

            return(target);
        }
示例#6
0
        public new object Deserialize(XmlSerializationReader reader)
        {
            var result = base.Deserialize(reader);

            CheckForDeserializationCallbacks(result);

            return(result);
        }
示例#7
0
 protected VimApi_65.MethodFault ReadMethodFault(XmlSerializationReader reader, bool isNullable, bool checkType)
 {
     return((VimApi_65.MethodFault)FaultUtility.FaultXmlSerializer._readMethodFault.Invoke((object)reader, new object[2]
     {
         (object)isNullable,
         (object)checkType
     }));
 }
示例#8
0
        private DateTime?Read6_NullableOfDateTime(bool checkType)
        {
            DateTime?result = null;

            if (base.ReadNull())
            {
                return(result);
            }
            result = new DateTime?(XmlSerializationReader.ToDateTime(base.Reader.ReadElementString()));
            return(result);
        }
        protected override object Deserialize(XmlSerializationReader reader)
        {
            var result = base.Deserialize(reader);

            var deserializedCallback = result as IXmlDeserializationCallback;

            if (deserializedCallback != null)
            {
                deserializedCallback.OnXmlDeserialization(this);
            }
            return(result);
        }
示例#10
0
        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize5"]/*' />
        public object Deserialize(XmlReader xmlReader, string encodingStyle, XmlDeserializationEvents events)
        {
            events.sender = this;
            try
            {
                if (_primitiveType != null)
                {
                    if (encodingStyle != null && encodingStyle.Length > 0)
                    {
                        throw new InvalidOperationException(string.Format(ResXml.XmlInvalidEncodingNotEncoded1, encodingStyle));
                    }
                    return(DeserializePrimitive(xmlReader, events));
                }
                else if (_tempAssembly == null || _typedSerializer)
                {
                    XmlSerializationReader reader = CreateReader();
                    reader.Init(xmlReader, events, encodingStyle, _tempAssembly);
                    try
                    {
                        return(Deserialize(reader));
                    }
                    finally
                    {
                        reader.Dispose();
                    }
                }
                else
                {
                    return(_tempAssembly.InvokeReader(_mapping, xmlReader, events, encodingStyle));
                }
            }
            catch (Exception e)
            {
                if (/*e is ThreadAbortException || e is StackOverflowException ||*/ e is OutOfMemoryException)
                {
                    throw;
                }
                if (e is TargetInvocationException)
                {
                    e = e.InnerException;
                }

                if (xmlReader is IXmlLineInfo)
                {
                    IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader;
                    throw new InvalidOperationException(string.Format(ResXml.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(), lineInfo.LinePosition.ToString()), e);
                }
                else
                {
                    throw new InvalidOperationException(ResXml.XmlSerializeError, e);
                }
            }
        }
示例#11
0
        /// <summary>
        /// Initializes the XmlSerializationReader used to deserialize the
        /// object.
        /// </summary>
        private XmlSerializationReader initXmlSerializationReader(XmlReader reader, string encodingStyle, out bool soap12)
        {
            System.Diagnostics.Debug.Assert(null != _reflector, "The XmlSerializationReflector has not been initialized.");
            if (!_isEncoded && encodingStyle != null)
            {
                throw new InvalidOperationException(SR.Format(SR.XmlInvalidEncodingNotEncoded1, encodingStyle));
            }

            verifyEncodingStyle(encodingStyle, out soap12);
            XmlSerializationReader xmlSerializationReader = new XmlSerializationReader(reader, _events, _reflector, soap12, _isEncoded);

            return(xmlSerializationReader);
        }
示例#12
0
        /// <summary>
        /// Gets the logical type to deserialize.
        /// </summary>
        /// <remarks>
        /// This is done by checking the type attributes on the current start element.
        /// </remarks>
        /// <exception cref="InvalidOperationException">Thrown if the type attributes are not present.</exception>
        private LogicalType resolveDeserializingType(XmlReader reader, XmlSerializationReader serialReader, bool soap12)
        {
            if (true /* AppDomain.CompatVersion >= AppDomain.Orcas */)
            {
                LogicalType type = serialReader.deriveTypeFromTypeAttribute(reader, null);
                if (type != null && _logicalType.Type.IsAssignableFrom(type.Type))
                {
                    return(type);
                }

                Accessor accessor = _isEncoded ? _logicalType.TypeAccessor : _logicalType.RootAccessor;
                if (startElementMatchesAccessor(reader, accessor, soap12))
                {
                    return(_logicalType);
                }

                throw serialReader.CreateUnknownNodeException();
            }
            else
            { /* Rogue or earlier */
                LogicalType type = serialReader.deriveTypeFromTypeAttribute(reader, null);
                if (type != null)
                {
                    return(type);
                }

                if (startElementMatchesAccessor(reader, _logicalType.TypeAccessor, soap12))
                {
                    return(_logicalType);
                }

                type = _reflector.FindType(new XmlQualifiedName(reader.Name, reader.NamespaceURI), _isEncoded);
                if (type != null)
                {
                    return(type);
                }

                return(_logicalType);
            }
        }
示例#13
0
        internal object InvokeReader(XmlMapping mapping, XmlReader xmlReader, XmlDeserializationEvents events, string encodingStyle)
        {
            XmlSerializationReader reader = null;

            try
            {
                encodingStyle = ValidateEncodingStyle(encodingStyle, mapping.Key);
                reader        = Contract.Reader;
                reader.Init(xmlReader, events, encodingStyle, this);
                if (_methods[mapping.Key].readMethod == null)
                {
                    if (_readerMethods == null)
                    {
                        _readerMethods = Contract.ReadMethods;
                    }
                    string methodName = (string)_readerMethods[mapping.Key];
                    if (methodName == null)
                    {
                        throw new InvalidOperationException(string.Format(ResXml.XmlNotSerializable, mapping.Accessor.Name));
                    }
                    _methods[mapping.Key].readMethod = GetMethodFromType(reader.GetType(), methodName, _pregeneratedAssmbly ? _assembly : null);
                }
                return(_methods[mapping.Key].readMethod.Invoke(reader, s_emptyObjectArray));
            }
            catch (SecurityException e)
            {
                throw new InvalidOperationException(ResXml.XmlNoPartialTrust, e);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
        protected override object Deserialize(XmlSerializationReader reader)
        {
            AddinSystemConfigurationReader xsReader = reader as AddinSystemConfigurationReader;

            return(xsReader.ReadRoot_AddinSystemConfiguration());
        }
示例#15
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return((object)this.ReadMethodFault(reader, false, true));
 }
 protected virtual object Deserialize(XmlSerializationReader reader);
示例#17
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReader1)reader).Read57_CmdletParameterMetadata());
 }
示例#18
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReader1)reader).Read39_DockingTree());
 }
示例#19
0
 private SyncTreeType Read2_SyncTreeType(string s)
 {
     return((SyncTreeType)XmlSerializationReader.ToEnum(s, this.SyncTreeTypeValues, "global::Microsoft.Exchange.EdgeSync.Common.SyncTreeType"));
 }
示例#20
0
        private Status Read4_Status(bool isNullable, bool checkType)
        {
            XmlQualifiedName xmlQualifiedName = checkType ? base.GetXsiType() : null;
            bool             flag             = false;

            if (isNullable)
            {
                flag = base.ReadNull();
            }
            if (checkType && !(xmlQualifiedName == null) && (xmlQualifiedName.Name != this.id1_Status || xmlQualifiedName.Namespace != this.id2_Item))
            {
                throw base.CreateUnknownTypeException(xmlQualifiedName);
            }
            if (flag)
            {
                return(null);
            }
            Status status = new Status();

            bool[] array = new bool[11];
            while (base.Reader.MoveToNextAttribute())
            {
                if (!base.IsXmlnsAttribute(base.Reader.Name))
                {
                    base.UnknownNode(status);
                }
            }
            base.Reader.MoveToElement();
            if (base.Reader.IsEmptyElement)
            {
                base.Reader.Skip();
                return(status);
            }
            base.Reader.ReadStartElement();
            base.Reader.MoveToContent();
            int num         = 0;
            int readerCount = base.ReaderCount;

            while (base.Reader.NodeType != XmlNodeType.EndElement && base.Reader.NodeType != XmlNodeType.None)
            {
                if (base.Reader.NodeType == XmlNodeType.Element)
                {
                    if (!array[0] && base.Reader.LocalName == this.id3_Result && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.Result = this.Read1_StatusResult(base.Reader.ReadElementString());
                        array[0]      = true;
                    }
                    else if (!array[1] && base.Reader.LocalName == this.id4_Type && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.Type = this.Read2_SyncTreeType(base.Reader.ReadElementString());
                        array[1]    = true;
                    }
                    else if (!array[2] && base.Reader.LocalName == this.id5_Name && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.Name = base.Reader.ReadElementString();
                        array[2]    = true;
                    }
                    else if (!array[3] && base.Reader.LocalName == this.id6_FailureDetails && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.FailureDetails = base.Reader.ReadElementString();
                        array[3] = true;
                    }
                    else if (!array[4] && base.Reader.LocalName == this.id7_StartUTC && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.StartUTC = XmlSerializationReader.ToDateTime(base.Reader.ReadElementString());
                        array[4]        = true;
                    }
                    else if (!array[5] && base.Reader.LocalName == this.id8_EndUTC && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.EndUTC = XmlSerializationReader.ToDateTime(base.Reader.ReadElementString());
                        array[5]      = true;
                    }
                    else if (!array[6] && base.Reader.LocalName == this.id9_Added && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.Added = XmlConvert.ToInt32(base.Reader.ReadElementString());
                        array[6]     = true;
                    }
                    else if (!array[7] && base.Reader.LocalName == this.id10_Deleted && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.Deleted = XmlConvert.ToInt32(base.Reader.ReadElementString());
                        array[7]       = true;
                    }
                    else if (!array[8] && base.Reader.LocalName == this.id11_Updated && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.Updated = XmlConvert.ToInt32(base.Reader.ReadElementString());
                        array[8]       = true;
                    }
                    else if (!array[9] && base.Reader.LocalName == this.id12_Scanned && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.Scanned = XmlConvert.ToInt32(base.Reader.ReadElementString());
                        array[9]       = true;
                    }
                    else if (!array[10] && base.Reader.LocalName == this.id13_TargetScanned && base.Reader.NamespaceURI == this.id2_Item)
                    {
                        status.TargetScanned = XmlConvert.ToInt32(base.Reader.ReadElementString());
                        array[10]            = true;
                    }
                    else
                    {
                        base.UnknownNode(status, ":Result, :Type, :Name, :FailureDetails, :StartUTC, :EndUTC, :Added, :Deleted, :Updated, :Scanned, :TargetScanned");
                    }
                }
                else
                {
                    base.UnknownNode(status, ":Result, :Type, :Name, :FailureDetails, :StartUTC, :EndUTC, :Added, :Deleted, :Updated, :Scanned, :TargetScanned");
                }
                base.Reader.MoveToContent();
                base.CheckReaderCount(ref num, ref readerCount);
            }
            base.ReadEndElement();
            return(status);
        }
示例#21
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReaderCalendarNotificationContentVersion1Point0)reader).Read7_CalendarNotificationContent());
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((WebReferenceOptionsSerializationReader)reader).Read5_webReferenceOptions());
 }
示例#23
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReader1)reader).Read58_Item());
 }
示例#24
0
 // Token: 0x060013AA RID: 5034 RVA: 0x0005398C File Offset: 0x00051B8C
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReaderTextMessagingHostingData)reader).Read20_TextMessagingHostingData());
 }
示例#25
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReader1)reader).Read74_StaticMethodParameterMetadata());
 }
示例#26
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReader1)reader).Read23_AcCalcControlData());
 }
示例#27
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((DiscoveryDocumentSerializationReader)reader).Read10_discovery());
 }
示例#28
0
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize4"]/*' />
 ///<internalonly/>
 protected virtual object Deserialize(XmlSerializationReader reader)
 {
     throw new NotImplementedException();
 }
示例#29
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReader1)reader).Read66_GetCmdletMetadata());
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return(((XmlSerializationReader1)reader).Read82_ItemsChoiceType());
 }
示例#31
0
 protected override object Deserialize(XmlSerializationReader reader)
 => base.Deserialize(reader);