Example #1
0
        public object Deserialize(Stream serializationStream, HeaderHandler handler)
        {
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream");
            }
            if (serializationStream.CanSeek && (serializationStream.Length == 0L))
            {
                throw new SerializationException(SoapUtil.GetResourceString("Serialization_Stream"));
            }
            InternalFE formatterEnums = new InternalFE {
                FEtypeFormat         = this.m_typeFormat,
                FEtopObject          = this.m_topObject,
                FEserializerTypeEnum = InternalSerializerTypeE.Soap,
                FEassemblyFormat     = this.m_assemblyFormat,
                FEsecurityLevel      = this.m_securityLevel
            };
            ObjectReader objectReader = new ObjectReader(serializationStream, this.m_surrogates, this.m_context, formatterEnums, this.m_binder);

            if ((this.soapParser == null) || (serializationStream != this.currentStream))
            {
                this.soapParser    = new SoapParser(serializationStream);
                this.currentStream = serializationStream;
            }
            this.soapParser.Init(objectReader);
            return(objectReader.Deserialize(handler, this.soapParser));
        }
 public object Deserialize(Stream serializationStream, HeaderHandler handler)
 {
     if (serializationStream == null)
     {
         throw new ArgumentNullException("serializationStream");
     }
     if (serializationStream.CanSeek && (serializationStream.Length == 0L))
     {
         throw new SerializationException(SoapUtil.GetResourceString("Serialization_Stream"));
     }
     InternalFE formatterEnums = new InternalFE {
         FEtypeFormat = this.m_typeFormat,
         FEtopObject = this.m_topObject,
         FEserializerTypeEnum = InternalSerializerTypeE.Soap,
         FEassemblyFormat = this.m_assemblyFormat,
         FEsecurityLevel = this.m_securityLevel
     };
     ObjectReader objectReader = new ObjectReader(serializationStream, this.m_surrogates, this.m_context, formatterEnums, this.m_binder);
     if ((this.soapParser == null) || (serializationStream != this.currentStream))
     {
         this.soapParser = new SoapParser(serializationStream);
         this.currentStream = serializationStream;
     }
     this.soapParser.Init(objectReader);
     return objectReader.Deserialize(handler, this.soapParser);
 }
 internal ObjectWriter(Stream stream, ISurrogateSelector selector, StreamingContext context, InternalFE formatterEnums)
 {
     if (stream == null)
     {
         throw new ArgumentNullException("stream", SoapUtil.GetResourceString("ArgumentNull_Stream"));
     }
     this.m_stream = stream;
     this.m_surrogates = selector;
     this.m_context = context;
     this.formatterEnums = formatterEnums;
     this.m_objectManager = new SerializationObjectManager(context);
     this.m_formatterConverter = new FormatterConverter();
 }
Example #4
0
        public void Serialize(Stream serializationStream, object graph, Header[] headers)
        {
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream");
            }
            InternalFE formatterEnums = new InternalFE {
                FEtypeFormat         = this.m_typeFormat,
                FEtopObject          = this.m_topObject,
                FEserializerTypeEnum = InternalSerializerTypeE.Soap,
                FEassemblyFormat     = this.m_assemblyFormat
            };

            new ObjectWriter(serializationStream, this.m_surrogates, this.m_context, formatterEnums).Serialize(graph, headers, new SoapWriter(serializationStream));
        }
Example #5
0
        // XMLObjectWriter Constructor
        internal ObjectWriter(Stream stream, ISurrogateSelector selector, StreamingContext context,InternalFE formatterEnums)
        {
            if (stream==null)
            {
                throw new ArgumentNullException("stream", SoapUtil.GetResourceString("ArgumentNull_Stream"));               
            }

            m_stream=stream;
            m_surrogates = selector;
            m_context = context;
            this.formatterEnums = formatterEnums;
            InternalST.InfoSoap(
                               formatterEnums.FEtypeFormat +" "+
                               ((Enum)formatterEnums.FEserializerTypeEnum));

            m_formatterConverter = new FormatterConverter();

        }
Example #6
0
        // Commences the process of serializing the entire graph.  All of the data (in the appropriate format)
        // is emitted onto the stream.

        public void Serialize(Stream serializationStream, Object graph, Header[] headers)
        {
            InternalST.InfoSoap("Enter SoapFormatter.Serialize ");
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream");
            }

            InternalST.Soap(this, "Serialize Entry");
            InternalFE formatterEnums = new InternalFE();

            formatterEnums.FEtypeFormat         = m_typeFormat;
            formatterEnums.FEtopObject          = m_topObject;
            formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Soap;
            formatterEnums.FEassemblyFormat     = m_assemblyFormat;
            ObjectWriter sow = new ObjectWriter(serializationStream, m_surrogates, m_context, formatterEnums);

            sow.Serialize(graph, headers, new SoapWriter(serializationStream));
            InternalST.InfoSoap("Leave SoapFormatter.Serialize ");
        }
 internal ObjectReader(Stream stream, ISurrogateSelector selector, StreamingContext context, InternalFE formatterEnums, SerializationBinder binder)
 {
     if (stream == null)
     {
         throw new ArgumentNullException("stream", SoapUtil.GetResourceString("ArgumentNull_Stream"));
     }
     this.m_stream = stream;
     this.m_surrogates = selector;
     this.m_context = context;
     this.m_binder = binder;
     this.formatterEnums = formatterEnums;
     if (formatterEnums.FEtopObject != null)
     {
         this.IsFakeTopObject = true;
     }
     else
     {
         this.IsFakeTopObject = false;
     }
     this.m_formatterConverter = new FormatterConverter();
 }
Example #8
0
        // Deserialize the stream into an object graph.
        public Object Deserialize(Stream serializationStream, HeaderHandler handler)
        {
            InternalST.InfoSoap("Enter SoapFormatter.Deserialize ");
            if (serializationStream == null)
            {
                throw new ArgumentNullException("serializationStream");
            }

            if (serializationStream.CanSeek && (serializationStream.Length == 0))
            {
                throw new SerializationException(SoapUtil.GetResourceString("Serialization_Stream"));
            }

            InternalST.Soap(this, "Deserialize Entry");
            InternalFE formatterEnums = new InternalFE();

            formatterEnums.FEtypeFormat         = m_typeFormat;
            formatterEnums.FEtopObject          = m_topObject;
            formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Soap;
            formatterEnums.FEassemblyFormat     = m_assemblyFormat;
            formatterEnums.FEsecurityLevel      = m_securityLevel;
            ObjectReader sor = new ObjectReader(serializationStream, m_surrogates, m_context, formatterEnums, m_binder);

            // If this is the first call, or a new stream is being used a new Soap parser is created.
            // If this is a continuing call, then the existing SoapParser is used.
            // One stream can contains multiple Soap XML documents. The XMLParser buffers the XML so
            // that the same XMLParser has to be used to continue a stream.
            if ((soapParser == null) || (serializationStream != currentStream))
            {
                soapParser    = new SoapParser(serializationStream);
                currentStream = serializationStream;
            }
            soapParser.Init(sor);
            Object obj = sor.Deserialize(handler, soapParser);

            InternalST.InfoSoap("Leave SoapFormatter.Deserialize ");
            return(obj);
        }
 public void Serialize(Stream serializationStream, object graph, Header[] headers)
 {
     if (serializationStream == null)
     {
         throw new ArgumentNullException("serializationStream");
     }
     InternalFE formatterEnums = new InternalFE {
         FEtypeFormat = this.m_typeFormat,
         FEtopObject = this.m_topObject,
         FEserializerTypeEnum = InternalSerializerTypeE.Soap,
         FEassemblyFormat = this.m_assemblyFormat
     };
     new ObjectWriter(serializationStream, this.m_surrogates, this.m_context, formatterEnums).Serialize(graph, headers, new SoapWriter(serializationStream));
 }
Example #10
0
        internal ObjectReader(Stream stream, ISurrogateSelector selector, StreamingContext context, InternalFE formatterEnums, SerializationBinder binder)
        {
            InternalST.Soap( this, "Constructor ISurrogateSelector ",((selector == null)?"null selector ":"selector present"));                 

            if (stream==null)
            {
                throw new ArgumentNullException("stream", SoapUtil.GetResourceString("ArgumentNull_Stream"));
            }

            m_stream=stream;
            m_surrogates = selector;
            m_context = context;
            m_binder =  binder;
            this.formatterEnums = formatterEnums;

            InternalST.Soap( this, "Constructor formatterEnums.FEtopObject ",formatterEnums.FEtopObject);
            if (formatterEnums.FEtopObject != null) 
                IsFakeTopObject = true;
            else
                IsFakeTopObject = false;

            m_formatterConverter = new FormatterConverter();
        }
    	// Commences the process of serializing the entire graph.  All of the data (in the appropriate format)
    	// is emitted onto the stream.

		public void Serialize(Stream serializationStream, Object graph, Header[] headers)
		{
			InternalST.InfoSoap("Enter SoapFormatter.Serialize ");
            if (serializationStream==null) {
                throw new ArgumentNullException("serializationStream");
            }

			InternalST.Soap( this, "Serialize Entry");
			InternalFE formatterEnums = new InternalFE();
			formatterEnums.FEtypeFormat = m_typeFormat;
			formatterEnums.FEtopObject = m_topObject;
			formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Soap;
			formatterEnums.FEassemblyFormat = m_assemblyFormat;
			ObjectWriter sow = new ObjectWriter(serializationStream, m_surrogates, m_context, formatterEnums);
			sow.Serialize(graph, headers, new SoapWriter(serializationStream));
			InternalST.InfoSoap("Leave SoapFormatter.Serialize ");			
		}
    	// Deserialize the stream into an object graph.
		public Object Deserialize(Stream serializationStream, HeaderHandler handler) {
			InternalST.InfoSoap("Enter SoapFormatter.Deserialize ");			
            if (serializationStream==null) {
                throw new ArgumentNullException("serializationStream");
            }

			if (serializationStream.CanSeek && (serializationStream.Length == 0))
				throw new SerializationException(SoapUtil.GetResourceString("Serialization_Stream"));								

			InternalST.Soap( this, "Deserialize Entry");
			InternalFE formatterEnums = new InternalFE();
			formatterEnums.FEtypeFormat = m_typeFormat;
			formatterEnums.FEtopObject = m_topObject;
			formatterEnums.FEserializerTypeEnum = InternalSerializerTypeE.Soap;
			formatterEnums.FEassemblyFormat = m_assemblyFormat;
			formatterEnums.FEsecurityLevel = m_securityLevel;              
			ObjectReader sor = new ObjectReader(serializationStream, m_surrogates, m_context, formatterEnums, m_binder);

			// If this is the first call, or a new stream is being used a new Soap parser is created.
			// If this is a continuing call, then the existing SoapParser is used.
			// One stream can contains multiple Soap XML documents. The XMLParser buffers the XML so
			// that the same XMLParser has to be used to continue a stream.
			if ((soapParser == null) || (serializationStream != currentStream))
			{
				soapParser = new SoapParser(serializationStream);
				currentStream = serializationStream;
			}
			soapParser.Init(sor);
			Object obj = sor.Deserialize(handler, soapParser);
			InternalST.InfoSoap("Leave SoapFormatter.Deserialize ");
			return obj;
		}