[Mono-list] patch Regex: GetObjectData & ctr for ISerializable impl.

Cesar Octavio López Nataren cesar@ciencias.unam.mx
Wed, 14 Aug 2002 00:33:32 -0500


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

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

In this patch I used the ToString () member method to store the
"pattern" (I'm not sure If this is the correct type that must be used, but 
at least I could use the base constructor to build back ;)) 

Great work & Best regards mono:: team! 

cesar 

--=_0_3127_1029303212
Content-Disposition: attachment; filename="regex_SoapSerialization.xml"
Content-Type: text/plain; charset="iso-8859-1"; name="regex_SoapSerialization.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:Regex id=3D"ref-1" xmlns:a1=3D"http://schemas.microsoft.com/clr/nsass=
em/System.Text.RegularExpressions/System%2C%20Version%3D1.0.3300.0%2C%20C=
ulture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089">=0D
<pattern id=3D"ref-3">cEsAr</pattern>=0D
<options xsi:type=3D"a1:RegexOptions" xmlns:a1=3D"http://schemas.microsof=
t.com/clr/nsassem/System.Text.RegularExpressions/System%2C%20Version%3D1.=
0.3300.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089">C=
ompiled</options>=0D
</a1:Regex>=0D
</SOAP-ENV:Body>=0D
</SOAP-ENV:Envelope>=0D

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

Index: regex.cs
===================================================================
RCS file: /mono/mcs/class/System/System.Text.RegularExpressions/regex.cs,v
retrieving revision 1.8
diff -u -r1.8 regex.cs
--- regex.cs	31 Jul 2002 16:41:39 -0000	1.8
+++ regex.cs	14 Aug 2002 05:29:43 -0000
@@ -172,6 +172,12 @@
 			}
 		}
 
+
+		public Regex (SerializationInfo info, StreamingContext context) :
+			this (info.GetString ("pattern"), 
+			      (RegexOptions) info.GetValue ("options", typeof (RegexOptions))) {			
+		}
+
 		// public instance properties
 		
 		public RegexOptions Options {
@@ -337,7 +343,8 @@
 		// ISerializable interface
 
 		public void GetObjectData (SerializationInfo info, StreamingContext context) {
-			throw new Exception ("Not implemented.");
+			info.AddValue ("pattern", this.ToString (), typeof (string));
+			info.AddValue ("options", this.Options, typeof (RegexOptions));
 		}
 
 		// internal

--=_0_3127_1029303212--