Author: robertj
Date: 2005-12-01 14:08:58 -0500 (Thu, 01 Dec 2005)
New Revision: 53785

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
Log:
2005-12-01  Robert Jordan  <[EMAIL PROTECTED]>

        * ResXResourceReader.cs: Handle 
mimetype="application/x-microsoft.net.object.bytearray.base64" correctly. Fixes 
the decoding of System.Byte[].
        * ResXResourceWriter.cs: Fixed AddResource (string, object) to pass
        control to AddResource (string, byte[]) if the value parameter is
        a byte[]. Removed the emitting of the mimetype attribute for
        System.Byte[].



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog    
2005-12-01 19:07:38 UTC (rev 53784)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Resources/ChangeLog    
2005-12-01 19:08:58 UTC (rev 53785)
@@ -1,3 +1,11 @@
+2005-12-01  Robert Jordan  <[EMAIL PROTECTED]>
+
+       * ResXResourceReader.cs: Handle 
mimetype="application/x-microsoft.net.object.bytearray.base64" correctly. Fixes 
the decoding of System.Byte[].
+       * ResXResourceWriter.cs: Fixed AddResource (string, object) to pass
+       control to AddResource (string, byte[]) if the value parameter is
+       a byte[]. Removed the emitting of the mimetype attribute for
+       System.Byte[].
+
 2005-11-30  Peter Bartok  <[EMAIL PROTECTED]>
 
        * ResXResourceReader.cs: Handle System.Byte[] encodings without

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs    
    2005-12-01 19:07:38 UTC (rev 53784)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceReader.cs    
    2005-12-01 19:08:58 UTC (rev 53785)
@@ -200,7 +200,7 @@
                                                object v = null;
                                                string val = get_value (reader, 
"value");
 
-                                               if (mt != null && tt != null) {
+                                               if (mt != null && tt != null && 
mt != ResXResourceWriter.ByteArraySerializedObjectMimeType) {
                                                        TypeConverter c = 
TypeDescriptor.GetConverter (tt);
                                                        v = c.ConvertFrom 
(Convert.FromBase64String (val));
                                                } else if (tt != null) {

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs    
    2005-12-01 19:07:38 UTC (rev 53784)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Resources/ResXResourceWriter.cs    
    2005-12-01 19:08:58 UTC (rev 53785)
@@ -145,7 +145,6 @@
 
                        if (typename != null) {
                                writer.WriteAttributeString ("type", typename);
-                               writer.WriteAttributeString ("mimetype", 
"application/x-microsoft.net.object.bytearray.base64");
                                writer.WriteStartElement ("value");
                                WriteNiceBase64(value, offset, length);
                        } else {
@@ -201,6 +200,16 @@
 
                public void AddResource (string name, object value)
                {
+                       if (value is string) {
+                               AddResource (name, (string) value);
+                               return;
+                       }
+
+                       if (value is byte[]) {
+                               AddResource (name, (byte[]) value);
+                               return;
+                       }
+
                        if (name == null)
                                throw new ArgumentNullException ("name");
 
@@ -213,11 +222,6 @@
                        if (writer == null)
                                InitWriter ();
 
-                        if (value is string) {
-                                WriteString (name, (string) value);
-                                return;
-                        }
-
                        TypeConverter converter = TypeDescriptor.GetConverter 
(value);
                        if (converter != null && converter.CanConvertTo (typeof 
(string)) && converter.CanConvertFrom (typeof (string))) {
                                string str = (string) 
converter.ConvertToInvariantString (value);

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

Reply via email to