2008-05-08 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Thu, 8 May 2008 22:20:07 +0000 (22:20 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 8 May 2008 22:20:07 +0000 (22:20 -0000)
* ResourceSet.cs: Pass the ignoreCase argument, needed to
implement ResourceManager.IgnoreCase.

Silverlight 2.0 applications store "page.xaml" as the key in the
resource keys, but request Page.xaml ones.

* ResourceManager.cs: Avoid exception throwing and catching.

* RutimeResourceSet.cs: Add a constructor that is required to
deserialize Silverlight 2.0 applications when deserializing the
resources that contains the XAML files in assemblies.

We do not take advantage of this new constructor that uses an
IntPtrStream, instead we stick to the Stream API.

svn path=/trunk/mcs/; revision=102841

mcs/class/corlib/System.Resources/ChangeLog
mcs/class/corlib/System.Resources/ResourceManager.cs
mcs/class/corlib/System.Resources/ResourceSet.cs
mcs/class/corlib/System.Resources/RuntimeResourceSet.cs

index f3bb7c43af54d3cdb5c5eeb1a629fe09843e88ea..000dc0e6d3e0d806c2e193c2aed6fabe08e49479 100644 (file)
@@ -1,3 +1,20 @@
+2008-05-08  Miguel de Icaza  <miguel@novell.com>
+
+       * ResourceSet.cs: Pass the ignoreCase argument, needed to
+       implement ResourceManager.IgnoreCase.
+
+       Silverlight 2.0 applications store "page.xaml" as the key in the
+       resource keys, but request Page.xaml ones.
+
+       * ResourceManager.cs: Avoid exception throwing and catching.
+
+       * RutimeResourceSet.cs: Add a constructor that is required to
+       deserialize Silverlight 2.0 applications when deserializing the
+       resources that contains the XAML files in assemblies.
+
+       We do not take advantage of this new constructor that uses an
+       IntPtrStream, instead we stick to the Stream API.
+
 2008-03-29  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * Win32Resources.cs: On 2.0 profile, initiale fixed info to zero-length
index 37d2b13c7594f0683892fea49c34940446f6afe7..a9986afab589f025a6d38175cc49a1140bdeabde 100644 (file)
@@ -300,7 +300,7 @@ namespace System.Resources
                        if (culture == null)
                                culture = CultureInfo.CurrentUICulture;
                        ResourceSet set = InternalGetResourceSet (culture, true, true);
-                       return set.GetStream (name);
+                       return set.GetStream (name, ignoreCase);
                }
 #endif
                protected virtual ResourceSet InternalGetResourceSet (CultureInfo culture, bool Createifnotexists, bool tryParents)
@@ -330,9 +330,11 @@ namespace System.Resources
                                        try {
                                                Assembly a = MainAssembly.GetSatelliteAssembly (
                                                        resourceCulture, sat_version);
-                                               stream = a.GetManifestResourceStream (filename);
-                                               if (stream == null)
-                                                       stream = GetManifestResourceStreamNoCase (a, filename);
+                                               if (a != null){
+                                                       stream = a.GetManifestResourceStream (filename);
+                                                       if (stream == null)
+                                                               stream = GetManifestResourceStreamNoCase (a, filename);
+                                               }
                                        } catch (Exception) {
                                                // Ignored
                                        }
index 4f466e29f0c6189d488e96a71daa44fe67e537be..9d628abec67e6348b5a45f59d81be643ef9bd2d5 100644 (file)
@@ -77,6 +77,11 @@ namespace System.Resources
                        Reader = new ResourceReader (stream);
                }
 
+               internal ResourceSet (IntPtrStream stream)
+               {
+                       Reader = new ResourceReader (stream);
+               }
+               
                public ResourceSet (string fileName)
                {
                        Reader = new ResourceReader (fileName);
@@ -217,16 +222,17 @@ namespace System.Resources
                }
 
 #if NET_2_0
-               internal UnmanagedMemoryStream GetStream (string name)
+               internal UnmanagedMemoryStream GetStream (string name, bool ignoreCase)
                {
                        if (Reader == null)
                                throw new ObjectDisposedException ("ResourceSet is closed.");
 
                        IDictionaryEnumerator i = Reader.GetEnumerator();
                        i.Reset ();
-                       while (i.MoveNext ())
-                               if (name == (string) i.Key)
+                       while (i.MoveNext ()){
+                               if (String.Compare (name, (string) i.Key, ignoreCase) == 0)
                                        return ((ResourceReader.ResourceEnumerator) i).ValueAsStream;
+                       }
                        return null;
                }
 #endif
index 2baba9b7dc831b32f0e8b9d6e6aacf575c5948a1..fd3a293d4ec07b7f48b5f96762fe0fca88937ae8 100644 (file)
@@ -35,6 +35,11 @@ namespace System.Resources {
        [Serializable]
        internal class RuntimeResourceSet : ResourceSet {
 
+               // Constructor for Activator.CreateInstance from Silverlight
+               public RuntimeResourceSet (IntPtrStream stream) : base (stream)
+               {
+               }
+               
                public RuntimeResourceSet (Stream stream) :
                        base (stream)
                {