Prechádzať zdrojové kódy

[corlib] System.Resources from reference sources

Marek Safar 10 rokov pred
rodič
commit
52003dc6f7
23 zmenil súbory, kde vykonal 143 pridanie a 3142 odobranie
  1. 1 1
      external/referencesource
  2. 29 0
      mcs/class/corlib/System.Globalization/CultureInfo.cs
  3. 1 1
      mcs/class/corlib/System.IO/FileStream.cs
  4. 1 1
      mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
  5. 77 25
      mcs/class/corlib/System.Reflection/Assembly.cs
  6. 0 547
      mcs/class/corlib/System.Resources/ChangeLog
  7. 0 44
      mcs/class/corlib/System.Resources/IResourceReader.cs
  8. 0 48
      mcs/class/corlib/System.Resources/IResourceWriter.cs
  9. 0 64
      mcs/class/corlib/System.Resources/MissingManifestResourceException.cs
  10. 0 74
      mcs/class/corlib/System.Resources/MissingSatelliteAssemblyException.cs
  11. 0 76
      mcs/class/corlib/System.Resources/NeutralResourcesLanguageAttribute.cs
  12. 0 522
      mcs/class/corlib/System.Resources/ResourceManager.cs
  13. 0 669
      mcs/class/corlib/System.Resources/ResourceReader.cs
  14. 0 233
      mcs/class/corlib/System.Resources/ResourceSet.cs
  15. 0 520
      mcs/class/corlib/System.Resources/ResourceWriter.cs
  16. 0 76
      mcs/class/corlib/System.Resources/RuntimeResourceSet.cs
  17. 0 51
      mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs
  18. 0 38
      mcs/class/corlib/System.Resources/UltimateResourceFallbackLocation.cs
  19. 1 1
      mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs
  20. 5 0
      mcs/class/corlib/System.Threading/Thread.cs
  21. 3 137
      mcs/class/corlib/Test/System.Resources/ResourceManagerTest.cs
  22. 1 2
      mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs
  23. 24 12
      mcs/class/corlib/corlib.dll.sources

+ 1 - 1
external/referencesource

@@ -1 +1 @@
-Subproject commit 5edde4dc1408344eee26343a7c437b35d5685e9c
+Subproject commit 94631307256634e7c80d71f7fa59a2882b3ad3a2

+ 29 - 0
mcs/class/corlib/System.Globalization/CultureInfo.cs

@@ -1075,6 +1075,35 @@ namespace System.Globalization
             Contract.EndContractBlock();
         }
 
+        // For resource lookup, we consider a culture the invariant culture by name equality.
+        // We perform this check frequently during resource lookup, so adding a property for
+        // improved readability.
+        internal bool HasInvariantCultureName
+        {
+            get { return Name == CultureInfo.InvariantCulture.Name; }
+        }
+
+        internal static bool VerifyCultureName(String cultureName, bool throwException)
+        {
+            // This function is used by ResourceManager.GetResourceFileName(). 
+            // ResourceManager searches for resource using CultureInfo.Name,
+            // so we should check against CultureInfo.Name.
+
+            for (int i=0; i<cultureName.Length; i++) {
+                char c = cultureName[i];
+                // 
+
+                if (Char.IsLetterOrDigit(c) || c=='-' || c=='_') {
+                    continue;
+                }
+                if (throwException) {
+                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidResourceCultureName", cultureName));
+                }
+                return false;
+            }
+            return true;
+        }
+
 #endregion
 	}
 }

+ 1 - 1
mcs/class/corlib/System.IO/FileStream.cs

@@ -148,7 +148,7 @@ namespace System.IO
 		}
 #endif
 
-		internal FileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath, bool checkHost)
+		internal FileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath = false, bool checkHost = false)
 			: this (path, mode, access, share, bufferSize, false, options)
 		{
 		}

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs

@@ -723,7 +723,7 @@ namespace System.Reflection.Emit {
 					if (resource_writers != null && (rwriter = resource_writers [resources [i].name] as IResourceWriter) != null) {
 						ResourceWriter writer = (ResourceWriter)rwriter;
 						writer.Generate ();
-						MemoryStream mstream = (MemoryStream)writer.Stream;
+						MemoryStream mstream = (MemoryStream)writer._output;
 						resources [i].data = new byte [mstream.Length];
 						mstream.Seek (0, SeekOrigin.Begin);
 						mstream.Read (resources [i].data, 0, (int)mstream.Length);

+ 77 - 25
mcs/class/corlib/System.Reflection/Assembly.cs

@@ -39,6 +39,9 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Collections.Generic;
 using System.Configuration.Assemblies;
+using System.Threading;
+using System.Text;
+using System.Diagnostics.Contracts;
 
 using Mono.Security;
 
@@ -337,19 +340,58 @@ namespace System.Reflection {
 
 		public virtual Stream GetManifestResourceStream (Type type, String name)
 		{
-			string ns;
-			if (type != null) {
-				ns = type.Namespace;
-			} else {
+			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+			return GetManifestResourceStream(type, name, false, ref stackMark);
+		}
+
+		internal Stream GetManifestResourceStream (Type type, String name, bool skipSecurityCheck, ref StackCrawlMark stackMark)
+		{
+			StringBuilder sb = new StringBuilder ();
+			if (type == null) {
 				if (name == null)
-					throw new ArgumentNullException ("type");
-				ns = null;
+						throw new ArgumentNullException ("type");
+			} else {
+				String nameSpace = type.Namespace;
+				if (nameSpace != null) {
+					sb.Append (nameSpace);
+					if (name != null)
+						sb.Append (Type.Delimiter);
+				}
 			}
 
-			if (ns == null || ns.Length == 0)
-				return GetManifestResourceStream (name);
-			else
-				return GetManifestResourceStream (ns + "." + name);
+			if (name != null)
+				sb.Append(name);
+
+			return GetManifestResourceStream (sb.ToString());
+		}
+
+		internal unsafe Stream GetManifestResourceStream(String name, ref StackCrawlMark stackMark, bool skipSecurityCheck)
+		{
+			return GetManifestResourceStream (null, name, skipSecurityCheck, ref stackMark);
+		}
+
+		internal String GetSimpleName()
+		{
+			AssemblyName aname = GetName (true);
+			return aname.Name;
+		}
+
+		internal byte[] GetPublicKey()
+		{
+			AssemblyName aname = GetName (true);
+			return aname.GetPublicKey ();
+		}
+
+		internal Version GetVersion()
+		{
+			AssemblyName aname = GetName (true);
+			return aname.Version;
+		}
+
+		private AssemblyNameFlags GetFlags()
+		{
+			AssemblyName aname = GetName (true);
+			return aname.Flags;
 		}
 
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -435,28 +477,38 @@ namespace System.Reflection {
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
 		public static extern Assembly GetEntryAssembly();
 
-		internal Assembly GetSatelliteAssemblyNoThrow (CultureInfo culture, Version version)
+		internal Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError)
 		{
-			return GetSatelliteAssembly (culture, version, false);
+			if (culture == null)
+				throw new ArgumentNullException("culture");
+			Contract.EndContractBlock();
+
+			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+			String name = GetSimpleName() + ".resources";
+			return InternalGetSatelliteAssembly(name, culture, version, true, ref stackMark);
 		}
 
-		internal Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError)
+		internal RuntimeAssembly InternalGetSatelliteAssembly (String name, CultureInfo culture, Version version, bool throwOnFileNotFound, ref StackCrawlMark stackMark)
 		{
-			if (culture == null)
-				throw new ArgumentException ("culture");
+			AssemblyName an = new AssemblyName ();
 
-			AssemblyName aname = GetName (true);
-			if (version != null)
-				aname.Version = version;
+			an.SetPublicKey (GetPublicKey ());
+			an.Flags = GetFlags () | AssemblyNameFlags.PublicKey;
+
+			if (version == null)
+				an.Version = GetVersion ();
+			else
+				an.Version = version;
+
+			an.CultureInfo = culture;
+			an.Name = name;
 
-			aname.CultureInfo = culture;
-			aname.Name = aname.Name + ".resources";
 			Assembly assembly;
 
 			try {
-				assembly = AppDomain.CurrentDomain.LoadSatellite (aname, false);
+				assembly = AppDomain.CurrentDomain.LoadSatellite (an, false);
 				if (assembly != null)
-					return assembly;
+					return (RuntimeAssembly)assembly;
 			} catch (FileNotFoundException) {
 				assembly = null;
 				// ignore
@@ -464,11 +516,11 @@ namespace System.Reflection {
 
 			// Try the assembly directory
 			string location = Path.GetDirectoryName (Location);
-			string fullName = Path.Combine (location, Path.Combine (culture.Name, aname.Name + ".dll"));
-			if (!throwOnError && !File.Exists (fullName))
+			string fullName = Path.Combine (location, Path.Combine (culture.Name, an.Name + ".dll"));
+			if (!throwOnFileNotFound && !File.Exists (fullName))
 				return null;
 
-			return LoadFrom (fullName);
+			return (RuntimeAssembly)LoadFrom (fullName);
 		}
 
 #if !MOBILE

+ 0 - 547
mcs/class/corlib/System.Resources/ChangeLog

@@ -1,547 +0,0 @@
-2010-07-07  Carlos Alberto Cortez <[email protected]>
-
-	4.0 updates.
-
-	* ResourceManager.cs: Mark ResourceSets as obsolete.
-	* ResourceReader.cs: New public Dispose method.
-
-2010-07-05  Carlos Alberto Cortez <[email protected]>
-
-	* ResourceWriter.cs: Implement 4.0 TypeNameConverter.
-
-2010-07-05  Carlos Alberto Cortez <[email protected]>
-
-	* ResourceWriter.cs: Implement 4.0 AddResource overloads taking a
-	Stream, as well as implement the same support in our AddResource that
-	takes an object too.
-
-2010-03-16  Jb Evain  <[email protected]>
-
-	* ResourceManager.cs: use MOONLIGHT symbol to disambiguate
-	MonoTouch and Moonlight code.
-
-2010-03-01  Miguel de Icaza  <[email protected]>
-
-	* Win32Resources.cs: Prevent infinite loops if the resource that
-	we are reading is invalid.   Fixes the mscorlib part of #327500
-
-2009-11-01  Sebastien Pouliot  <[email protected]>
-
-	* ResourceManager.cs (GetResourceFilePath): Don't use 
-	'resourceDir' which should always be null for Moonlight
-
-2009-10-19  Jb Evain  <[email protected]>
-
-	* ResourceReader.cs: fix the build.
-
-2009-10-18  Sebastien Pouliot  <[email protected]>
-
-	* ResourceReader.cs, ResourceSet.cs, RuntimeResourceSet.cs: Use 
-	UnmanagedMemoryStream (instead of IntPtrStream)
-
-2009-04-16  Geoff Norton  <[email protected]>
-
-	* ResourceWriter.cs: The magic internal type here is required to match
-	Microsofts for SL2 resource deserialization.
-
-2009-03-06 Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceSet.cs: for custom resource sets without a reader, pretende
-	that's we've already read the stream.
-
-2009-02-27 Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceSet.cs: populating the resource should be locked because the
-	resourceset could be shared.
-
-2009-01-24 Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: don't throw every time we try to load a resource
-	satellite assembly that does not exist.
-
-2008-12-22 Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: cache negative results too.
-
-2008-12-18 Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: avoid duplication of keys if more than one
-	thread is creating the ResourceSet.
-
-2008-12-17 Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: cache ResourceSets instead of loading them from
-	their assembly every time they are needed.
-
-2008-08-11  Larry Ewing  <[email protected]>
-
-	* ResourceReader.cs: fix reading/writing beyond the end of the
-	current resource when the resource is larger than 1024 bytes.
-
-2008-06-30  Marek Safar  <[email protected]>
-
-	* ResourceReader.cs: Cache resources enumerator in ResourceReader.
-
-2008-06-30  Marek Safar  <[email protected]>
-
-	* ResourceReader.cs: Sealed ResourceEnumerator.
-
-2008-06-28  Rodrigo Kumpera  <[email protected]>
-
-	* ResourceReader.cs (LoadResourceValues): Kill ununsed local.
-
-	* ResourceReader.cs (CreateResourceInfo): Don't return a big
-	struct on stack, pass it as a reference argument.
-
-2008-06-27  Rodrigo Kumpera  <[email protected]>
-
-	* ResourceReader.cs: Avoid an extra array copy for the resource arrays.
-
-2008-06-27  Zoltan Varga  <[email protected]>
-
-	* ResourceManager.cs: Add a negative cache for culture->resource set mappings
-	which caches lookup failures.
-
-	* ResourceSet.cs (GetObjectInternal): Search the hash table in the ignoreCase
-	case too.
-
-2008-06-27  Andreas Nahr <[email protected]>
-
-	* MissingManifestResourceException.cs:
-	* MissingSatelliteAssemblyException.cs:
-	* ResourceManager.cs: Fix parameter names
-
-2008-05-27  Marek Habersack  <[email protected]>
-
-	* ResourceReader.cs: reimplement the way resources are read when
-	enumerator is used. The resource indexes and names are read in
-	ReadHeaders when ResourceReader is created and the resource values
-	are read and cached when the enumerator is created. This removed a
-	lot of unnecessary locking and made the whole process more
-	efficient and faster (a test application would acquire the locks
-	40000 times durng a 1.7s run, right now it acquires the lock 1
-	time).
-
-2008-05-08  Miguel de Icaza  <[email protected]>
-
-	* 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  <[email protected]>
-
-	* Win32Resources.cs: On 2.0 profile, initiale fixed info to zero-length
-	string when emitting versioninfo in compiler context. Default to
-	neutral language in compiler context. On 1.0 profile, use 0xffff as
-	default value for version parts. In Version, abort on first invalid
-	version part and also set FileVersion string. In ProductVersion and
-	FileVersion, parse version string and abort on first invalid version
-	part.  
-
-2008-03-15  Gert Driesen  <[email protected]>
-
-	* ResourceManager.cs: Default to RuntimeResourceSet for all ctors.
-	* ResourceSet.cs: Avoid duplicate argument checks. On 2.0 profile,
-	throw ObjectDisposedException when ResourceSet is disposed.
-	* RuntimeResourceSet.cs: On 2.0 profile, throw ObjectDisposedException
-	when ResourceSet is disposed.
-
-2008-03-04  Sebastien Pouliot  <[email protected]>
-
-	* ResourceManager.cs: Use RuntimeResourceSet, an internal type, just
-	like MS does (and tell us indirectly with a Type property).
-	* ResourceSet.cs: Fix a few problems found with new unit tests. Also
-	fix some exception parameters.
-	* RuntimeResourceSet.cs: New. Internal type used by ResourceManager.
-	ResouceSet cannot be used, as is, because it does not clone objects,
-	when possible, leading to problems when those objects are disposed.
-
-2008-01-26  Gert Driesen  <[email protected]>
-
-	* ResourceWriter.cs: On 2.0 profile, do not mistakenly identify an
-	enum as a predefined type. Fixes bug #325223.
-
-2007-11-10  Gert Driesen  <[email protected]>
-
-	* ResourceWriter.cs: On 2.0 profile, use case-insensitive SortedList.
-	Changed exception messages and params to match MS. Allow null values
-	in AddResource overloads. In Dispose (bool), also generate resources
-	(header) if no resources were added. Fixes bug #339074. When Generate
-	is done, reset resources to null to prevent further editing.  This
-	also avoids the need for a separate bool to indicate whether generate
-	was already invoked. Code formatting.
-
-2007-10-27  Gert Driesen  <[email protected]>
-
-	* ResourceManager.cs: Removed temporary workaround for bug #43567.
-	Reworked basename to only throw ArgumentException if resource with
-	name ending on ".resources" does not actually exist. Fixes bug
-	#336283. Do not throw exception in GetStream since this is already
-	done in InternalGetResourceSet. In InternalGetResourceSet, do not
-	throw MissingManifestResourceException when culture is null. Fixed
-	MissingManifestResourceException message to match MS. When using
-	file-based ResourceManager, then also throw an exception when file
-	does not exist for neutral culture.
-
-2007-09-17  Gert Driesen  <[email protected]>
-
-	* ResourceManager.cs: Move code for determining manifest resource
-	name into separate method. Only use satellite assemblies for
-	non-invariant cultures. For invariant culture, only load resources
-	from main assembly.
-
-2007-09-17  Gert Driesen  <[email protected]>
-
-	* ResourceManager.cs: BaseName(Field) should return only the name.
-	Added resourceSource field to store the actual type, which we need for
-	the namespace. Added CheckBaseName method to avoid code duplication.
-	Only check whether basename does not end in '.resources' on 1.0
-	profile. Fixed paramname of ArgumentNullExceptions to match MS.
-	Modified GetManifestResourceStreamNoCase to use resourceSource field
-	to construct manifest resource name. Modified GetStream to use
-	CurrentUICulture when culture is null. Fixed InternalGetResourceSet
-	to use invariant resources when culture is the neutral culture.
-	Code formatting.
->
-2007-08-24  Gert Driesen  <[email protected]>
-
-	* ResourceReader.cs: Fixed exception message to match MS. Removed
-	duplicate checks from string ctor.
-
-2007-08-09  Atsushi Enomoto  <[email protected]>
-
-	* ResourceReader.cs : implemented GetResourceData(). Resources with
-	  unresolvable types could still be parsed, so hold type names
-	  instead of types.
-
-2007-07-16  Rodrigo Kumpera  <[email protected]>
-
-	* ResourceReader.cs (ResourceValue): Put the null resource check
-	  before the resource version 2 check, this fixes bug #81757
-
-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.
-
-2007-05-28  Atsushi Enomoto  <[email protected]>
-
-	* IResourceWriter.cs NeutralResourcesLanguageAttribute.cs
-	  SatelliteContractVersionAttribute.cs ResourceManager.cs
-	  IResourceReader.cs ResourceSet.cs ResourceWriter.cs
-	  ResourceReader.cs UltimateResourceFallbackLocation.cs
-	  MissingManifestResourceException.cs :
-	  implemented 2.0 resource support (write, and remaining read bits)
-	  and GetStream(). Cosmetic attributes fixes.
-
-2007-05-25  Atsushi Enomoto  <[email protected]>
-
-	* MissingSatelliteAssemblyException.cs : new file.
-
-2007-02-16  Gert Driesen  <[email protected]>
-
-	* ResourceReader.cs: Fixed typo.
-
-2006-12-30  Alexander Olk  <[email protected]>
-
-	* ResourceManager.cs: Don't create the ResourceSets hashtable in the
-	protected ctor, instead move it to the public ctors. Fixes some not
-	working nunit tests. Also, return a closed ResourceSet instead of
-	creating a new one. Fixes one more test. If only BaseNameField is
-	provided, try to create a resource set from the BaseNameField. One
-	more test that passes now.
-	* ResourceSet.cs: Remove isDisposed. Not needed anymore.
-
-2006-12-30  Alexander Olk  <[email protected]>
-
-	* ResourceManager.cs: Iterate through the values of the ResourceSets
-	hashtable in ReleaseAllResources instead through the hashtable itself.
-
-2006-12-30  Gert Driesen  <[email protected]>
-
-	* ResourceReader.cs: Support reading byte arrays in v2 resource files.
-	Patch provided by Red Forks. Fixes bug #79976.
-
-2006-10-29  Alexander Olk  <[email protected]>
-
-	* ResourceSet.cs, ResourceManager.cs: Calling ResourceSet.Close()
-	  disposes a resource set. A closed resource set will now be
-	  removed from ResourceSets. Fixes bug #79182.
-
-2006-03-14  Robert Jordan  <[email protected]>
-
-	* ResourceManager.cs: Don't stop the resource set lookup until
-	the invariant culture is reached. Fixes bug #77242.
-
-2005-11-19  Zoltan Varga  <[email protected]>
-
-	* Win32Resources.cs: Add a new 'FileVersion' property.
-
-2005-07-25  Marek Safar  <[email protected]>
-
-	*  ResourceReader.cs: Implemented reading of primitives for version 2.
-
-2005-03-31  Sebastien Pouliot  <[email protected]>
-
-	*  ResourceReader.cs, ResourceSet.cs: Added a LinkDemand for 
-	SerializationFormatter when using a Stream constructor (other ctors
-	have different security - e.g. FileIOPermission for opening a file).
-
-2005-03-22 Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: use culture.Equals in InternalGetResourceSet().
-
-2005-02-12  Geoff Norton  <[email protected]>
-
-	* ResourceReader.cs: If a resource type index is -1 return null 
-	instead of throwing an exception
-	* ResourceWriter.cs: If an object is null; encode it with type index
-	-1 instead of throwing an exception.
-	
-2005-02-11  Zoltan Varga  <[email protected]>
-
-	* Win32Resources.cs: Fix warning.
-
-2004-12-06  Ben Maurer  <[email protected]>
-
-	* ResourceManager.cs (InternalResourceManager): on msft, they
-	search for a case-insenstitive match too here.
-
-2004-05-02  Sebastien Pouliot  <[email protected]>
-
-	* ResourceManager.cs: Avoid endless recursion when a resource file
-	isn't found.
-
-2004-04-08  Lluis Sanchez <[email protected]>
-
-	* ResourceSet.cs: Added minor null check.
-
-2004-02-03  Jackson Harper <[email protected]>
-
-	* ResourceSet.cs: Do not throw an exception for null strings.
-	
-2004-01-13  Zoltan Varga  <[email protected]>
-
-	* Win32Resources.cs (Win32VersionInfoResource): Add more properties.
-
-2004-01-09  Zoltan Varga  <[email protected]>
-
-	* Win32Resources.cs (Win32VersionInfoResource:WriteTo): Add padding
-	at the end of each string entry.
-
-	* Win32Resources.cs: Fix warnings not detected by mcs.
-
-2004-01-08  Zoltan Varga  <[email protected]>
-
-	* Win32Resources.cs: Organize win32 resources into a class hierarchy
-	with the class Win32Resource as the abstract superclass. Add 
-	Win32ResFileReader and Win32IconFileReader classes and the 
-	corresponding resource types.
-
-	* Win32Resources.cs (Win32VersionInfoResource): Fix version number 
-	calculation. Add Language property.
-
-2004-01-05  Zoltan Varga  <[email protected]>
-
-	* Win32Resources.cs: New file.
-
-	* Win32Resources.cs: The value of properties can't be empty.
-
-	* Win32Resources.cs: Add Win32ResourceType enumeration. Add accessors
-	for well-known property names. Add missing namespace declaration.
-
-2003-12-17  Zoltan Varga  <[email protected]>
-
-	* ResourceWriter.cs (Stream): New internal property used by Ref.Emit.
-
-2003-11-28  Dick Porter  <[email protected]>
-
-	* ResourceSet.cs: Do string compares with the Invariant culture.
-
-2003-11-18  Andreas Nahr <[email protected]>
-
-	* ResourceSet.cs: Implemented v1.1 updates
-
-2003-09-07  Dick Porter  <[email protected]>
-
-	* Temporary workaround for bug 43567, so that Npgsql at least
-	can run.
-
-2003-05-06  Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: fixed infinite loop when the resource is not
-	found. Also fixes bug #34196.
-
-2003-05-04  Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: enabled the code that calls GetSatelliteAssembly
-	and ignore the exception thrown if the assembly cannot be loaded.
-
-2003-05-04  Gonzalo Paniagua Javier <[email protected]>
-
-	* ResourceManager.cs: fixed the name for the file when the culture is
-	not de invariant culture. Commented out the GetSatelliteAssembly code
-	to avoid NotImplementedException being thrown.
-
-2002-08-19  Dick Porter  <[email protected]>
-
-	* ResourceWriter.cs: Implemented all methods
-
-	* ResourceReader.cs: Cope with our ResourceSet class name, as well
-	as theirs
-
-2002-08-18  Dick Porter  <[email protected]>
-
-	* ResourceReader.cs: Finished basic implementation.  Some
-	optimisation in conjunction with ResourceSet still possible though
-
-2002-08-14  Dick Porter  <[email protected]>
-
-	* ResourceSet.cs: Throw the correct exceptions
-
-	* ResourceManager.cs: Implemented all unfinished methods
-
-2002-03-12  Duncan Mak  <[email protected]>
-
-	* MissingManifestResourceException.cs: This should inherit from
-	SystemException, not Exception.
-
-2002-01-26  Nick Drochak  <[email protected]>
-
-	* ResourceReader.cs: Finsished reading resource files with just strings
-	in them.  Need to figure out other types, and also resources with
-	multiple types in the same file.
-
-2002-01-24  Nick Drochak  <[email protected]>
-
-	* ResourceReader.cs: Implemented constructors. Started on the 
-	GetEnumerator() method.  Not done yet, but comitting for 
-	'disaster recovery' purposes.
-
-2002-01-19  Duncan Mak  <[email protected]>
-
-	* *.cs: Fixed indentation. There was a stupid bug in my .emacs file.
-
-2002-1-17  Duncan Mak  <duncan@[email protected]>
-
-	* ResourceSet.cs: Implemented GetObject (string, bool) and GetString
-	(string, bool). ResourceSet has no more MonoTODOs! Also added in the
-	Serializable attribute.
-	
-	* *.cs: convert to Miguel's brace style.
-
-2002-01-17  Duncan Mak  <[email protected]>
-
-	* ResourceManager.cs: Fixed GetNeutralResourcesLanguage () and added
-	new attributes documented in 1.0 SDK.
-
-2002-01-17  Duncan Mak  <[email protected]>
-
-	* ResourceWriter.cs: Added MonoTODO decorations.
-
-	* SatelliteContractVersionAttribute.cs: added new attributes in 1.0 SDK.
-
-	* NeutralResoucesLanguageAttribute.cs: added new attributes in 1.0 SDK
-	
-2002-01-16  Duncan Mak  <[email protected]>
-
-	* ResourceReader.cs: Fixed some typos.
-
-	* ResourceManager.cs: After reading the tutorial from the SDK,
-	finished all the ResourceManager constructors and removed those
-	MonoTODO tags.
-	
-	Removed MonoTODO from GetNeutralResourcesLanguage (Assembly)
-	because Miguel just implemented the whole class, including the
-	constructor that I needed (CultureInfo (string)).
-
-	Updated fields after reading the new docs from the final SDK.
-
-	* ResXFileRef.cs, ResXResourceReader.cs: Removed. They are part of
-	Windows.Forms and require System.Xml, which we don't have access to.
-
-2002-01-13  Duncan Mak  <[email protected]>
-
-	* ResourceManager.cs: Added more MonoTODOs and cleaned up some 
-	indenting.
-
-2002-01-09  Duncan Mak  <[email protected]>
-
-	* ResourceManager.cs: Fixed the GetSatelliteContractVersion()
-	method. It was missing a cast before. Removed MonoTODO
-	attribute. ;-) It was tested by John Barnette, so this shouldn't break
-	the build.
-
-	* ResourceManager.cs: Removed MonoTODO attribute on GetString
-	(string), as I believe it's correct. However, GetString
-	(string, CultureInfo) is definitely broken, so I'm marking it with
-	MonoTODO there. I also added MonoTODO to IntenalGetResourceSet().
-
-2002-01-06  Duco Fijma <[email protected]>
-	* Finalizing IResourceReader and IResourceWriter interfaces: 
-          Added "new"-modifier to IResourceReader.GetEnumerator
-	* Fixed compilation issues in other *.cs, so that the 
-          System.Resources namespaces can be included in the corlib build.
-
-2002-01-05  Ravi Pratap  <[email protected]>
-
-	* ResourceManager.cs : MonoTODO attribute decoration.
-	
-Tue Dec 18 13:18:32 CET 2001 Paolo Molaro <[email protected]>
-
-	* *.cs: fixed some of the compilation issues: missing
-	using directives, typos.
-
-2001-12-11  Duncan Mak  <[email protected]>
-
-	* Checked in to CVS.
-
-2001-12-10  Duncan Mak  <[email protected]>
-
-	* ResourceManager.cs (GetNeutralResourcesLanguage):
-	(GetSatelliteContractVersion): Implemented.
-	
-2001-12-09  Duncan Mak  <[email protected]>
-
-	* ResXResourceReader.cs: Initial attempt.
-
-	* ResXFileRef.cs: Initial attempt.
-
-	* ResourceWriter.cs: Initial attempt.
-
-	* ResourceSet.cs (ReadResources): Implemented, with help from Radek Doulik.
-
-2001-11-28  Duncan Mak <[email protected]>	
-
-	* ResourceManager.cs: First attempt.
-
-2001-11-27  Duncan Mak <[email protected]>
-
-	* ResourceSet.cs:
-	First attempt, can't continue until ResourceReader and ResourceWriter are implemented.
-		
-	* SatelliteContractVersionAttribute.cs: First attempt. The spec is quite amibiguous here.
-
-	* NeutralResoucesLanguageAttribute.cs: Complete.
-
-	* MissingManifestResourceException.cs: Complete.
-
-	* IResourceReader.cs: Complete.
-
-	* IResourceWriter.cs: Complete.

+ 0 - 44
mcs/class/corlib/System.Resources/IResourceReader.cs

@@ -1,44 +0,0 @@
-//
-// System.Resources.IResourceReader.cs
-//
-// Author:
-//	Duncan Mak ([email protected])
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System;
-using System.Collections;
-
-namespace System.Resources
-{
-	[System.Runtime.InteropServices.ComVisible (true)]
-	public interface IResourceReader : IEnumerable, IDisposable
-	{
-		void Close();
-		new IDictionaryEnumerator GetEnumerator();
-	}
-}

+ 0 - 48
mcs/class/corlib/System.Resources/IResourceWriter.cs

@@ -1,48 +0,0 @@
-//
-// System.Resources.IResourceWriter.cs
-//
-// Author:
-//	Duncan Mak ([email protected])
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System;
-
-namespace System.Resources
-{
-	[System.Runtime.InteropServices.ComVisible (true)]
-	public interface IResourceWriter : IDisposable
-	{
-		void AddResource (string name, byte[] value);
-		void AddResource (string name, object value);
-		void AddResource (string name, string value);
-		
-		void Close();
-		
-		void Generate();
-	}
-}

+ 0 - 64
mcs/class/corlib/System.Resources/MissingManifestResourceException.cs

@@ -1,64 +0,0 @@
-//
-// System.Resources.MissingManifestResourceException.cs
-//
-// Author:
-//	Duncan Mak ([email protected])
-//
-// (C) 2001 Ximian, Inc.		http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace System.Resources
-{
-
-	[Serializable]
-	[System.Runtime.InteropServices.ComVisible (true)]
-	public class MissingManifestResourceException: SystemException
-	{
-		// Constructors
-		public MissingManifestResourceException ()
-			: base (Locale.GetText ("The assembly does not contain the resources for the required culture."))
-		{
-		}
-		
-		public MissingManifestResourceException (string message)
-			:base (message)
-		{
-		}
-		
-		protected MissingManifestResourceException (SerializationInfo info, StreamingContext context)
-				    :base (info, context)
-		{
-		}
-		
-		public MissingManifestResourceException (String message, Exception inner)
-			:base (message, inner)
-		{
-		}
-	}
-}

+ 0 - 74
mcs/class/corlib/System.Resources/MissingSatelliteAssemblyException.cs

@@ -1,74 +0,0 @@
-//
-// System.Resources.MissingSatelliteAssemblyException.cs
-//
-// Author:
-//	Atsushi Enomoto <[email protected]>
-//
-
-//
-// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace System.Resources
-{
-
-	[Serializable]
-	[System.Runtime.InteropServices.ComVisible (true)]
-	public class MissingSatelliteAssemblyException : SystemException
-	{
-		private string culture;
-
-		// Constructors
-		public MissingSatelliteAssemblyException ()
-			: base (Locale.GetText ("The satellite assembly was not found for the required culture."))
-		{
-		}
-		
-		public MissingSatelliteAssemblyException (string message)
-			:base (message)
-		{
-		}
-		
-		public MissingSatelliteAssemblyException (string message, string cultureName)
-			:base (message)
-		{
-			this.culture = cultureName;
-		}
-		
-		protected MissingSatelliteAssemblyException (SerializationInfo info, StreamingContext context)
-			:base (info, context)
-		{
-		}
-		
-		public MissingSatelliteAssemblyException (String message, Exception inner)
-			: base (message, inner)
-		{
-		}
-
-		public string CultureName {
-			get { return culture; }
-		}
-	}
-}

+ 0 - 76
mcs/class/corlib/System.Resources/NeutralResourcesLanguageAttribute.cs

@@ -1,76 +0,0 @@
-//
-// System.Resources.NeutralResourcesLanguageAttribute.cs
-//
-// Author:
-//	Duncan Mak ([email protected])
-//
-// (C) 2001 Ximian, Inc.		http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-namespace System.Resources
-{
-	[System.Runtime.InteropServices.ComVisible (true)]
-	[AttributeUsage (AttributeTargets.Assembly)]
-	public sealed class NeutralResourcesLanguageAttribute : Attribute
-	{
-		
-		string culture;
-		UltimateResourceFallbackLocation loc;
-
-		// Constructors
-		public NeutralResourcesLanguageAttribute (string cultureName) 
-		{
-			if(cultureName==null) {
-				throw new ArgumentNullException("culture is null");
-			}
-			
-			culture = cultureName;
-		}
-
-		public string CultureName
-		{
-			get {
-				return culture;
-			}
-		}
-
-		public NeutralResourcesLanguageAttribute (string cultureName, UltimateResourceFallbackLocation location)
-		{
-			if(cultureName==null) {
-				throw new ArgumentNullException("culture is null");
-			}
-			
-			culture = cultureName;
-			loc = location;
-		}
-		
-		public UltimateResourceFallbackLocation Location {
-			get {
-				return loc;
-			}  
-		}
-	}
-}

+ 0 - 522
mcs/class/corlib/System.Resources/ResourceManager.cs

@@ -1,522 +0,0 @@
-//	
-// System.Resources.ResourceManager.cs
-//
-// Authors:
-//	Duncan Mak ([email protected])
-//	Dick Porter ([email protected])
-// 	Alexander Olk ([email protected])
-//
-// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System.Collections;
-using System.Reflection;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.IO;
-
-namespace System.Resources
-{
-	[Serializable]
-	[ComVisible (true)]
-	public class ResourceManager
-	{
-		static readonly object thisLock = new object ();
-		static readonly Hashtable ResourceCache = new Hashtable ();
-		readonly Hashtable NonExistent = new Hashtable ();
-		public static readonly int HeaderVersionNumber = 1;
-		public static readonly int MagicNumber = unchecked ((int) 0xBEEFCACE);
-
-		protected string BaseNameField;
-		protected Assembly MainAssembly;
-		// Maps cultures to ResourceSet objects
-		[Obsolete ("Use InternalGetResourceSet instead.")]
-		protected Hashtable ResourceSets;
-		
-		private bool ignoreCase;
-		private Type resourceSource;
-		private Type resourceSetType = typeof (RuntimeResourceSet);
-		private String resourceDir;
-
-		// Contains cultures which have no resource sets
-		
-		/* Recursing through culture parents stops here */
-		private CultureInfo neutral_culture;
-
-		private UltimateResourceFallbackLocation fallbackLocation;
-		
-		static Hashtable GetResourceSets (Assembly assembly, string basename)
-		{
-			lock (ResourceCache) {
-				string key = String.Empty;
-				if (assembly != null) {
-					key = assembly.FullName;
-				} else {
-					key = basename.GetHashCode ().ToString () + "@@";
-				}
-				if (basename != null && basename != String.Empty) {
-					key += "!" + basename;
-				} else {
-					key += "!" + key.GetHashCode ();
-				}
-				Hashtable tbl = ResourceCache [key] as Hashtable;
-				if (tbl == null) {
-					tbl = Hashtable.Synchronized (new Hashtable ());
-					ResourceCache [key] = tbl;
-				}
-				return tbl;
-			}
-		}
-
-		// constructors
-		protected ResourceManager ()
-		{
-		}
-		
-		public ResourceManager (Type resourceSource)
-		{
-			if (resourceSource == null)
-				throw new ArgumentNullException ("resourceSource");
-
-			this.resourceSource = resourceSource;
-			BaseNameField = resourceSource.Name;
-			MainAssembly = resourceSource.Assembly;
-			ResourceSets = GetResourceSets (MainAssembly, BaseNameField);
-			neutral_culture = GetNeutralResourcesLanguage (MainAssembly);
-		}
-
-		public ResourceManager (string baseName, Assembly assembly)
-		{
-			if (baseName == null)
-				throw new ArgumentNullException ("baseName");
-			if (assembly == null)
-				throw new ArgumentNullException ("assembly");
-			
-			BaseNameField = baseName;
-			MainAssembly = assembly;
-			ResourceSets = GetResourceSets (MainAssembly, BaseNameField);
-			neutral_culture = GetNeutralResourcesLanguage (MainAssembly);
-		}
-
-		private Type CheckResourceSetType (Type usingResourceSet, bool verifyType)
-		{
-			if (usingResourceSet == null)
-				return resourceSetType;
-
-			if (verifyType && !typeof (ResourceSet).IsAssignableFrom (usingResourceSet))
-				throw new ArgumentException ("Type parameter"
-					+ " must refer to a subclass of"
-					+ " ResourceSet.", "usingResourceSet");
-			return usingResourceSet;
-		}
-
-		public ResourceManager (string baseName, Assembly assembly, Type usingResourceSet)
-		{
-			if (baseName == null)
-				throw new ArgumentNullException ("baseName");
-			if (assembly == null)
-				throw new ArgumentNullException ("assembly");
-
-			BaseNameField = baseName;
-			MainAssembly = assembly;
-			ResourceSets = GetResourceSets (MainAssembly, BaseNameField);
-			resourceSetType = CheckResourceSetType (usingResourceSet, true);
-			neutral_culture = GetNeutralResourcesLanguage (MainAssembly);
-		}
-
-		/* Private constructor for CreateFileBasedResourceManager */
-		private ResourceManager(String baseName, String resourceDir, Type usingResourceSet)
-		{
-			if (baseName == null)
-				throw new ArgumentNullException ("baseName");
-			if (resourceDir == null)
-				throw new ArgumentNullException("resourceDir");
-
-			BaseNameField = baseName;
-			this.resourceDir = resourceDir;
-			resourceSetType = CheckResourceSetType (usingResourceSet, false);
-			ResourceSets = GetResourceSets (MainAssembly, BaseNameField);
-		}
-		
-		public static ResourceManager CreateFileBasedResourceManager (string baseName,
-						      string resourceDir, Type usingResourceSet)
-		{
-			return new ResourceManager (baseName, resourceDir, usingResourceSet);
-		}
-
-		public virtual string BaseName {
-			get { return BaseNameField; }
-		}
-
-		public virtual bool IgnoreCase {
-			get { return ignoreCase; }
-			set { ignoreCase = value; }
-		}
-
-		public virtual Type ResourceSetType {
-			get { return resourceSetType; }
-		}
-
-		public virtual object GetObject (string name)
-		{
-			return GetObject (name, null);
-		}
-
-		public virtual object GetObject (string name, CultureInfo culture)
-		{
-			if (name == null)
-				throw new ArgumentNullException("name");
-
-			if (culture == null)
-				culture = CultureInfo.CurrentUICulture;
-
-			lock (thisLock) {
-				ResourceSet set = InternalGetResourceSet(culture, true, true);
-				object obj = null;
-				
-				if (set != null) {
-					obj = set.GetObject(name, ignoreCase);
-					if (obj != null)
-						return obj;
-				}
-				
-				/* Try parent cultures */
-
-				do {
-					culture = culture.Parent;
-
-					set = InternalGetResourceSet (culture, true, true);
-					if (set != null) {
-						obj = set.GetObject (name, ignoreCase);
-						if (obj != null)
-							return obj;
-					}
-				} while (!culture.Equals (neutral_culture) &&
-					!culture.Equals (CultureInfo.InvariantCulture));
-			}
-
-			return null;
-		}
-
-		public virtual ResourceSet GetResourceSet (CultureInfo culture,
-					   bool createIfNotExists, bool tryParents)
-			
-		{
-			if (culture == null)
-				throw new ArgumentNullException ("culture");
-
-			lock (thisLock) {
-				return InternalGetResourceSet (culture, createIfNotExists, tryParents);
-			}
-		}
-		
-		public virtual string GetString (string name)
-		{
-			return GetString (name, null);
-		}
-
-		public virtual string GetString (string name, CultureInfo culture)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-
-			if (culture == null)
-				culture = CultureInfo.CurrentUICulture;
-
-			lock (thisLock) {
-				ResourceSet set = InternalGetResourceSet (culture, true, true);
-				string str = null;
-
-				if (set != null) {
-					str = set.GetString (name, ignoreCase);
-					if (str != null)
-						return str;
-				}
-
-				/* Try parent cultures */
-
-				do {
-					culture = culture.Parent;
-					set = InternalGetResourceSet (culture, true, true);
-					if (set != null) {
-						str = set.GetString(name, ignoreCase);
-						if (str != null)
-							return str;
-					}
-				} while (!culture.Equals (neutral_culture) &&
-					!culture.Equals (CultureInfo.InvariantCulture));
-			}
-			
-			return null;
-		}
-
-		protected virtual string GetResourceFileName (CultureInfo culture)
-		{
-			if (culture.Equals (CultureInfo.InvariantCulture))
-				return BaseNameField + ".resources";
-			else
-				return BaseNameField + "." +  culture.Name + ".resources";
-		}
-
-		private string GetResourceFilePath (CultureInfo culture)
-		{
-			if (resourceDir != null)
-				return Path.Combine (resourceDir, GetResourceFileName (culture));
-			else
-				return GetResourceFileName (culture);
-		}
-		
-		Stream GetManifestResourceStreamNoCase (Assembly ass, string fn)
-		{
-			string resourceName = GetManifestResourceName (fn);
-
-			foreach (string s in ass.GetManifestResourceNames ())
-				if (String.Compare (resourceName, s, true, CultureInfo.InvariantCulture) == 0)
-					return ass.GetManifestResourceStream (s);
-			return null;
-		}
-
-		[ComVisible (false)]
-		public UnmanagedMemoryStream GetStream (string name)
-		{
-			return GetStream (name, (CultureInfo) null);
-		}
-
-		[ComVisible (false)]
-		public UnmanagedMemoryStream GetStream (string name, CultureInfo culture)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-			if (culture == null)
-				culture = CultureInfo.CurrentUICulture;
-			ResourceSet set;
-
-			lock (thisLock) {
-				set = InternalGetResourceSet (culture, true, true);
-			}
-			
-			return set.GetStream (name, ignoreCase);
-		}
-
-		protected virtual ResourceSet InternalGetResourceSet (CultureInfo culture, bool createIfNotExists, bool tryParents)
-		{
-			if (culture == null)
-				throw new ArgumentNullException ("key"); // 'key' instead of 'culture' to make a test pass
-
-			ResourceSet set = null;
-			
-			/* if we already have this resource set, return it */
-			set = (ResourceSet) ResourceSets [culture];
-			if (set != null) {
-				return set;
-/*				
-				try {
-					if (!set.IsDisposed)
-						return set;
-				} catch {
-					// ignore
-				}
-
-				ResourceSets.Remove (culture);
-				if (NonExistent.Contains (culture))
-					NonExistent.Remove (culture);
-				set = null;
-*/
-			}
-			
-			if (NonExistent.Contains (culture))
-				return null;
-
-			if (MainAssembly != null) {
-				/* Assembly resources */
-				CultureInfo resourceCulture = culture;
-
-				// when the specified culture matches the neutral culture,
-				// then use the invariant resources
-				if (culture.Equals (neutral_culture))
-					resourceCulture = CultureInfo.InvariantCulture;
-
-				Stream stream = null;
-
-				string filename = GetResourceFileName (resourceCulture);
-				if (!resourceCulture.Equals (CultureInfo.InvariantCulture)) {
-					/* Try a satellite assembly */
-					Version sat_version = GetSatelliteContractVersion (MainAssembly);
-					try {
-						Assembly a = MainAssembly.GetSatelliteAssemblyNoThrow (
-							resourceCulture, sat_version);
-						if (a != null){
-							stream = a.GetManifestResourceStream (filename);
-							if (stream == null)
-								stream = GetManifestResourceStreamNoCase (a, filename);
-						}
-					} catch (Exception) {
-						// Ignored
-					}
-				} else {
-					stream = MainAssembly.GetManifestResourceStream (
-						resourceSource, filename);
-					if (stream == null)
-						stream = GetManifestResourceStreamNoCase (
-							MainAssembly, filename);
-				}
-
-				if (stream != null && createIfNotExists) {
-					object [] args = new Object [1] { stream };
-					
-					/* should we catch
-					 * MissingMethodException, or
-					 * just let someone else deal
-					 * with it?
-					 */
-					set = (ResourceSet) Activator.CreateInstance (resourceSetType, args);
-				} else if (resourceCulture.Equals (CultureInfo.InvariantCulture)) {
-					throw AssemblyResourceMissing (filename);
-				}
-			} else if (resourceDir != null || BaseNameField != null) {
-				/* File resources */
-				string filename = GetResourceFilePath (culture);
-				if (createIfNotExists && File.Exists (filename)) {
-					object [] args = new Object [1] { filename };
-
-					/* should we catch
-					 * MissingMethodException, or
-					 * just let someone else deal
-					 * with it?
-					 */
-					set = (ResourceSet) Activator.CreateInstance(
-						resourceSetType, args);
-				} else if (culture.Equals (CultureInfo.InvariantCulture)) {
-					string msg = string.Format ("Could not find any " +
-						"resources appropriate for the specified culture " +
-						"(or the neutral culture) on disk.{0}" +
-						"baseName: {1}  locationInfo: {2}  fileName: {3}",
-						Environment.NewLine, BaseNameField, "<null>",
-						GetResourceFileName (culture));
-					throw new MissingManifestResourceException (msg);
-				}
-			}
-
-			if (set == null && tryParents) {
-				// avoid endless recursion
-				if (!culture.Equals (CultureInfo.InvariantCulture))
-					set = InternalGetResourceSet (culture.Parent,
-						createIfNotExists, tryParents);
-			}
-
-			if (set != null)
-				ResourceSets [culture] = set;
-			else
-				NonExistent [culture] = culture;
-
-			return set;
-		}
-
-		public virtual void ReleaseAllResources ()
-		{
-			lock(this) {
-				foreach (ResourceSet r in ResourceSets.Values)
-					r.Close();
-				ResourceSets.Clear();
-			}
-		}
-
-		protected static CultureInfo GetNeutralResourcesLanguage (Assembly a)
-		{
-			object [] attrs = a.GetCustomAttributes (
-				typeof (NeutralResourcesLanguageAttribute),
-				false);
-
-			if (attrs.Length == 0) {
-				return CultureInfo.InvariantCulture;
-			} else {
-				NeutralResourcesLanguageAttribute res_attr = (NeutralResourcesLanguageAttribute) attrs [0];
-				return new CultureInfo (res_attr.CultureName);
-			}
-		}
-
-		protected static Version GetSatelliteContractVersion (Assembly a)
-		{
-			object [] attrs = a.GetCustomAttributes (
-				typeof (SatelliteContractVersionAttribute),
-				false);
-			if (attrs.Length == 0) {
-				return null;
-			} else {
-				SatelliteContractVersionAttribute sat_attr =
-					(SatelliteContractVersionAttribute) attrs[0];
-
-				/* Version(string) can throw
-				 * ArgumentException if the version is
-				 * invalid, but the spec for
-				 * GetSatelliteContractVersion says we
-				 * can throw the same exception for
-				 * the same reason, so dont bother to
-				 * catch it.
-				 */
-				return new Version (sat_attr.Version);
-			}
-		}
-
-		[MonoTODO ("the property exists but is not respected")]
-		protected UltimateResourceFallbackLocation FallbackLocation {
-			get { return fallbackLocation; }
-			set { fallbackLocation = value; }
-		}
-
-
-		MissingManifestResourceException AssemblyResourceMissing (string fileName)
-		{
-			AssemblyName aname = MainAssembly != null ? MainAssembly.GetName ()
-				: null;
-
-			string manifestName = GetManifestResourceName (fileName);
-			string msg = string.Format ("Could not find any resources " +
-				"appropriate for the specified culture or the " +
-				"neutral culture.  Make sure \"{0}\" was correctly " +
-				"embedded or linked into assembly \"{1}\" at " +
-				"compile time, or that all the satellite assemblies " +
-				"required are loadable and fully signed.",
-				manifestName, aname != null ? aname.Name : string.Empty);
-			throw new MissingManifestResourceException (msg);
-		}
-
-		string GetManifestResourceName (string fn)
-		{
-			string resourceName = null;
-			if (resourceSource != null) {
-				if (resourceSource.Namespace != null && resourceSource.Namespace.Length > 0)
-					resourceName = string.Concat (resourceSource.Namespace,
-						".", fn);
-				else
-					resourceName = fn;
-			} else {
-				resourceName = fn;
-			}
-			return resourceName;
-		}
-	}
-}

+ 0 - 669
mcs/class/corlib/System.Resources/ResourceReader.cs

@@ -1,669 +0,0 @@
-//
-// System.Resources.ResourceReader.cs
-//
-// Authors: 
-// 	Duncan Mak <[email protected]>
-//	Nick Drochak <[email protected]>
-//	Dick Porter <[email protected]>
-//	Marek Safar <[email protected]>
-//	Atsushi Enomoto  <[email protected]>
-//      Larry Ewing <[email protected]>
-//
-// (C) 2001, 2002 Ximian Inc, http://www.ximian.com
-// Copyright (C) 2004-2005,2007-2008 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System.Collections;
-using System.Resources;
-using System.IO;
-using System.Text;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Security.Permissions;
-using System.Collections.Generic;
-
-namespace System.Resources
-{
-	internal enum PredefinedResourceType
-	{
-		Null		= 0,
-		String		= 1,
-		Bool		= 2,
-		Char		= 3,
-		Byte		= 4,
-		SByte		= 5,
-		Int16		= 6,
-		UInt16		= 7,
-		Int32		= 8,
-		UInt32		= 9,
-		Int64		= 10,
-		UInt64		= 11,
-		Single		= 12,
-		Double		= 13,
-		Decimal		= 14,
-		DateTime	= 15,
-		TimeSpan	= 16,
-		ByteArray	= 32,
-		Stream		= 33,
-		FistCustom	= 64
-	}
-
-	[System.Runtime.InteropServices.ComVisible (true)]
-	public sealed class ResourceReader : IResourceReader, IEnumerable, IDisposable
-	{
-		struct ResourceInfo
-		{
-			public readonly long ValuePosition;
-			public readonly string ResourceName;
-			public readonly int TypeIndex;
-			
-			public ResourceInfo (string resourceName, long valuePosition, int type_index)
-			{
-				ValuePosition = valuePosition;
-				ResourceName = resourceName;
-				TypeIndex = type_index;
-			}
-		}
-
-		struct ResourceCacheItem
-		{
-			public readonly string ResourceName;
-			public readonly object ResourceValue;
-
-			public ResourceCacheItem (string name, object value)
-			{
-				ResourceName = name;
-				ResourceValue = value;
-			}
-		}
-
-		BinaryReader reader;
-		object readerLock = new object ();
-		IFormatter formatter;
-		internal int resourceCount = 0;
-		int typeCount = 0;
-		string[] typeNames;
-		int[] hashes;
-		ResourceInfo[] infos;
-		int dataSectionOffset;
-		long nameSectionOffset;
-		int resource_ver;
-		ResourceCacheItem[] cache;
-		object cache_lock = new object ();
-		
-		// Constructors
-		[SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
-		public ResourceReader (Stream stream)
-		{
-			if (stream == null)
-				throw new ArgumentNullException ("stream");
-			
-			if (!stream.CanRead)
-				throw new ArgumentException ("Stream was not readable.");
-
-			reader = new BinaryReader(stream, Encoding.UTF8);
-			formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File|StreamingContextStates.Persistence));
-			
-			ReadHeaders();
-		}
-		
-		public ResourceReader (string fileName)
-		{
-			reader = new BinaryReader (new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read));
-			formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File|StreamingContextStates.Persistence));
-
-			ReadHeaders();
-		}
-		
-		/* Read the ResourceManager header and the
-		 * ResourceReader header.
-		 */
-		private void ReadHeaders()
-		{
-			try {
-				int manager_magic = reader.ReadInt32();
-
-				if(manager_magic != ResourceManager.MagicNumber) 
-					throw new ArgumentException(String.Format ("Stream is not a valid .resources file, magic=0x{0:x}", manager_magic));
-
-				int manager_ver = reader.ReadInt32();
-				int manager_len = reader.ReadInt32();
-				
-				/* We know how long the header is, even if
-				 * the version number is too new
-				 */
-				if(manager_ver > ResourceManager.HeaderVersionNumber) {
-					reader.BaseStream.Seek(manager_len, SeekOrigin.Current);
-				} else {
-					string reader_class=reader.ReadString();
-					if(!reader_class.StartsWith("System.Resources.ResourceReader")) {
-						throw new NotSupportedException("This .resources file requires reader class " + reader_class);
-					}
-					
-					string set_class=reader.ReadString();
-					if(!set_class.StartsWith(typeof(ResourceSet).FullName) && !set_class.StartsWith("System.Resources.RuntimeResourceSet")) {
-						throw new NotSupportedException("This .resources file requires set class " + set_class);
-					}
-				}
-
-				/* Now read the ResourceReader header */
-				resource_ver = reader.ReadInt32();
-
-				if(resource_ver != 1 && resource_ver != 2) {
-					throw new NotSupportedException("This .resources file requires unsupported set class version: " + resource_ver.ToString());
-				}
-
-				resourceCount = reader.ReadInt32();
-				typeCount = reader.ReadInt32();
-				
-				typeNames=new string[typeCount];
-
-				for(int i=0; i<typeCount; i++) {
-					typeNames[i]=reader.ReadString();
-				}
-
-				/* There are between 0 and 7 bytes of
-				 * padding here, consisting of the
-				 * letters PAD.  The next item (Hash
-				 * values for each resource name) need
-				 * to be aligned on an 8-byte
-				 * boundary.
-				 */
-
-				int pad_align=(int)(reader.BaseStream.Position & 7);
-				int pad_chars=0;
-
-				if(pad_align!=0) {
-					pad_chars=8-pad_align;
-				}
-
-				for(int i=0; i<pad_chars; i++) {
-					byte pad_byte=reader.ReadByte();
-					if(pad_byte!="PAD"[i%3]) {
-						throw new ArgumentException("Malformed .resources file (padding values incorrect)");
-					}
-				}
-				/* Read in the hash values for each
-				 * resource name.  These can be used
-				 * by ResourceSet (calling internal
-				 * methods) to do a fast compare on
-				 * resource names without doing
-				 * expensive string compares (but we
-				 * dont do that yet, so far we only
-				 * implement the Enumerator interface)
-				 */
-				hashes=new int[resourceCount];
-				for(int i=0; i<resourceCount; i++) {
-					hashes[i]=reader.ReadInt32();
-				}
-				
-				/* Read in the virtual offsets for
-				 * each resource name
-				 */
-				long[] positions = new long [resourceCount];
-				for(int i = 0; i < resourceCount; i++)
-					positions [i] = reader.ReadInt32();
-				
-				dataSectionOffset = reader.ReadInt32();
-				nameSectionOffset = reader.BaseStream.Position;
-
-				long origPosition = reader.BaseStream.Position;
-				infos = new ResourceInfo [resourceCount];
-				for (int i = 0; i < resourceCount; i++)
-					CreateResourceInfo (positions [i], ref infos [i]);
-				reader.BaseStream.Seek (origPosition, SeekOrigin.Begin);
-				
-				positions = null;
-			} catch(EndOfStreamException e) {
-				throw new ArgumentException("Stream is not a valid .resources file!  It was possibly truncated.", e);
-			}
-		}
-
-		void CreateResourceInfo (long position, ref ResourceInfo info)
-		{
-			long pos = position + nameSectionOffset;
-
-			reader.BaseStream.Seek (pos, SeekOrigin.Begin);
-
-			// Resource name
-			int len = Read7BitEncodedInt ();
-			byte[] str = new byte [len];
-			
-			reader.Read (str, 0, len);
-			string resourceName = Encoding.Unicode.GetString (str);
-
-			long data_offset = reader.ReadInt32 () + dataSectionOffset;
-			reader.BaseStream.Seek (data_offset, SeekOrigin.Begin);
-			int type_index = Read7BitEncodedInt ();
-			
-			info = new ResourceInfo (resourceName, reader.BaseStream.Position, type_index);
-		}
-		
-		/* Cut and pasted from BinaryReader, because it's
-		 * 'protected' there
-		 */
-		private int Read7BitEncodedInt() {
-			int ret = 0;
-			int shift = 0;
-			byte b;
-
-			do {
-				b = reader.ReadByte();
-				
-				ret = ret | ((b & 0x7f) << shift);
-				shift += 7;
-			} while ((b & 0x80) == 0x80);
-
-			return ret;
-		}
-
-		object ReadValueVer2 (int type_index)
-		{
-			switch ((PredefinedResourceType)type_index)
-			{
-				case PredefinedResourceType.Null:
-					return null;
-
-				case PredefinedResourceType.String:
-					return reader.ReadString();
-
-				case PredefinedResourceType.Bool:
-					return reader.ReadBoolean ();
-
-				case PredefinedResourceType.Char:
-					return (char)reader.ReadUInt16();
-
-				case PredefinedResourceType.Byte:
-					return reader.ReadByte();
-
-				case PredefinedResourceType.SByte:
-					return reader.ReadSByte();
-
-				case PredefinedResourceType.Int16:
-					return reader.ReadInt16();
-
-				case PredefinedResourceType.UInt16:
-					return reader.ReadUInt16();
-
-				case PredefinedResourceType.Int32:
-					return reader.ReadInt32();
-
-				case PredefinedResourceType.UInt32:
-					return reader.ReadUInt32();
-
-				case PredefinedResourceType.Int64:
-					return reader.ReadInt64();
-
-				case PredefinedResourceType.UInt64:
-					return reader.ReadUInt64();
-
-				case PredefinedResourceType.Single:
-					return reader.ReadSingle();
-
-				case PredefinedResourceType.Double:
-					return reader.ReadDouble();
-
-				case PredefinedResourceType.Decimal:
-					return reader.ReadDecimal();
-
-				case PredefinedResourceType.DateTime:
-					return new DateTime(reader.ReadInt64());
-
-				case PredefinedResourceType.TimeSpan:
-					return new TimeSpan(reader.ReadInt64());
-
-				case PredefinedResourceType.ByteArray:
-					return reader.ReadBytes (reader.ReadInt32 ());
-
-				case PredefinedResourceType.Stream:
-					// FIXME: create pinned UnmanagedMemoryStream for efficiency.
-					byte [] bytes = new byte [reader.ReadUInt32 ()];
-					reader.Read (bytes, 0, bytes.Length);
-					return new MemoryStream (bytes);
-			}
-
-			type_index -= (int)PredefinedResourceType.FistCustom;
-			return ReadNonPredefinedValue (Type.GetType (typeNames[type_index], true));
-		}
-
-		object ReadValueVer1 (Type type)
-		{
-			// The most common first
-			if (type==typeof(String))
-				return reader.ReadString();
-			if (type==typeof(Int32))
-				return reader.ReadInt32();
-			if (type==typeof(Byte))
-				return(reader.ReadByte());
-			if (type==typeof(Double))
-				return(reader.ReadDouble());
-			if (type==typeof(Int16))
-				return(reader.ReadInt16());
-			if (type==typeof(Int64))
-				return(reader.ReadInt64());
-			if (type==typeof(SByte))
-				return(reader.ReadSByte());
-			if (type==typeof(Single))
-				return(reader.ReadSingle());
-			if (type==typeof(TimeSpan))
-				return(new TimeSpan(reader.ReadInt64()));
-			if (type==typeof(UInt16))
-				return(reader.ReadUInt16());
-			if (type==typeof(UInt32))
-				return(reader.ReadUInt32());
-			if (type==typeof(UInt64))
-				return(reader.ReadUInt64());
-			if (type==typeof(Decimal))
-				return(reader.ReadDecimal());
-			if (type==typeof(DateTime))
-				return(new DateTime(reader.ReadInt64()));
-
-			return ReadNonPredefinedValue(type);
-		}
-
-		// TODO: Add security checks
-		object ReadNonPredefinedValue (Type exp_type)
-		{
-			object obj=formatter.Deserialize(reader.BaseStream);
-			if(obj.GetType() != exp_type) {
-				/* We got a bogus
-						 * object.  This
-						 * exception is the
-						 * best match I could
-						 * find.  (.net seems
-						 * to throw
-						 * BadImageFormatException,
-						 * which the docs
-						 * state is used when
-						 * file or dll images
-						 * cant be loaded by
-						 * the runtime.)
-						 */
-				throw new InvalidOperationException("Deserialized object is wrong type");
-			}
-			return obj;
-		}		
-
-		void LoadResourceValues (ResourceCacheItem[] store)
-		{
-			ResourceInfo ri;
-			object value;
-			
-			lock (readerLock) {
-				for (int i = 0; i < resourceCount; i++) {
-					ri = infos [i];
-					if (ri.TypeIndex == -1) {
-						store [i] = new ResourceCacheItem (ri.ResourceName, null);
-						continue;
-					}
-
-					reader.BaseStream.Seek (ri.ValuePosition, SeekOrigin.Begin);
-					if (resource_ver == 2)
-						value = ReadValueVer2 (ri.TypeIndex);
-					else
-						value = ReadValueVer1 (Type.GetType (typeNames [ri.TypeIndex], true));
-
-					store [i] = new ResourceCacheItem (ri.ResourceName, value);
-				}
-			}
-		}
-		
-		internal UnmanagedMemoryStream ResourceValueAsStream (string name, int index)
-		{
-			ResourceInfo ri = infos [index];
-			if ((PredefinedResourceType)ri.TypeIndex != PredefinedResourceType.Stream)
-				throw new InvalidOperationException (String.Format ("Resource '{0}' was not a Stream. Use GetObject() instead.", name));
-			
-			lock (readerLock) {
-				reader.BaseStream.Seek (ri.ValuePosition, SeekOrigin.Begin);
-				
-				// here we return a Stream from exactly
-				// current position so that the returned
-				// Stream represents a single object stream.
-				long slen = reader.ReadInt32();
-				UnmanagedMemoryStream basePtrStream = reader.BaseStream as UnmanagedMemoryStream;
-				unsafe {
-					if (basePtrStream != null) {
-						return new UnmanagedMemoryStream (basePtrStream.PositionPointer, slen);
-					} else {
-						IntPtr ptr = Marshal.AllocHGlobal ((int) slen);
-						byte* addr = (byte*) ptr.ToPointer ();
-						UnmanagedMemoryStream ms = new HGlobalUnmanagedMemoryStream (addr, slen, ptr);
-
-						byte [] bytes = new byte [slen < 1024 ? slen : 1024];
-						while (slen > 0 ) {
-							int x = reader.Read (bytes, 0, (int)Math.Min (bytes.Length, slen));
-
-							if (x == 0)
-								throw new FormatException ("The resource data is corrupt. Resource stream ended");
-
-							ms.Write (bytes, 0, x);
-							slen -= x;
-						}
-						ms.Seek (0, SeekOrigin.Begin);
-						return ms;
-					}
-				}
-			}
-		}
-
-		public void Close ()
-		{
-			Dispose(true);
-		}
-
-		public void Dispose ()
-		{
-			Dispose(true);
-		}
-		
-		public IDictionaryEnumerator GetEnumerator () {
-			if (reader == null){
-				throw new InvalidOperationException("ResourceReader is closed.");
-			}
-			else {
-				return new ResourceEnumerator (this);
-			}
-		}
-		
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return ((IResourceReader) this).GetEnumerator();
-		}
-
-		public void GetResourceData (string resourceName, out string resourceType, out byte [] resourceData)
-		{
-			if (resourceName == null)
-				throw new ArgumentNullException ("resourceName");
-			ResourceEnumerator en = new ResourceEnumerator (this);
-			while (en.MoveNext ())
-				if ((string) en.Key == resourceName) {
-					GetResourceDataAt (en.Index, out resourceType, out resourceData);
-					return;
-				}
-			throw new ArgumentException (String.Format ("Specified resource not found: {0}", resourceName));
-		}
-
-		private void GetResourceDataAt (int index, out string resourceType, out byte [] data)
-		{
-			ResourceInfo ri = infos [index];
-			int type_index = ri.TypeIndex;
-			if (type_index == -1)
-				throw new FormatException ("The resource data is corrupt");
-			
-			lock (readerLock) {
-				reader.BaseStream.Seek (ri.ValuePosition, SeekOrigin.Begin);
-				long pos2 = reader.BaseStream.Position;
-
-				// Simply read data, and seek back to the original position
-				if (resource_ver == 2) {
-					if (type_index >= (int) PredefinedResourceType.FistCustom) {
-						int typenameidx = type_index - (int)PredefinedResourceType.FistCustom;
-						if (typenameidx >= typeNames.Length)
-							throw new FormatException ("The resource data is corrupt. Invalid index to types");
-						resourceType = typeNames[typenameidx];
-					}
-					else
-						resourceType = "ResourceTypeCode." + (PredefinedResourceType) type_index;
-					ReadValueVer2 (type_index);
-				} else {
-					// resource ver 1 == untyped
-					resourceType = "ResourceTypeCode.Null";
-					ReadValueVer1 (Type.GetType (typeNames [type_index], true));
-				}
-
-				// FIXME: the data size is wrong.
-				int datalen = (int) (reader.BaseStream.Position - pos2);
-				reader.BaseStream.Seek (-datalen, SeekOrigin.Current);
-				data = new byte [datalen];
-				reader.BaseStream.Read (data, 0, datalen);
-			}
-		}
-
-		private void Dispose (bool disposing)
-		{
-			if(disposing) {
-				if(reader!=null) {
-					reader.Close();
-				}
-			}
-			
-			reader=null;
-			hashes=null;
-			infos=null;
-			typeNames=null;
-			cache = null;
-		}
-		
-		internal sealed class ResourceEnumerator : IDictionaryEnumerator
-		{
-			private ResourceReader reader;
-			private int index = -1;
-			private bool finished;
-			
-			internal ResourceEnumerator(ResourceReader readerToEnumerate)
-			{
-				reader = readerToEnumerate;
-				FillCache ();
-			}
-
-			public int Index
-			{
-				get { return index; }
-			}
-
-			public DictionaryEntry Entry {
-				get {
-					if (reader.reader == null)
-						throw new InvalidOperationException("ResourceReader is closed.");
-					if (index < 0)
-						throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
-
-					return new DictionaryEntry(Key, Value);
-				}
-			}
-			
-			public object Key
-			{
-				get { 
-					if (reader.reader == null)
-						throw new InvalidOperationException("ResourceReader is closed.");
-					if (index < 0)
-						throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
-
-					return reader.cache [index].ResourceName;
-				}
-			}
-			
-			public object Value
-			{
-				get { 
-					if (reader.reader == null)
-						throw new InvalidOperationException("ResourceReader is closed.");
-					if (index < 0)
-						throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
-					return reader.cache [index].ResourceValue;
-				}
-			}
-			
-			public UnmanagedMemoryStream ValueAsStream
-			{
-				get {
-					if (reader.reader == null)
-						throw new InvalidOperationException("ResourceReader is closed.");
-					if (index < 0)
-						throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
-					return(reader.ResourceValueAsStream((string) Key, index));
-				}
-			}
-			
-			public object Current
-			{
-				get {
-					/* Entry does the checking, no
-					 * need to repeat it here
-					 */
-					return Entry; 
-				}
-			}
-			
-			public bool MoveNext ()
-			{
-				if (reader.reader == null)
-					throw new InvalidOperationException("ResourceReader is closed.");
-				if (finished) {
-					return false;
-				}
-				
-				if (++index < reader.resourceCount){
-					return true;
-				}
-
-				finished=true;
-				return false;
-			}
-			
-			public void Reset () {
-				if (reader.reader == null)
-					throw new InvalidOperationException("ResourceReader is closed.");
-				index = -1;
-				finished = false;
-			}
-
-			void FillCache ()
-			{
-				if (reader.cache != null)
-					return;
-				
-				lock (reader.cache_lock) {
-					if (reader.cache != null)
-						return;
-					
-					ResourceCacheItem[] resources = new ResourceCacheItem [reader.resourceCount];				
-					reader.LoadResourceValues (resources);
-					reader.cache = resources;
-				}
-			}
-		} // internal class ResourceEnumerator
-	}  // public sealed class ResourceReader
-} // namespace System.Resources

+ 0 - 233
mcs/class/corlib/System.Resources/ResourceSet.cs

@@ -1,233 +0,0 @@
-//
-// System.Resources.ResourceSet.cs
-//
-// Authors:
-//	Duncan Mak ([email protected])
-//	Dick Porter ([email protected])
-//	Andreas Nahr ([email protected])
-//
-// (C) 2001, 2002 Ximian, Inc.		http://www.ximian.com
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System.Collections;
-using System.IO;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Security.Permissions;
-
-namespace System.Resources
-{
-	[Serializable]
-	[ComVisible (true)]
-	public class ResourceSet : IDisposable, IEnumerable
-	{
-		[NonSerialized]
-		protected IResourceReader Reader;
-		protected Hashtable Table;
-		bool resources_read;
-		[NonSerialized] Hashtable table_nocase;
-
-		// Constructors
-		protected ResourceSet ()
-		{
-			Table = new Hashtable ();
-			resources_read = true;
-		}
-
-		public ResourceSet (IResourceReader reader)
-		{
-			if (reader == null)
-				throw new ArgumentNullException ("reader");
-			Table = new Hashtable ();
-			Reader = reader;
-		}
-		
-		internal bool IsDisposed {
-			get {
-				return Table == null;
-			}
-		}
-
-		[SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
-		public ResourceSet (Stream stream)
-		{
-			Table = new Hashtable ();
-			Reader = new ResourceReader (stream);
-		}
-
-		internal ResourceSet (UnmanagedMemoryStream stream)
-		{
-			Table = new Hashtable ();
-			Reader = new ResourceReader (stream);
-		}
-		
-		public ResourceSet (string fileName)
-		{
-			Table = new Hashtable ();
-			Reader = new ResourceReader (fileName);
-		}
-
-		public virtual void Close ()
-		{
-			Dispose ();
-		}
-
-		public void Dispose()
-		{
-			Dispose (true);
-
-			// If we are explicitly disposed, we can avoid finalization.
-			GC.SuppressFinalize (this);
-		}
-
-		protected virtual void Dispose (bool disposing)
-		{
-			if (disposing) {
-				if(Reader != null)
-					Reader.Close();
-			}
-
-			Reader = null;
-			Table = null;
-			table_nocase = null;
-		}
-
-		public virtual Type GetDefaultReader ()
-		{
-			return (typeof (ResourceReader));
-		}
-
-		public virtual Type GetDefaultWriter ()
-		{
-			return (typeof (ResourceWriter));
-		}
-
-		[ComVisible (false)]
-		public virtual IDictionaryEnumerator GetEnumerator ()
-		{
-			if (IsDisposed)
-				throw new ObjectDisposedException ("ResourceSet is closed.");
-			ReadResources ();
-			return Table.GetEnumerator();
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return this.GetEnumerator ();
-		}
-
-		private object GetObjectInternal (string name, bool ignoreCase)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-			if (IsDisposed)
-				throw new ObjectDisposedException ("ResourceSet is closed.");
-
-			ReadResources ();
-
-			if (!ignoreCase)
-				return Table [name];
-
-			if (table_nocase == null) {
-				lock (Table) {
-					if (table_nocase == null) {
-						Hashtable ht = new Hashtable (StringComparer.InvariantCultureIgnoreCase);
-						foreach (DictionaryEntry de in Table) {
-							ht.Add (de.Key, de.Value);
-						}
-						table_nocase = ht;
-					}
-				}
-			}
-			return table_nocase [name];
-		}
-
-		public virtual object GetObject (string name)
-		{
-			return GetObjectInternal (name, false);
-		}
-
-		public virtual object GetObject (string name, bool ignoreCase)
-		{
-			return GetObjectInternal (name, ignoreCase);
-		}
-
-		private string GetStringInternal (string name, bool ignoreCase)
-		{
-			object value = GetObject (name, ignoreCase);
-			if (value == null)
-				return null;
-
-			string s = (value as string);
-			if (s == null)
-				throw new InvalidOperationException (string.Format (
-					"Resource '{0}' is not a String. Use " +
-					"GetObject instead.", name));
-
-			return s;
-		}
-
-		public virtual string GetString (string name)
-		{
-			return GetStringInternal (name, false);
-		}
-
-		public virtual string GetString (string name, bool ignoreCase)
-		{
-			return GetStringInternal (name, ignoreCase);
-		}
-
-		protected virtual void ReadResources ()
-		{
-			if (resources_read)
-				return;
-
-			if (IsDisposed)
-				throw new ObjectDisposedException ("ResourceSet is closed.");
-			lock (Table) {
-				if (resources_read)
-					return;
-
-				IDictionaryEnumerator i = Reader.GetEnumerator();
-				i.Reset ();
-				while (i.MoveNext ()) 
-					Table.Add (i.Key, i.Value);
-				resources_read = true;
-			}
-		}
-
-		internal UnmanagedMemoryStream GetStream (string name, bool ignoreCase)
-		{
-			if (IsDisposed)
-				throw new ObjectDisposedException ("ResourceSet is closed.");
-
-			IDictionaryEnumerator i = Reader.GetEnumerator();
-			i.Reset ();
-			while (i.MoveNext ()){
-				if (String.Compare (name, (string) i.Key, ignoreCase) == 0)
-					return ((ResourceReader.ResourceEnumerator) i).ValueAsStream;
-			}
-			return null;
-		}
-	}
-}

+ 0 - 520
mcs/class/corlib/System.Resources/ResourceWriter.cs

@@ -1,520 +0,0 @@
-//
-// System.Resources.ResourceWriter.cs
-//
-// Authors:
-//	Duncan Mak <[email protected]>
-//	Dick Porter <[email protected]>
-//	Gert Driesen <[email protected]>
-//
-// (C) 2001, 2002 Ximian, Inc. 	http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System.IO;
-using System.Collections;
-using System.Text;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Formatters.Binary;
-
-namespace System.Resources
-{
-	[System.Runtime.InteropServices.ComVisible (true)]
-	public sealed class ResourceWriter : IResourceWriter, IDisposable
-	{
-		class TypeByNameObject
-		{
-			public readonly string TypeName;
-			public readonly byte [] Value;
-
-			public TypeByNameObject (string typeName, byte [] value)
-			{
-				TypeName = typeName;
-				Value = (byte []) value.Clone ();
-			}
-		}
-
-		class StreamWrapper
-		{
-			public readonly bool CloseAfterWrite;
-			public readonly Stream Stream;
-
-			public StreamWrapper (Stream stream, bool closeAfterWrite)
-			{
-				Stream = stream;
-				CloseAfterWrite = closeAfterWrite;
-			}
-		}
-
-		SortedList resources = new SortedList (StringComparer.OrdinalIgnoreCase);
-		Stream stream;
-		
-		public ResourceWriter (Stream stream)
-		{
-			if (stream == null)
-				throw new ArgumentNullException ("stream");
-			if (!stream.CanWrite)
-				throw new ArgumentException ("Stream was not writable.");
-
-			this.stream = stream;
-		}
-		
-		public ResourceWriter (String fileName)
-		{
-			if (fileName == null)
-				throw new ArgumentNullException ("fileName");
-
-			stream = new FileStream(fileName, FileMode.Create,
-				FileAccess.Write);
-		}
-
-		Func <Type, string> type_name_converter;
-
-		public Func<Type, string> TypeNameConverter {
-			get {
-				return type_name_converter;
-			}
-			set {
-				type_name_converter = value;
-			}
-		}
-		
-		public void AddResource (string name, byte[] value)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-			if (resources == null)
-				throw new InvalidOperationException ("The resource writer has already been closed and cannot be edited");
-			if (resources [name] != null)
-				throw new ArgumentException ("Resource already present: " + name);
-
-			resources.Add(name, value);
-		}
-		
-		public void AddResource (string name, object value)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-			if (resources == null)
-				throw new InvalidOperationException ("The resource writer has already been closed and cannot be edited");
-			if (resources[name] != null)
-				throw new ArgumentException ("Resource already present: " + name);
-			if (value is Stream) {
-				Stream stream = value as Stream;
-				if (!stream.CanSeek)
-					throw new ArgumentException ("Stream does not support seeking.");
-
-				if (!(value is MemoryStream)) // We already support MemoryStream
-					value = new StreamWrapper (stream, false);
-			}
-
-			resources.Add(name, value);
-		}
-		
-		public void AddResource (string name, string value)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-			if (resources == null)
-				throw new InvalidOperationException ("The resource writer has already been closed and cannot be edited");
-			if (resources [name] != null)
-				throw new ArgumentException ("Resource already present: " + name);
-
-			resources.Add(name, value);
-		}
-
-		public void AddResource (string name, Stream value)
-		{
-			// It seems .Net adds this overload just to make the api complete,
-			// but AddResource (string name, object value) is already checking for Stream.
-			AddResource (name, (object)value);
-		}
-
-		public void AddResource (string name, Stream value, bool closeAfterWrite)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-			if (resources == null)
-				throw new InvalidOperationException ("The resource writer has already been closed and cannot be edited");
-			if (resources [name] != null)
-				throw new ArgumentException ("Resource already present: " + name);
-
-			if (stream == null) {
-				resources.Add (name, null); // Odd.
-				return;
-			}
-				
-			if (!stream.CanSeek)
-				throw new ArgumentException ("Stream does not support seeking.");
-
-			resources.Add (name, new StreamWrapper (value, true));
-		}
-
-		public void Close ()
-		{
-			Dispose (true);
-		}
-		
-		public void Dispose ()
-		{
-			Dispose (true);
-		}
-
-		private void Dispose (bool disposing)
-		{
-			if (disposing) {
-				if (resources != null)
-					Generate();
-				if (stream != null)
-					stream.Close();
-				GC.SuppressFinalize (this);
-			}
-			resources = null;
-			stream = null;
-		}
-
-		public void AddResourceData (string name, string typeName, byte [] serializedData)
-		{
-			if (name == null)
-				throw new ArgumentNullException ("name");
-			if (typeName == null)
-				throw new ArgumentNullException ("typeName");
-			if (serializedData == null)
-				throw new ArgumentNullException ("serializedData");
-
-			// shortcut
-			AddResource (name, new TypeByNameObject (typeName, serializedData));
-		}
-
-		public void Generate ()
-		{
-			BinaryWriter writer;
-			IFormatter formatter;
-
-			if (resources == null)
-				throw new InvalidOperationException ("The resource writer has already been closed and cannot be edited");
-
-			writer = new BinaryWriter (stream, Encoding.UTF8);
-			formatter = new BinaryFormatter (null, new StreamingContext (StreamingContextStates.File | StreamingContextStates.Persistence));
-
-			/* The ResourceManager header */
-			
-			writer.Write (ResourceManager.MagicNumber);
-			writer.Write (ResourceManager.HeaderVersionNumber);
-			
-			/* Build the rest of the ResourceManager
-			 * header in memory, because we need to know
-			 * how long it is in advance
-			 */
-			MemoryStream resman_stream = new MemoryStream ();
-			BinaryWriter resman = new BinaryWriter (resman_stream,
-							     Encoding.UTF8);
-
-			string type_name = null;
-			if (type_name_converter != null)
-				type_name = type_name_converter (typeof (ResourceReader));
-			if (type_name == null)
-				type_name = typeof (ResourceReader).AssemblyQualifiedName;
-
-			resman.Write (type_name);
-			resman.Write (typeof (RuntimeResourceSet).FullName);
-
-			/* Only space for 32 bits of header len in the
-			 * resource file format
-			 */
-			int resman_len = (int) resman_stream.Length;
-			writer.Write (resman_len);
-			writer.Write (resman_stream.GetBuffer (), 0, resman_len);
-
-			/* We need to build the ResourceReader name
-			 * and data sections simultaneously
-			 */
-			MemoryStream res_name_stream = new MemoryStream ();
-			BinaryWriter res_name = new BinaryWriter (res_name_stream, Encoding.Unicode);
-
-			MemoryStream res_data_stream = new MemoryStream ();
-			BinaryWriter res_data = new BinaryWriter (res_data_stream,
-							       Encoding.UTF8);
-
-			/* Not sure if this is the best collection to
-			 * use, I just want an unordered list of
-			 * objects with fast lookup, but without
-			 * needing a key.  (I suppose a hashtable with
-			 * key==value would work, but I need to find
-			 * the index of each item later)
-			 */
-			ArrayList types = new ArrayList ();
-			int [] hashes = new int [resources.Count];
-			int [] name_offsets = new int [resources.Count];
-			int count = 0;
-			
-			IDictionaryEnumerator res_enum = resources.GetEnumerator ();
-			while (res_enum.MoveNext()) {
-				/* Hash the name */
-				hashes [count] = GetHash ((string) res_enum.Key);
-
-				/* Record the offsets */
-				name_offsets [count] = (int) res_name.BaseStream.Position;
-
-				/* Write the name section */
-				res_name.Write ((string) res_enum.Key);
-				res_name.Write ((int) res_data.BaseStream.Position);
-
-				if (res_enum.Value == null) {
-					Write7BitEncodedInt (res_data, -1);
-					count++;
-					continue;
-				}
-				// implementation note: TypeByNameObject is
-				// not used in 1.x profile.
-				TypeByNameObject tbn = res_enum.Value as TypeByNameObject;
-				Type type = tbn != null ? null : res_enum.Value.GetType();
-				object typeObj = tbn != null ? (object) tbn.TypeName : type;
-
-				/* Keep a list of unique types */
-				// do not output predefined ones.
-				switch ((type != null && !type.IsEnum) ? Type.GetTypeCode (type) : TypeCode.Empty) {
-				case TypeCode.Decimal:
-				case TypeCode.Single:
-				case TypeCode.Double:
-				case TypeCode.SByte:
-				case TypeCode.Int16:
-				case TypeCode.Int32:
-				case TypeCode.Int64:
-				case TypeCode.Byte:
-				case TypeCode.UInt16:
-				case TypeCode.UInt32:
-				case TypeCode.UInt64:
-				case TypeCode.DateTime:
-				case TypeCode.String:
-					break;
-				default:
-					if (type == typeof (TimeSpan))
-						break;
-					if (type == typeof (MemoryStream))
-						break;
-					if (type == typeof (StreamWrapper))
-						break;
-					if (type==typeof(byte[]))
-						break;
-
-					if (!types.Contains (typeObj))
-						types.Add (typeObj);
-					/* Write the data section */
-					Write7BitEncodedInt(res_data, (int) PredefinedResourceType.FistCustom + types.IndexOf(typeObj));
-					break;
-				}
-
-				/* Strangely, Char is serialized
-				 * rather than just written out
-				 */
-				if (tbn != null)
-					res_data.Write((byte []) tbn.Value);
-				else if (type == typeof (Byte)) {
-					res_data.Write ((byte) PredefinedResourceType.Byte);
-					res_data.Write ((Byte) res_enum.Value);
-				} else if (type == typeof (Decimal)) {
-					res_data.Write ((byte) PredefinedResourceType.Decimal);
-					res_data.Write ((Decimal) res_enum.Value);
-				} else if (type == typeof (DateTime)) {
-					res_data.Write ((byte) PredefinedResourceType.DateTime);
-					res_data.Write (((DateTime) res_enum.Value).Ticks);
-				} else if (type == typeof (Double)) {
-					res_data.Write ((byte) PredefinedResourceType.Double);
-					res_data.Write ((Double) res_enum.Value);
-				} else if (type == typeof (Int16)) {
-					res_data.Write ((byte) PredefinedResourceType.Int16);
-					res_data.Write ((Int16) res_enum.Value);
-				} else if (type == typeof (Int32)) {
-					res_data.Write ((byte) PredefinedResourceType.Int32);
-					res_data.Write ((Int32) res_enum.Value);
-				} else if (type == typeof (Int64)) {
-					res_data.Write ((byte) PredefinedResourceType.Int64);
-					res_data.Write ((Int64) res_enum.Value);
-				} else if (type == typeof (SByte)) {
-					res_data.Write ((byte) PredefinedResourceType.SByte);
-					res_data.Write ((SByte) res_enum.Value);
-				} else if (type == typeof (Single)) {
-					res_data.Write ((byte) PredefinedResourceType.Single);
-					res_data.Write ((Single) res_enum.Value);
-				} else if (type == typeof (String)) {
-					res_data.Write ((byte) PredefinedResourceType.String);
-					res_data.Write ((String) res_enum.Value);
-				} else if (type == typeof (TimeSpan)) {
-					res_data.Write ((byte) PredefinedResourceType.TimeSpan);
-					res_data.Write (((TimeSpan) res_enum.Value).Ticks);
-				} else if (type == typeof (UInt16)) {
-					res_data.Write ((byte) PredefinedResourceType.UInt16);
-					res_data.Write ((UInt16) res_enum.Value);
-				} else if (type == typeof (UInt32)) {
-					res_data.Write ((byte) PredefinedResourceType.UInt32);
-					res_data.Write ((UInt32) res_enum.Value);
-				} else if (type == typeof (UInt64)) {
-					res_data.Write ((byte) PredefinedResourceType.UInt64);
-					res_data.Write ((UInt64) res_enum.Value);
-				} else if (type == typeof (byte[])) {
-					res_data.Write ((byte) PredefinedResourceType.ByteArray);
-					byte [] data = (byte[]) res_enum.Value;
-					res_data.Write ((uint) data.Length);
-					res_data.Write (data, 0, data.Length);
-				} else if (type == typeof (MemoryStream)) {
-					res_data.Write ((byte) PredefinedResourceType.Stream);
-					byte [] data = ((MemoryStream) res_enum.Value).ToArray ();
-					res_data.Write ((uint) data.Length);
-					res_data.Write (data, 0, data.Length);
-				} else if (type == typeof (StreamWrapper)) {
-					StreamWrapper sw = (StreamWrapper) res_enum.Value;
-					sw.Stream.Position = 0;
-
-					res_data.Write ((byte) PredefinedResourceType.Stream);
-					byte [] data = ReadStream (sw.Stream);
-					res_data.Write ((uint) data.Length);
-					res_data.Write (data, 0, data.Length);
-
-					if (sw.CloseAfterWrite)
-						sw.Stream.Close ();
-				} else {
-					/* non-intrinsic types are
-					 * serialized
-					 */
-					formatter.Serialize (res_data.BaseStream, res_enum.Value);
-				}
-				count++;
-			}
-
-			/* Sort the hashes, keep the name offsets
-			 * matching up
-			 */
-			Array.Sort (hashes, name_offsets);
-			
-			/* now do the ResourceReader header */
-
-			writer.Write (2);
-			writer.Write (resources.Count);
-			writer.Write (types.Count);
-
-			/* Write all of the unique types */
-			foreach (object type in types) {
-				if (type is Type)
-					writer.Write(((Type) type).AssemblyQualifiedName);
-				else
-					writer.Write((string) type);
-			}
-
-			/* Pad the next fields (hash values) on an 8
-			 * byte boundary, using the letters "PAD"
-			 */
-			int pad_align = (int) (writer.BaseStream.Position & 7);
-			int pad_chars = 0;
-
-			if (pad_align != 0)
-				pad_chars = 8 - pad_align;
-
-			for (int i = 0; i < pad_chars; i++)
-				writer.Write ((byte) "PAD" [i % 3]);
-
-			/* Write the hashes */
-			for (int i = 0; i < resources.Count; i++)
-				writer.Write (hashes[i]);
-
-			/* and the name offsets */
-			for (int i = 0; i < resources.Count; i++)
-				writer.Write (name_offsets [i]);
-
-			/* Write the data section offset */
-			int data_offset= (int) writer.BaseStream.Position +
-				(int) res_name_stream.Length + 4;
-			writer.Write (data_offset);
-
-			/* The name section goes next */
-			writer.Write (res_name_stream.GetBuffer(), 0,
-				     (int) res_name_stream.Length);
-			/* The data section is last */
-			writer.Write (res_data_stream.GetBuffer(), 0,
-				     (int) res_data_stream.Length);
-
-			res_name.Close ();
-			res_data.Close ();
-
-			/* Don't close writer, according to the spec */
-			writer.Flush ();
-
-			// ResourceWriter is no longer editable
-			resources = null;
-		}
-
-		byte [] ReadStream (Stream stream)
-		{
-			byte [] buff = new byte [stream.Length];
-			int pos = 0;
-
-			// Read Stream.Length bytes at most, and stop
-			// immediately if Read returns 0.
-			do {
-				int n = stream.Read (buff, pos, buff.Length - pos);
-				if (n == 0)
-					break;
-
-				pos += n;
-
-			} while (pos < stream.Length);
-
-			return buff;
-		}
-
-		// looks like it is (similar to) DJB hash
-		int GetHash (string name)
-		{
-			uint hash = 5381;
-
-			for (int i=0; i<name.Length; i++)
-				hash = ((hash << 5) + hash) ^ name [i];
-			
-			return ((int) hash);
-		}
-
-		/* Cut and pasted from BinaryWriter, because it's
-		 * 'protected' there.
-		 */
-		void Write7BitEncodedInt (BinaryWriter writer, int value)
-		{
-			do {
-				int high = (value >> 7) & 0x01ffffff;
-				byte b = (byte) (value & 0x7f);
-
-				if (high != 0)
-					b = (byte) (b | 0x80);
-
-				writer.Write (b);
-				value = high;
-			} while (value != 0);
-		}
-
-		internal Stream Stream {
-			get {
-				return stream;
-			}
-		}
-	}
-}

+ 0 - 76
mcs/class/corlib/System.Resources/RuntimeResourceSet.cs

@@ -1,76 +0,0 @@
-//
-// System.Resources.InternalResourceSet
-//
-// Authors:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-using System.IO;
-
-namespace System.Resources {
-
-	// ResourceSet.GetObject always returns the same object reference - but ResourceManager doesn't use it!
-	// Instead another internal type, RuntimeResourceSet, is used to return a cloned object (fix for bug #366489)
-	[Serializable]
-	internal class RuntimeResourceSet : ResourceSet {
-
-		// Constructor for Activator.CreateInstance from Silverlight
-		public RuntimeResourceSet (UnmanagedMemoryStream stream) : base (stream)
-		{
-		}
-		
-		public RuntimeResourceSet (Stream stream) :
-			base (stream)
-		{
-		}
-
-		public RuntimeResourceSet (string fileName) :
-			base (fileName)
-		{
-		}
-
-		public override object GetObject (string name)
-		{
-			if (Reader == null)
-				throw new ObjectDisposedException ("ResourceSet is closed.");
-
-			return CloneDisposableObjectIfPossible (base.GetObject (name));
-		}
-
-		public override object GetObject (string name, bool ignoreCase)
-		{
-			if (Reader == null)
-				throw new ObjectDisposedException ("ResourceSet is closed.");
-
-			return CloneDisposableObjectIfPossible (base.GetObject (name, ignoreCase));
-		}
-
-		// if possible return a clone of the object if it's (a) clonable and (b) disposable
-		private object CloneDisposableObjectIfPossible (object value)
-		{
-			ICloneable clonable = (value as ICloneable);
-			return (clonable != null && (value is IDisposable)) ? clonable.Clone () : value;
-		}
-	}
-}

+ 0 - 51
mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs

@@ -1,51 +0,0 @@
-//
-// System.Resources.SatelliteContractVersionAttribute.cs
-//
-// Author:
-//	Duncan Mak ([email protected])
-//
-// (C) 2001 Ximian, Inc.		http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-namespace System.Resources
-{
-	[AttributeUsage (AttributeTargets.Assembly)]
-	[System.Runtime.InteropServices.ComVisible (true)]
-	public sealed class SatelliteContractVersionAttribute : Attribute
-	{
-		private Version ver; 
-		
-		// Constructor
-		public SatelliteContractVersionAttribute (string version)
-		{
-				ver = new Version(version);
-		}
-		public string Version
-		{
-				get { return ver.ToString(); }
-		}
-	}
-}

+ 0 - 38
mcs/class/corlib/System.Resources/UltimateResourceFallbackLocation.cs

@@ -1,38 +0,0 @@
-//
-// System.Resources.ResourceWriter.cs
-//
-// Authors:
-//	Miguel de Icaza <[email protected]>
-//
-//
-// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
-//
-// 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.
-//
-
-namespace System.Resources
-{
-	[System.Runtime.InteropServices.ComVisible (true)]
-	[Serializable]
-	public enum UltimateResourceFallbackLocation {
-		MainAssembly = 0,
-		Satellite = 1
-	}
-}

+ 1 - 1
mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs

@@ -53,7 +53,7 @@ namespace System.Runtime.InteropServices
 			: this(obj, GCHandleType.Normal)
 		{}
 
-		private GCHandle(object value, GCHandleType type)
+		internal GCHandle(object value, GCHandleType type)
 		{
 			// MS does not crash/throw on (most) invalid GCHandleType values (except -1)
 			if ((type < GCHandleType.Weak) || (type > GCHandleType.Pinned))

+ 5 - 0
mcs/class/corlib/System.Threading/Thread.cs

@@ -1024,5 +1024,10 @@ namespace System.Threading {
 			throw new NotImplementedException ();
 		}
 #endif
+
+		internal CultureInfo GetCurrentUICultureNoAppX ()
+		{
+			return CultureInfo.CurrentUICulture;
+		}
 	}
 }

+ 3 - 137
mcs/class/corlib/Test/System.Resources/ResourceManagerTest.cs

@@ -43,24 +43,6 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Resources
 {
-	class ResourceManagerPoker : ResourceManager
-	{
-		public ResourceManagerPoker ()
-		{
-			BaseNameField = String.Format ("Test{0}resources{0}MyResources", Path.DirectorySeparatorChar);
-		}
-
-		public Hashtable GetResourceSets ()
-		{
-			return base.ResourceSets;
-		}
-
-		public void InitResourceSets ()
-		{
-			base.ResourceSets = new Hashtable ();
-		}
-	}
-
 	[TestFixture]
 	public class ResourceManagerTest
 	{
@@ -365,7 +347,6 @@ namespace MonoTests.System.Resources
 		}
 
 		[Test]
-		[Category ("NotWorking")]
 		public void CreateFileBasedResourceManager_BaseName_Resources ()
 		{
 			ResourceManager rm = ResourceManager.CreateFileBasedResourceManager (
@@ -622,26 +603,17 @@ namespace MonoTests.System.Resources
 
 		[Test]
 		[Category ("MobileNotWorking")]
+		[SetCulture ("de")]
 		public void GetString_ResourceSet_Disposed ()
 		{
-			Thread.CurrentThread.CurrentUICulture = new CultureInfo ("de");
 			ResourceManager rm = ResourceManager.
 				CreateFileBasedResourceManager ("MyResources", "Test/resources", null);
 			ResourceSet rs = rm.GetResourceSet (new CultureInfo ("de"),
 				true, true);
 			rs.Dispose ();
 
-			try {
-				rm.GetString ("deHelloWorld");
-				Assert.Fail ("#1");
-			} catch (ObjectDisposedException ex) {
-				// Cannot access a closed resource set
-				Assert.AreEqual (typeof (ObjectDisposedException), ex.GetType (), "#2");
-				Assert.IsNull (ex.InnerException, "#3");
-				Assert.IsNotNull (ex.Message, "#4");
-			} finally {
-				rm.ReleaseAllResources ();
-			}
+			Assert.IsNull (rm.GetString ("deHelloWorld"));
+			rm.ReleaseAllResources ();
 		}
 
 		[Test]
@@ -812,112 +784,6 @@ namespace MonoTests.System.Resources
 			rm.ReleaseAllResources ();
 		}
 
-		[Test]
-		public void InternalGetResourceSet_Culture_Null ()
-		{
-			MockResourceManager rm = new MockResourceManager (typeof (string));
-			try {
-				rm.InternalGetResourceSet ((CultureInfo) null, false, true);
-				Assert.Fail ("#1");
-			} catch (ArgumentNullException ex) {
-				// Key cannot be null
-				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
-				Assert.IsNull (ex.InnerException, "#3");
-				Assert.IsNotNull (ex.Message, "#4");
-				Assert.IsNotNull (ex.ParamName, "#5");
-				Assert.AreEqual ("key", ex.ParamName, "#6");
-			}
-		}
-
-		[Test]
-		public void TestResourceManagerGetResourceSetEmpty ()
-		{
-			Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
-			ResourceManagerPoker rm = new ResourceManagerPoker ();
-			try {
-				rm.GetResourceSet (CultureInfo.InvariantCulture,
-					true, true);
-				Assert.Fail ("#1");
-			} catch (NullReferenceException) {
-			}
-		}
-
-		[Test]
-		public void TestResourceManagerReleaseAllResourcesEmpty ()
-		{
-			Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
-			ResourceManagerPoker rm = new ResourceManagerPoker ();
-			try {
-				rm.ReleaseAllResources ();
-				Assert.Fail ("#1");
-			} catch (NullReferenceException) {
-			}
-		}
-
-		[Test]
-		public void TestResourceManagerReleaseAllResources ()
-		{
-			Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
-			ResourceManagerPoker rm = new ResourceManagerPoker ();
-			rm.InitResourceSets ();
-			rm.ReleaseAllResources ();
-		}
-
-		[Test]
-		[Category ("MobileNotWorking")]
-		public void TestResourceManagerResourceSets ()
-		{
-			Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
-			ResourceManagerPoker rm = new ResourceManagerPoker ();
-
-			rm.InitResourceSets ();
-
-			ResourceSet rs = rm.GetResourceSet (CultureInfo.InvariantCulture,
-							    true, true);
-
-			Assert.AreEqual (1, rm.GetResourceSets().Keys.Count, "#01");
-
-			rs.Close ();
-
-			Assert.AreEqual (1, rm.GetResourceSets().Keys.Count, "#02");
-			
-			rs = rm.GetResourceSet (CultureInfo.InvariantCulture,
-						true, true);
-			
-			Assert.AreEqual (1, rm.GetResourceSets().Keys.Count, "#03");
-
-			rm.ReleaseAllResources ();
-		}
-		
-		[Test]
-		[Category ("MobileNotWorking")]
-		public void TestResourceManagerResourceSetClosedException ()
-		{
-			Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
-			ResourceManagerPoker rm = new ResourceManagerPoker ();
-			
-			rm.InitResourceSets ();
-			
-			ResourceSet rs = rm.GetResourceSet (CultureInfo.InvariantCulture,
-							    true, true);
-			rs.Close ();
-			ResourceSet rs2 = rs;
-			rs = rm.GetResourceSet (CultureInfo.InvariantCulture, true, true);
-			Assert.IsTrue (Object.ReferenceEquals (rs2, rs), "#0");
-
-			try {
-				rm.GetString ("HelloWorld");
-				Assert.Fail ("#1");
-			} catch (ObjectDisposedException ex) {
-				// ResourceSet is closed
-				Assert.AreEqual (typeof (ObjectDisposedException), ex.GetType (), "#2");
-				Assert.IsNull (ex.InnerException, "#3");
-				Assert.IsNotNull (ex.Message, "#4");
-			} finally {
-				rm.ReleaseAllResources ();
-			}
-		}
-
 		[Test]
 		public void TestSatellites ()
 		{

+ 1 - 2
mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs

@@ -90,8 +90,7 @@ namespace MonoTests.System.Resources
 		}
 
 		[Test]
-		[Ignore ("Not covered in the docs, not sure what the correct behavior should be for this")]
-		[ExpectedException (typeof (DirectoryNotFoundException))]
+		[ExpectedException (typeof (BadImageFormatException))]
 		public void ConstructorString_Bad ()
 		{
 			Assert.IsTrue (File.Exists (m_BadResourceFile));

+ 24 - 12
mcs/class/corlib/corlib.dll.sources

@@ -445,18 +445,6 @@ System.Reflection.Emit/StringToken.cs
 System.Reflection.Emit/TypeBuilder.cs
 System.Reflection.Emit/TypeToken.cs
 System.Reflection.Emit/UnmanagedMarshal.cs
-System.Resources/IResourceReader.cs
-System.Resources/IResourceWriter.cs
-System.Resources/MissingManifestResourceException.cs
-System.Resources/MissingSatelliteAssemblyException.cs
-System.Resources/NeutralResourcesLanguageAttribute.cs
-System.Resources/ResourceManager.cs
-System.Resources/ResourceReader.cs
-System.Resources/ResourceSet.cs
-System.Resources/ResourceWriter.cs
-System.Resources/RuntimeResourceSet.cs
-System.Resources/SatelliteContractVersionAttribute.cs
-System.Resources/UltimateResourceFallbackLocation.cs
 System.Resources/Win32Resources.cs
 System.Runtime/AssemblyTargetedPatchBandAttribute.cs
 System.Runtime/GCLargeObjectHeapCompactionMode.cs
@@ -1431,6 +1419,7 @@ ReferenceSources/RuntimeHandles.cs
 ../../../external/referencesource/mscorlib/system/io/binarywriter.cs
 ../../../external/referencesource/mscorlib/system/io/bufferedstream.cs
 ../../../external/referencesource/mscorlib/system/io/memorystream.cs
+../../../external/referencesource/mscorlib/system/io/pinnedbuffermemorystream.cs
 ../../../external/referencesource/mscorlib/system/io/stream.cs
 ../../../external/referencesource/mscorlib/system/io/streamreader.cs
 ../../../external/referencesource/mscorlib/system/io/streamwriter.cs
@@ -1439,6 +1428,7 @@ ReferenceSources/RuntimeHandles.cs
 ../../../external/referencesource/mscorlib/system/io/textreader.cs
 ../../../external/referencesource/mscorlib/system/io/textwriter.cs
 ../../../external/referencesource/mscorlib/system/io/unmanagedmemorystream.cs
+../../../external/referencesource/mscorlib/system/io/unmanagedmemorystreamwrapper.cs
 
 ../../../external/referencesource/mscorlib/system/reflection/ambiguousmatchexception.cs
 ../../../external/referencesource/mscorlib/system/reflection/assemblyattributes.cs
@@ -1481,7 +1471,29 @@ ReferenceSources/RuntimeHandles.cs
 ../../../external/referencesource/mscorlib/system/reflection/typefilter.cs
 ../../../external/referencesource/mscorlib/system/reflection/typeinfo.cs
 
+../../../external/referencesource/mscorlib/system/resources/__fastresourcecomparer.cs
+../../../external/referencesource/mscorlib/system/resources/__hresults.cs
+../../../external/referencesource/mscorlib/system/resources/filebasedresourcegroveler.cs
+../../../external/referencesource/mscorlib/system/resources/iresourcegroveler.cs
+../../../external/referencesource/mscorlib/system/resources/iresourcereader.cs
+../../../external/referencesource/mscorlib/system/resources/iresourcewriter.cs
+../../../external/referencesource/mscorlib/system/resources/looselylinkedresourcereference.cs
+../../../external/referencesource/mscorlib/system/resources/manifestbasedresourcegroveler.cs
+../../../external/referencesource/mscorlib/system/resources/missingmanifestresourceexception.cs
+../../../external/referencesource/mscorlib/system/resources/missingsatelliteassemblyexception.cs
+../../../external/referencesource/mscorlib/system/resources/neutralresourceslanguageattribute.cs
+../../../external/referencesource/mscorlib/system/resources/resourcefallbackmanager.cs
+../../../external/referencesource/mscorlib/system/resources/resourcemanager.cs
+../../../external/referencesource/mscorlib/system/resources/resourcereader.cs
+../../../external/referencesource/mscorlib/system/resources/resourceset.cs
+../../../external/referencesource/mscorlib/system/resources/resourcetypecode.cs
+../../../external/referencesource/mscorlib/system/resources/resourcewriter.cs
+../../../external/referencesource/mscorlib/system/resources/runtimeresourceset.cs
+../../../external/referencesource/mscorlib/system/resources/satellitecontractversionattribute.cs
+../../../external/referencesource/mscorlib/system/resources/ultimateresourcefallbacklocation.cs
+
 ../../../external/referencesource/mscorlib/system/runtime/versioning/binarycompatibility.cs
+../../../external/referencesource/mscorlib/system/runtime/versioning/multitargetinghelpers.cs
 ../../../external/referencesource/mscorlib/system/runtime/versioning/targetframeworkid.cs
 
 ../../../external/referencesource/mscorlib/system/runtime/compilerservices/accessedthroughpropertyattribute.cs