Author: kornelpal
Date: 2006-07-03 15:58:11 -0400 (Mon, 03 Jul 2006)
New Revision: 62235

Added:
   trunk/mcs/class/corlib/System.Globalization/CodePageDataItem.cs
   trunk/mcs/class/corlib/System.Text/CodePageEncoding.cs
   trunk/mcs/class/corlib/System.Text/MLangCodePageEncoding.cs
   trunk/mcs/class/corlib/System.Text/SurrogateEncoder.cs
Modified:
   trunk/mcs/class/corlib/ChangeLog
   trunk/mcs/class/corlib/System.Globalization/ChangeLog
   trunk/mcs/class/corlib/System.Text/ChangeLog
   trunk/mcs/class/corlib/corlib.dll.sources
Log:
Added encoding deserialization support classes.

Modified: trunk/mcs/class/corlib/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/ChangeLog    2006-07-03 19:26:44 UTC (rev 62234)
+++ trunk/mcs/class/corlib/ChangeLog    2006-07-03 19:58:11 UTC (rev 62235)
@@ -1,3 +1,11 @@
+2006-07-03  Kornél Pál  <[EMAIL PROTECTED]>
+
+       * corlib.dll.sources: Added
+         System.Globalization/CodePageDataItem.cs
+         System.Text/CodePageEncoding.cs
+         System.Text/MLangCodePageEncoding.cs
+         System.Text/SurrogateEncoder.cs
+
 2006-06-5  Jonathan Chambers  <[EMAIL PROTECTED]>
 
        * corlib_test.dll.sources : added Variant.cs.

Modified: trunk/mcs/class/corlib/System.Globalization/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Globalization/ChangeLog       2006-07-03 
19:26:44 UTC (rev 62234)
+++ trunk/mcs/class/corlib/System.Globalization/ChangeLog       2006-07-03 
19:58:11 UTC (rev 62235)
@@ -1,3 +1,7 @@
+2006-07-03  Kornél Pál  <[EMAIL PROTECTED]>
+
+       * CodePageDataItem.cs: Added.
+
 2006-06-30  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * CultureInfo.cs: Add stubs for net 2.0 GetCultureInfo () methods.

Added: trunk/mcs/class/corlib/System.Globalization/CodePageDataItem.cs
===================================================================
--- trunk/mcs/class/corlib/System.Globalization/CodePageDataItem.cs     
2006-07-03 19:26:44 UTC (rev 62234)
+++ trunk/mcs/class/corlib/System.Globalization/CodePageDataItem.cs     
2006-07-03 19:58:11 UTC (rev 62235)
@@ -0,0 +1,57 @@
+//
+// System.Globalization.CodePageDataItem.cs
+//
+// Author:
+//   Korn�l P�l <http://www.kornelpal.hu/>
+//
+// Copyright (C) 2006 Korn�l P�l
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+//
+// .NET Framework 1.x serializes encoding properties using this class and
+// .NET Framework 2.0 can deserialize it but drops the properties.
+// This class supports serialization compatibility.
+//
+
+using System;
+
+namespace System.Globalization
+{
+       [Serializable]
+       internal sealed class CodePageDataItem
+       {
+               private string m_bodyName;
+               private int m_codePage;
+               private int m_dataIndex;
+               private string m_description;
+               private uint m_flags;
+               private string m_headerName;
+               private int m_uiFamilyCodePage;
+               private string m_webName;
+
+               private CodePageDataItem ()
+               {
+               }
+       }
+}


Property changes on: 
trunk/mcs/class/corlib/System.Globalization/CodePageDataItem.cs
___________________________________________________________________
Name: svn:eolstyle
   + native

Modified: trunk/mcs/class/corlib/System.Text/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Text/ChangeLog        2006-07-03 19:26:44 UTC 
(rev 62234)
+++ trunk/mcs/class/corlib/System.Text/ChangeLog        2006-07-03 19:58:11 UTC 
(rev 62235)
@@ -1,3 +1,9 @@
+2006-07-03  Kornél Pál  <[EMAIL PROTECTED]>
+
+       * CodePageEncoding.cs: Added.
+       * MLangCodePageEncoding.cs: Added.
+       * SurrogateEncoder.cs: Added.
+
 2006-06-27  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * EncodingInfo.cs : EncodingName is WebName, not EncodingName.

Added: trunk/mcs/class/corlib/System.Text/CodePageEncoding.cs
===================================================================
--- trunk/mcs/class/corlib/System.Text/CodePageEncoding.cs      2006-07-03 
19:26:44 UTC (rev 62234)
+++ trunk/mcs/class/corlib/System.Text/CodePageEncoding.cs      2006-07-03 
19:58:11 UTC (rev 62235)
@@ -0,0 +1,120 @@
+//
+// System.Text.CodePageEncoding.cs
+//
+// Author:
+//   Korn�l P�l <http://www.kornelpal.hu/>
+//
+// Copyright (C) 2006 Korn�l P�l
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+//
+// .NET Framework 1.x uses this class for single-byte encodings and
+// .NET Framework 2.0 serializes single byte-encodings using a proxy.
+// This class supports serialization compatibility.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Text
+{
+       [Serializable]
+       internal sealed class CodePageEncoding : ISerializable, IObjectReference
+       {
+               //
+               // .NET Framework 1.x uses this class for single-byte decoders 
and
+               // .NET Framework 2.0 can deserialize them using a proxy.
+               // This class supports serialization compatibility.
+               //
+
+               [Serializable]
+               private sealed class Decoder : ISerializable, IObjectReference
+               {
+                       private Encoding encoding;
+
+                       private Decoder (SerializationInfo info, 
StreamingContext context)
+                       {
+                               if (info == null)
+                                       throw new ArgumentNullException 
("info");
+
+                               this.encoding = (Encoding) info.GetValue 
("encoding", typeof (Encoding));
+                       }
+
+                       public void GetObjectData (SerializationInfo info, 
StreamingContext context)
+                       {
+                               throw new ArgumentException ("This class cannot 
be serialized.");
+                       }
+
+                       public object GetRealObject (StreamingContext context)
+                       {
+                               return this.encoding.GetDecoder ();
+                       }
+               }
+
+               private int codePage;
+#if NET_2_0
+               private bool isReadOnly;
+               private EncoderFallback encoderFallback;
+               private DecoderFallback decoderFallback;
+#endif
+
+               private CodePageEncoding (SerializationInfo info, 
StreamingContext context)
+               {
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+
+                       this.codePage = (int) info.GetValue ("m_codePage", 
typeof (int));
+
+#if NET_2_0
+                       try {
+                               this.isReadOnly = (bool) info.GetValue 
("m_isReadOnly", typeof (bool));
+                               this.encoderFallback = (EncoderFallback) 
info.GetValue ("encoderFallback", typeof (EncoderFallback));
+                               this.decoderFallback = (DecoderFallback) 
info.GetValue ("decoderFallback", typeof (DecoderFallback));
+                       } catch (SerializationException) {
+                               this.isReadOnly = true;
+                       }
+#endif
+               }
+
+               public void GetObjectData (SerializationInfo info, 
StreamingContext context)
+               {
+                       throw new ArgumentException ("This class cannot be 
serialized.");
+               }
+
+               public object GetRealObject (StreamingContext context)
+               {
+                       Encoding encoding = Encoding.GetEncoding 
(this.codePage);
+
+#if NET_2_0
+                       if (!this.isReadOnly) {
+                               encoding = (Encoding) encoding.Clone ();
+                               encoding.EncoderFallback = this.encoderFallback;
+                               encoding.DecoderFallback = this.decoderFallback;
+                       }
+#endif
+
+                       return encoding;
+               }
+       }
+}


Property changes on: trunk/mcs/class/corlib/System.Text/CodePageEncoding.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/mcs/class/corlib/System.Text/MLangCodePageEncoding.cs
===================================================================
--- trunk/mcs/class/corlib/System.Text/MLangCodePageEncoding.cs 2006-07-03 
19:26:44 UTC (rev 62234)
+++ trunk/mcs/class/corlib/System.Text/MLangCodePageEncoding.cs 2006-07-03 
19:58:11 UTC (rev 62235)
@@ -0,0 +1,150 @@
+//
+// System.Text.MLangCodePageEncoding.cs
+//
+// Author:
+//   Korn�l P�l <http://www.kornelpal.hu/>
+//
+// Copyright (C) 2006 Korn�l P�l
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+//
+// .NET Framework 1.x uses this class for multi-byte encodings and
+// .NET Framework 2.0 serializes multi-byte encodings using a proxy.
+// This class supports serialization compatibility.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Text
+{
+       [Serializable]
+       internal sealed class MLangCodePageEncoding : ISerializable, 
IObjectReference
+       {
+               //
+               // .NET Framework 1.x uses this class for multi-byte encoders 
and
+               // .NET Framework 2.0 can deserialize them using a proxy.
+               // This class supports serialization compatibility.
+               //
+
+               [Serializable]
+               private sealed class Encoder : ISerializable, IObjectReference
+               {
+                       private Encoding encoding;
+
+                       private Encoder (SerializationInfo info, 
StreamingContext context)
+                       {
+                               if (info == null)
+                                       throw new ArgumentNullException 
("info");
+
+                               this.encoding = (Encoding) info.GetValue 
("encoding", typeof (Encoding));
+                       }
+
+                       public void GetObjectData (SerializationInfo info, 
StreamingContext context)
+                       {
+                               throw new ArgumentException ("This class cannot 
be serialized.");
+                       }
+
+                       public object GetRealObject (StreamingContext context)
+                       {
+                               return this.encoding.GetEncoder ();
+                       }
+               }
+
+               //
+               // .NET Framework 1.x uses this class for multi-byte decoders 
and
+               // .NET Framework 2.0 can deserialize them using a proxy.
+               // This class supports serialization compatibility.
+               //
+
+               [Serializable]
+               private sealed class Decoder : ISerializable, IObjectReference
+               {
+                       private Encoding encoding;
+
+                       private Decoder (SerializationInfo info, 
StreamingContext context)
+                       {
+                               if (info == null)
+                                       throw new ArgumentNullException 
("info");
+
+                               this.encoding = (Encoding) info.GetValue 
("encoding", typeof (Encoding));
+                       }
+
+                       public void GetObjectData (SerializationInfo info, 
StreamingContext context)
+                       {
+                               throw new ArgumentException ("This class cannot 
be serialized.");
+                       }
+
+                       public object GetRealObject (StreamingContext context)
+                       {
+                               return this.encoding.GetDecoder ();
+                       }
+               }
+
+               private int codePage;
+#if NET_2_0
+               private bool isReadOnly;
+               private EncoderFallback encoderFallback;
+               private DecoderFallback decoderFallback;
+#endif
+
+               private MLangCodePageEncoding (SerializationInfo info, 
StreamingContext context)
+               {
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+
+                       this.codePage = (int) info.GetValue ("m_codePage", 
typeof (int));
+
+#if NET_2_0
+                       try {
+                               this.isReadOnly = (bool) info.GetValue 
("m_isReadOnly", typeof (bool));
+                               this.encoderFallback = (EncoderFallback) 
info.GetValue ("encoderFallback", typeof (EncoderFallback));
+                               this.decoderFallback = (DecoderFallback) 
info.GetValue ("decoderFallback", typeof (DecoderFallback));
+                       } catch (SerializationException) {
+                               this.isReadOnly = true;
+                       }
+#endif
+               }
+
+               public void GetObjectData (SerializationInfo info, 
StreamingContext context)
+               {
+                       throw new ArgumentException ("This class cannot be 
serialized.");
+               }
+
+               public object GetRealObject (StreamingContext context)
+               {
+                       Encoding encoding = Encoding.GetEncoding 
(this.codePage);
+
+#if NET_2_0
+                       if (!this.isReadOnly) {
+                               encoding = (Encoding) encoding.Clone ();
+                               encoding.EncoderFallback = this.encoderFallback;
+                               encoding.DecoderFallback = this.decoderFallback;
+                       }
+#endif
+
+                       return encoding;
+               }
+       }
+}


Property changes on: trunk/mcs/class/corlib/System.Text/MLangCodePageEncoding.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/mcs/class/corlib/System.Text/SurrogateEncoder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Text/SurrogateEncoder.cs      2006-07-03 
19:26:44 UTC (rev 62234)
+++ trunk/mcs/class/corlib/System.Text/SurrogateEncoder.cs      2006-07-03 
19:58:11 UTC (rev 62235)
@@ -0,0 +1,65 @@
+//
+// System.Text.SurrogateEncoder.cs
+//
+// Author:
+//   Korn�l P�l <http://www.kornelpal.hu/>
+//
+// Copyright (C) 2006 Korn�l P�l
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+//
+// .NET Framework 1.x uses this class for GB18030 encoder and
+// .NET Framework 2.0 can deserialize it using a proxy.
+// This class supports serialization compatibility.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Text
+{
+       [Serializable]
+       internal sealed class SurrogateEncoder : ISerializable, IObjectReference
+       {
+               private Encoding encoding;
+
+               private SurrogateEncoder (SerializationInfo info, 
StreamingContext context)
+               {
+                       if (info == null)
+                               throw new ArgumentNullException ("info");
+
+                       this.encoding = (Encoding) info.GetValue ("m_encoding", 
typeof (Encoding));
+               }
+
+               public void GetObjectData (SerializationInfo info, 
StreamingContext context)
+               {
+                       throw new ArgumentException ("This class cannot be 
serialized.");
+               }
+
+               public object GetRealObject (StreamingContext context)
+               {
+                       return this.encoding.GetEncoder ();
+               }
+       }
+}


Property changes on: trunk/mcs/class/corlib/System.Text/SurrogateEncoder.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/mcs/class/corlib/corlib.dll.sources
===================================================================
--- trunk/mcs/class/corlib/corlib.dll.sources   2006-07-03 19:26:44 UTC (rev 
62234)
+++ trunk/mcs/class/corlib/corlib.dll.sources   2006-07-03 19:58:11 UTC (rev 
62235)
@@ -301,6 +301,7 @@
 System.Globalization/CalendarWeekRule.cs
 System.Globalization/CalendricalCalculations.cs
 System.Globalization/CharUnicodeInfo.cs
+System.Globalization/CodePageDataItem.cs
 System.Globalization/CompareInfo.cs
 System.Globalization/CompareOptions.cs
 System.Globalization/CultureInfo.cs
@@ -1258,6 +1259,7 @@
 System.Security.Principal/WindowsImpersonationContext.cs
 System.Security.Principal/WindowsPrincipal.cs
 System.Text/ASCIIEncoding.cs
+System.Text/CodePageEncoding.cs
 System.Text/Decoder.cs
 System.Text/DecoderExceptionFallback.cs
 System.Text/DecoderExceptionFallbackBuffer.cs
@@ -1277,8 +1279,10 @@
 System.Text/Encoding.cs
 System.Text/EncodingInfo.cs
 System.Text/Latin1Encoding.cs
+System.Text/MLangCodePageEncoding.cs
 System.Text/NormalizationForm.cs
 System.Text/StringBuilder.cs
+System.Text/SurrogateEncoder.cs
 System.Text/UnicodeEncoding.cs
 System.Text/UTF7Encoding.cs
 System.Text/UTF8Encoding.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to