Inheritance: XmlSerializationGeneratedCode
コード例 #1
0
        protected virtual object Deserialize(XmlSerializationReader reader)
        {
            if (customSerializer)
            {
                // Must be implemented in derived class
                throw new NotImplementedException();
            }

            try {
                if (reader is XmlSerializationReaderInterpreter)
                {
                    return(((XmlSerializationReaderInterpreter)reader).ReadRoot());
                }
                else
                {
                    try {
                        return(serializerData.ReaderMethod.Invoke(reader, null));
                    } catch (TargetInvocationException ex) {
                        throw ex.InnerException;
                    }
                }
            } catch (Exception ex) {
                if (ex is InvalidOperationException || ex is InvalidCastException)
                {
                    throw new InvalidOperationException("There is an error in"
                                                        + " XML document.", ex);
                }
                throw;
            }
        }
コード例 #2
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(Res.GetString(Res.XmlNotSerializable, mapping.Accessor.Name));
                    }
                    methods[mapping.Key].readMethod = GetMethodFromType(reader.GetType(), methodName, pregeneratedAssmbly ? this.assembly : null);
                }
                return(methods[mapping.Key].readMethod.Invoke(reader, emptyObjectArray));
            }
            catch (SecurityException e) {
                throw new InvalidOperationException(Res.GetString(Res.XmlNoPartialTrust), e);
            }
            finally {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
コード例 #3
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(Res.GetString(Res.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(Res.GetString(Res.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), e);
                }
                else
                {
                    throw new InvalidOperationException(Res.GetString(Res.XmlSerializeError), e);
                }
            }
            catch {
                if (xmlReader is IXmlLineInfo)
                {
                    IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader;
                    throw new InvalidOperationException(Res.GetString(Res.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), null);
                }
                else
                {
                    throw new InvalidOperationException(Res.GetString(Res.XmlSerializeError), (Exception)null);
                }
            }
        }
コード例 #4
0
        /// <summary>Deserializes the XML document contained by the specified <see cref="T:System.Xml.Serialization.XmlSerializationReader" />.</summary>
        /// <returns>The deserialized object.</returns>
        /// <param name="reader">The <see cref="T:System.Xml.Serialization.XmlSerializationReader" /> that contains the XML document to deserialize. </param>
        /// <exception cref="T:System.NotImplementedException">Any attempt is made to access the method when the method is not overridden in a descendant class. </exception>
        protected virtual object Deserialize(XmlSerializationReader reader)
        {
            if (this.customSerializer)
            {
                throw new NotImplementedException();
            }
            object result;

            try
            {
                if (reader is XmlSerializationReaderInterpreter)
                {
                    result = ((XmlSerializationReaderInterpreter)reader).ReadRoot();
                }
                else
                {
                    result = this.serializerData.ReaderMethod.Invoke(reader, null);
                }
            }
            catch (Exception ex)
            {
                if (ex is InvalidOperationException || ex is InvalidCastException)
                {
                    throw new InvalidOperationException("There is an error in XML document.", ex);
                }
                throw;
            }
            return(result);
        }
コード例 #5
0
ファイル: xmlserializer.cs プロジェクト: SSCLI/sscli_20021101
        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize2"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public object Deserialize(XmlReader xmlReader)
        {
            try {
                if (tempAssembly == null)
                {
                    XmlSerializationReader reader = CreateReader();
                    reader.Init(xmlReader, events);
                    return(Deserialize(reader));
                }
                return(tempAssembly.InvokeReader(methodIndex, xmlReader, events));
            }
            catch (Exception e) {
                if (e is TargetInvocationException)
                {
                    e = e.InnerException;
                }

                if (xmlReader is XmlTextReader)
                {
                    XmlTextReader xmlTextReader = (XmlTextReader)xmlReader;
                    throw new InvalidOperationException(Res.GetString(Res.XmlSerializeErrorDetails, xmlTextReader.LineNumber.ToString(), xmlTextReader.LinePosition.ToString()), e);
                }
                else
                {
                    throw new InvalidOperationException(Res.GetString(Res.XmlSerializeError), e);
                }
            }
        }
コード例 #6
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(SR.Format(SR.XmlNotSerializable, mapping.Accessor.Name));
             }
             _methods[mapping.Key].readMethod = GetMethodFromType(reader.GetType(), methodName);
         }
         return _methods[mapping.Key].readMethod.Invoke(reader, Array.Empty<object>());
     }
     catch (SecurityException e)
     {
         throw new InvalidOperationException(SR.XmlNoPartialTrust, e);
     }
     finally
     {
         if (reader != null)
             reader.Dispose();
     }
 }
コード例 #7
0
        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(SR.Format(SR.XmlInvalidEncodingNotEncoded1, encodingStyle));
                    }
                    return(DeserializePrimitive(xmlReader, events));
                }
                else if (ShouldUseReflectionBasedSerialization(_mapping) || _isReflectionBasedSerializer)
                {
                    return(DeserializeUsingReflection(xmlReader, encodingStyle, 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 TargetInvocationException)
                {
                    e = e.InnerException;
                }

                if (xmlReader is IXmlLineInfo)
                {
                    IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader;
                    throw new InvalidOperationException(SR.Format(SR.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), e);
                }
                else
                {
                    throw new InvalidOperationException(SR.XmlSerializeError, e);
                }
            }
        }
コード例 #8
0
        /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize5"]/*' />
        internal object Deserialize(XmlReader xmlReader, string encodingStyle, XmlDeserializationEvents events)
        {
#if FEATURE_LEGACYNETCF
            if (_legacyNetCFSerializer != null)
            {
                return(_legacyNetCFSerializer.Deserialize(xmlReader, encodingStyle));
            }
#endif

            try
            {
                if (_primitiveType != null)
                {
                    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 TargetInvocationException)
                {
                    e = e.InnerException;
                }

                if (xmlReader is IXmlLineInfo)
                {
                    IXmlLineInfo lineInfo = (IXmlLineInfo)xmlReader;
                    throw new InvalidOperationException(SR.Format(SR.XmlSerializeErrorDetails, lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture), lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)), e);
                }
                else
                {
                    throw new InvalidOperationException(SR.XmlSerializeError, e);
                }
            }
        }
コード例 #9
0
 internal object Read_dateTime()
 {
     base.Reader.MoveToContent();
     if (base.Reader.NodeType == XmlNodeType.Element)
     {
         if ((base.Reader.LocalName != this.id10_dateTime) || (base.Reader.NamespaceURI != this.id2_Item))
         {
             throw base.CreateUnknownNodeException();
         }
         return(XmlSerializationReader.ToDateTime(base.Reader.ReadElementString()));
     }
     base.UnknownNode(null);
     return(null);
 }
コード例 #10
0
        public object Deserialize(XmlReader xmlReader, string encodingStyle, XmlDeserializationEvents events)
        {
            object obj2;

            events.sender = this;
            try
            {
                if (this.primitiveType != null)
                {
                    if ((encodingStyle != null) && (encodingStyle.Length > 0))
                    {
                        throw new InvalidOperationException(Res.GetString("XmlInvalidEncodingNotEncoded1", new object[] { encodingStyle }));
                    }
                    return(this.DeserializePrimitive(xmlReader, events));
                }
                if ((this.tempAssembly == null) || this.typedSerializer)
                {
                    XmlSerializationReader reader = this.CreateReader();
                    reader.Init(xmlReader, events, encodingStyle, this.tempAssembly);
                    try
                    {
                        return(this.Deserialize(reader));
                    }
                    finally
                    {
                        reader.Dispose();
                    }
                }
                obj2 = this.tempAssembly.InvokeReader(this.mapping, xmlReader, events, encodingStyle);
            }
            catch (Exception innerException)
            {
                if (((innerException is ThreadAbortException) || (innerException is StackOverflowException)) || (innerException is OutOfMemoryException))
                {
                    throw;
                }
                if (innerException is TargetInvocationException)
                {
                    innerException = innerException.InnerException;
                }
                if (xmlReader is IXmlLineInfo)
                {
                    IXmlLineInfo info = (IXmlLineInfo)xmlReader;
                    throw new InvalidOperationException(Res.GetString("XmlSerializeErrorDetails", new object[] { info.LineNumber.ToString(CultureInfo.InvariantCulture), info.LinePosition.ToString(CultureInfo.InvariantCulture) }), innerException);
                }
                throw new InvalidOperationException(Res.GetString("XmlSerializeError"), innerException);
            }
            return(obj2);
        }
コード例 #11
0
ファイル: XmlSerializer.cs プロジェクト: ForNeVeR/pnet
        protected virtual object Deserialize(XmlSerializationReader reader)
        {
            if (customSerializer)
            {
                // Must be implemented in derived class
                throw new NotImplementedException();
            }

            if (reader is XmlSerializationReaderInterpreter)
            {
                return(((XmlSerializationReaderInterpreter)reader).ReadRoot());
            }
            else
            {
                return(serializerData.ReaderMethod.Invoke(reader, null));
            }
        }
コード例 #12
0
        public object InvokeReader(int methodIndex, XmlReader xmlReader, XmlDeserializationEvents events)
        {
            if (!allAssembliesAllowPartialTrust)
            {
                new PermissionSet(PermissionState.Unrestricted).Demand();
            }
            XmlSerializationReader reader = (XmlSerializationReader)Activator.CreateInstance(readerType);

            reader.Init(xmlReader, events);
            ResolveEventHandler resolver = new ResolveEventHandler(this.OnAssemblyResolve);

            assemblyResolveThread = Thread.CurrentThread.GetHashCode();
            AppDomain.CurrentDomain.AssemblyResolve += resolver;
            object ret = methods[methodIndex].readMethod.Invoke(reader, emptyObjectArray);

            AppDomain.CurrentDomain.AssemblyResolve -= resolver;
            assemblyResolveThread = 0;
            return(ret);
        }
コード例 #13
0
        internal object InvokeReader(int methodIndex, XmlReader xmlReader, XmlDeserializationEvents events, string encodingStyle)
        {
            XmlSerializationReader reader = null;

            try {
                encodingStyle = ValidateEncodingStyle(encodingStyle, methodIndex);
                reader        = (XmlSerializationReader)Activator.CreateInstance(readerType);
                reader.Init(xmlReader, events, encodingStyle, this);

                return(methods[methodIndex].readMethod.Invoke(reader, emptyObjectArray));
            }
            catch (SecurityException e) {
                throw new InvalidOperationException(Res.GetString(Res.XmlNoPartialTrust), e);
            }
            finally {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
コード例 #14
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read81_WildcardablePropertyQuery();
 }
コード例 #15
0
 protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader)
 {
     return(((GeneratedReader)reader).ReadRoot_InventoryCollection());
 }
コード例 #16
0
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize4"]/*' />
 ///<internalonly/>
 protected virtual object Deserialize(XmlSerializationReader reader)
 {
     throw new NotImplementedException();
 }
コード例 #17
0
 protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader)
 {
     return(((WebReferenceOptionsReader)reader).ReadRoot_WebReferenceOptions());
 }
コード例 #18
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read336_FormPlacement();
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read254_ContentDefaultParamStruct();
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read213_ConfigurableSettingsProvider();
 }
コード例 #21
0
ファイル: XmlSerializer.cs プロジェクト: ujjwol/corefx
 /// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.Deserialize4"]/*' />
 ///<internalonly/>
 protected virtual object Deserialize(XmlSerializationReader reader)
 {
     throw new PlatformNotSupportedException();
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read317_VistaProgressBarRenderer();
 }
コード例 #23
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read330_SolidSizeUnit();
 }
コード例 #24
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read292_RatingTypeConverter();
 }
コード例 #25
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read267_ItemDateTimePart();
 }
コード例 #26
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read68_ConfirmImpact();
 }
コード例 #27
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read242_PK_CAPS();
 }
コード例 #28
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read237_ProcessItemEventArgs();
 }
コード例 #29
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read307_DelayedExtractMode();
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read258_AggregatedFilterCondition();
 }
コード例 #31
0
ファイル: ServiceDescription.cs プロジェクト: nobled/mono
			protected override object Deserialize (XmlSerializationReader reader)
			{
				ServiceDescriptionReaderBase xsReader = reader as ServiceDescriptionReaderBase;
				return xsReader.ReadRoot_ServiceDescription ();
			}
コード例 #32
0
 protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader)
 {
     return(base.Deserialize(reader));
 }
コード例 #33
0
ファイル: XmlSerializer.cs プロジェクト: ItsVeryWindy/mono
		protected virtual object Deserialize (XmlSerializationReader reader)
		{
			if (customSerializer)
				// Must be implemented in derived class
				throw new NotImplementedException ();
			
			try {
				if (reader is XmlSerializationReaderInterpreter)
					return ((XmlSerializationReaderInterpreter) reader).ReadRoot ();
				else {
					try {
						return serializerData.ReaderMethod.Invoke (reader, null);
					} catch (TargetInvocationException ex) {
						throw ex.InnerException;
					}
				}
			} catch (Exception ex) {
				if (ex is InvalidOperationException || ex is InvalidCastException)
					throw new InvalidOperationException ("There is an error in"
						+ " XML document.", ex);
				throw;
			}
		}
コード例 #34
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read246_WcxErrors();
 }
コード例 #35
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read314_SimpleEncrypt();
 }
コード例 #36
0
 public object Deserialize(XmlSerializationReader reader)
 {
     throw new NotImplementedException();
 }
コード例 #37
0
ファイル: XmlSerializer.cs プロジェクト: SamuelEnglard/corefx
 ///<internalonly/>
 protected virtual object Deserialize(XmlSerializationReader reader) { throw new PlatformNotSupportedException(); }
コード例 #38
0
 protected override object Deserialize(XmlSerializationReader reader) {
     return ((DiscoveryDocumentSerializationReader)reader).Read10_discovery();
 }
コード例 #39
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read223_CustomActionLink();
 }
コード例 #40
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read315_ProgressRenderMode();
 }
コード例 #41
0
 protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader)
 {
     return(((Soap12FaultReader)reader).ReadRoot_Soap12Fault());
 }
コード例 #42
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read74_StaticMethodParameterMetadata();
 }
コード例 #43
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read278_HashPropertyProvider();
 }
コード例 #44
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read361_CopyWorkerOptions();
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read252_ShellFileSystemCreator();
 }
コード例 #46
0
 protected override System.Object Deserialize(XmlSerializationReader reader) {
     return ((WebReferenceOptionsSerializationReader)reader).Read5_webReferenceOptions();
 }
コード例 #47
0
 protected override object Deserialize(XmlSerializationReader reader) {
     return ((ServiceDescriptionSerializationReader)reader).Read125_definitions();
 }
コード例 #48
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read337_ArgumentKey();
 }
コード例 #49
0
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read241_PK_OPERATION();
 }
 protected override object Deserialize(XmlSerializationReader reader)
 {
     return ((XmlSerializationReader1) reader).Read273_VirtualItemNameListFilter();
 }