[Mono-list] patch: GetObjectData & constructor for serialization support System.Net. WebProxy

Cesar Octavio López Nataren cesar@ciencias.unam.mx
Mon, 12 Aug 2002 15:37:04 -0500


This is a MIME-formatted message.  If you see this text it means that your
mail software cannot handle MIME-formatted messages.

--=_0_84850_1029184624
Content-Type: text/plain; format=flowed; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Hello, here's a small patch for the implementation
of the serialization support (implements ISerializable) for 
System.Net.WebProxy.
I attach the xml obtained when you serialize a WebProxy with MS .Net
(for name compatibility) 

Best regards mono:: team.
(feedback welcome) 

cesar 

--=_0_84850_1029184624
Content-Disposition: attachment; filename="System.Net.WebProxy.xml"
Content-Type: text/plain; charset="iso-8859-1"; name="System.Net.WebProxy.xml"
Content-Transfer-Encoding: quoted-printable

<SOAP-ENV:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance=
" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC=3D"http:/=
/schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV=3D"http://schemas.xml=
soap.org/soap/envelope/" xmlns:clr=3D"http://schemas.microsoft.com/soap/e=
ncoding/clr/1.0" SOAP-ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soa=
p/encoding/">=0D
<SOAP-ENV:Body>=0D
<a1:WebProxy id=3D"ref-1" xmlns:a1=3D"http://schemas.microsoft.com/clr/ns=
assem/System.Net/System%2C%20Version%3D1.0.3300.0%2C%20Culture%3Dneutral%=
2C%20PublicKeyToken%3Db77a5c561934e089">=0D
<_BypassOnLocal>true</_BypassOnLocal>=0D
<_ProxyAddress href=3D"#ref-3"/>=0D
<_BypassList xsi:type=3D"xsd:anyType" xsi:null=3D"1"/>=0D
</a1:WebProxy>=0D
<a2:Uri id=3D"ref-3" xmlns:a2=3D"http://schemas.microsoft.com/clr/nsassem=
/System/System%2C%20Version%3D1.0.3300.0%2C%20Culture%3Dneutral%2C%20Publ=
icKeyToken%3Db77a5c561934e089">=0D
<AbsoluteUri id=3D"ref-4">http://address/</AbsoluteUri>=0D
</a2:Uri>=0D
</SOAP-ENV:Body>=0D
</SOAP-ENV:Envelope>=0D

--=_0_84850_1029184624
Content-Disposition: attachment; filename="WebProxy.diff"
Content-Type: text/plain; charset="iso-8859-1"; name="WebProxy.diff"
Content-Transfer-Encoding: 7bit

Index: WebProxy.cs
===================================================================
RCS file: /mono/mcs/class/System/System.Net/WebProxy.cs,v
retrieving revision 1.3
diff -u -r1.3 WebProxy.cs
--- WebProxy.cs	21 May 2002 15:56:21 -0000	1.3
+++ WebProxy.cs	12 Aug 2002 20:26:29 -0000
@@ -62,10 +62,15 @@
 			CheckBypassList ();
 		}
 		
-		[MonoTODO]
+
 		protected WebProxy (SerializationInfo serializationInfo, StreamingContext streamingContext) 
 		{
-			throw new NotImplementedException ();
+			if (serializationInfo == null)
+				throw new ArgumentNullException ();
+
+			BypassProxyOnLocal = serializationInfo.GetBoolean ("_BypassOnLocal");
+			Address = (System.Uri) serializationInfo.GetValue ("_ProxyAddress", typeof (Uri));
+			BypassList = (string []) serializationInfo.GetValue ("_BypassList", typeof (string []));
 		}
 		
 		// Properties
@@ -163,11 +168,13 @@
 			}
 		}
 
-		[MonoTODO]		
+
 		void ISerializable.GetObjectData (SerializationInfo serializationInfo,
 		                                  StreamingContext streamingContext)
 		{
-			throw new NotImplementedException ();
+			serializationInfo.AddValue ("_BypassOnLocal", BypassProxyOnLocal);
+			serializationInfo.AddValue ("_ProxyAddress", Address, typeof (Uri));
+			serializationInfo.AddValue ("_BypassList", BypassList, typeof (string []));
 		}
 		
 		// Private Methods
@@ -191,4 +198,4 @@
 			return new Uri (address);
 		}
 	}
-}
\ No newline at end of file
+}

--=_0_84850_1029184624--