+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
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)
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
}
Reader = new ResourceReader (stream);
}
+ internal ResourceSet (IntPtrStream stream)
+ {
+ Reader = new ResourceReader (stream);
+ }
+
public ResourceSet (string fileName)
{
Reader = new ResourceReader (fileName);
}
#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
[Serializable]
internal class RuntimeResourceSet : ResourceSet {
+ // Constructor for Activator.CreateInstance from Silverlight
+ public RuntimeResourceSet (IntPtrStream stream) : base (stream)
+ {
+ }
+
public RuntimeResourceSet (Stream stream) :
base (stream)
{