Author: atsushi
Date: 2007-05-28 12:02:23 -0400 (Mon, 28 May 2007)
New Revision: 78069

Added:
   trunk/mcs/class/corlib/Test/System.Resources/ResourceWriterTest.cs
Modified:
   trunk/mcs/class/corlib/ChangeLog
   trunk/mcs/class/corlib/System.Resources/ChangeLog
   trunk/mcs/class/corlib/System.Resources/ResourceWriter.cs
   trunk/mcs/class/corlib/Test/System.Resources/ChangeLog
   trunk/mcs/class/corlib/corlib_test.dll.sources
Log:
2007-05-28  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * ResourceWriter.cs : fix for runtime serialization type index.
          Fixed bug #81759.

        * ResourceWriterTest.cs : new test, contains one for bug #81759.

        * corlib_test.dll.sources : added ResourceWriterTest.cs.



Modified: trunk/mcs/class/corlib/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/ChangeLog    2007-05-28 15:44:03 UTC (rev 78068)
+++ trunk/mcs/class/corlib/ChangeLog    2007-05-28 16:02:23 UTC (rev 78069)
@@ -1,5 +1,9 @@
 2007-05-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * corlib_test.dll.sources : added ResourceWriterTest.cs.
+
+2007-05-25  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * corlib.dll.sources : added MissingSatelliteAssemblyException.cs
          and IdnMapping.cs. Removed obsolete 2.0 NotCancelableException.cs.
        * corlib_test.dll.sources : added IdnMappingTest.cs.

Modified: trunk/mcs/class/corlib/System.Resources/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Resources/ChangeLog   2007-05-28 15:44:03 UTC 
(rev 78068)
+++ trunk/mcs/class/corlib/System.Resources/ChangeLog   2007-05-28 16:02:23 UTC 
(rev 78069)
@@ -1,5 +1,10 @@
 2007-05-28  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * ResourceWriter.cs : fix for runtime serialization type index.
+         Fixed bug #81759.
+
+2007-05-28  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * ResourceWriter.cs : temporarily disable 2.0 output until I get
          bug #81759 fixed.
 

Modified: trunk/mcs/class/corlib/System.Resources/ResourceWriter.cs
===================================================================
--- trunk/mcs/class/corlib/System.Resources/ResourceWriter.cs   2007-05-28 
15:44:03 UTC (rev 78068)
+++ trunk/mcs/class/corlib/System.Resources/ResourceWriter.cs   2007-05-28 
16:02:23 UTC (rev 78069)
@@ -56,7 +56,7 @@
                        }
                }
 
-#if NET_2_0_temporarily_disabled
+#if NET_2_0
                SortedList resources = new SortedList (StringComparer.Ordinal);
 #else
                Hashtable resources = new 
Hashtable(CaseInsensitiveHashCodeProvider.Default, 
CaseInsensitiveComparer.Default);
@@ -155,7 +155,7 @@
                        stream=null;
                }
 
-#if NET_2_0_temporarily_disabled
+#if NET_2_0
                public void AddResourceData (string name, string typeName, byte 
[] serializedData)
                {
                        if (name == null)
@@ -202,7 +202,7 @@
                                                             Encoding.UTF8);
 
                        
resman.Write(typeof(ResourceReader).AssemblyQualifiedName);
-#if NET_2_0_temporarily_disabled
+#if NET_2_0
                        resman.Write(typeof(ResourceSet).FullName);
 #else
                        resman.Write(typeof(ResourceSet).AssemblyQualifiedName);
@@ -261,7 +261,7 @@
                                object typeObj = tbn != null ? (object) 
tbn.TypeName : type;
 
                                /* Keep a list of unique types */
-#if NET_2_0_temporarily_disabled
+#if NET_2_0
                                // do not output predefined ones.
                                switch (type != null ? Type.GetTypeCode (type) 
: TypeCode.Empty) {
                                case TypeCode.Decimal:
@@ -289,7 +289,7 @@
                                        if (!types.Contains (typeObj))
                                                types.Add (typeObj);
                                        /* Write the data section */
-                                       Write7BitEncodedInt(res_data, 
types.IndexOf(typeObj));
+                                       Write7BitEncodedInt(res_data, (int) 
PredefinedResourceType.FistCustom + types.IndexOf(typeObj));
                                        break;
                                }
 #else
@@ -302,7 +302,7 @@
                                /* Strangely, Char is serialized
                                 * rather than just written out
                                 */
-#if NET_2_0_temporarily_disabled
+#if NET_2_0
                                if (tbn != null)
                                        res_data.Write((byte []) tbn.Value);
                                else if (type==typeof(Byte)) {
@@ -410,7 +410,7 @@
                        
                        /* now do the ResourceReader header */
 
-#if NET_2_0_temporarily_disabled
+#if NET_2_0
                        writer.Write(2);
 #else
                        writer.Write(1);

Modified: trunk/mcs/class/corlib/Test/System.Resources/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Resources/ChangeLog      2007-05-28 
15:44:03 UTC (rev 78068)
+++ trunk/mcs/class/corlib/Test/System.Resources/ChangeLog      2007-05-28 
16:02:23 UTC (rev 78069)
@@ -1,5 +1,9 @@
 2007-05-28  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * ResourceWriterTest.cs : new test, contains one for bug #81759.
+
+2007-05-28  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * ResourceManagerTest.cs : added tests for GetStream() (including
          2.0 resource format tests).
 

Added: trunk/mcs/class/corlib/Test/System.Resources/ResourceWriterTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Resources/ResourceWriterTest.cs  
2007-05-28 15:44:03 UTC (rev 78068)
+++ trunk/mcs/class/corlib/Test/System.Resources/ResourceWriterTest.cs  
2007-05-28 16:02:23 UTC (rev 78069)
@@ -0,0 +1,43 @@
+//
+// ResourceWriterTest.cs
+//
+// Author:
+//   Atsushi Enomoto  <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Novell, Inc. (http://www.novell.com)
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+using System.Resources;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources
+{
+       [TestFixture]
+       public class ResourceWriterTest
+       {
+#if NET_2_0
+               [Test]
+               public void Bug81759 ()
+               {
+                       MemoryStream ms = new MemoryStream ();
+                       using (ResourceReader xr = new ResourceReader (
+                               "Test/resources/bug81759.resources")) {
+                               ResourceWriter rw = new ResourceWriter (ms);
+                               foreach (DictionaryEntry de in xr)
+                                       rw.AddResource ((string) de.Key, 
de.Value);
+                               rw.Close ();
+                       }
+                       ResourceReader rr = new ResourceReader (new 
MemoryStream (ms.ToArray ()));
+                       foreach (DictionaryEntry de in rr) {
+                               Assert.AreEqual ("imageList.ImageSize", de.Key 
as string, "#1");
+                               Assert.AreEqual ("Size", de.Value.GetType 
().Name, "#2");
+                       }
+               }
+#endif
+       }
+}

Modified: trunk/mcs/class/corlib/corlib_test.dll.sources
===================================================================
--- trunk/mcs/class/corlib/corlib_test.dll.sources      2007-05-28 15:44:03 UTC 
(rev 78068)
+++ trunk/mcs/class/corlib/corlib_test.dll.sources      2007-05-28 16:02:23 UTC 
(rev 78069)
@@ -132,6 +132,7 @@
 System/ResolveEventArgsTest.cs
 System.Resources/ResourceReaderTest.cs
 System.Resources/ResourceManagerTest.cs
+System.Resources/ResourceWriterTest.cs
 System.Runtime.CompilerServices/RuntimeHelpersTest.cs
 System.Runtime.CompilerServices/RuntimeWrappedExceptionTest.cs
 System.Runtime.InteropServices/GCHandleTest.cs

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

Reply via email to