Commit Graph
53 Commits
Author SHA1 Message Date
Stephen McConnel 25ab7f7e36 [corlib] Fix localized resource loading bug (#14987)
We shouldn't share non-existent resources between resource
managers since different resources can have different localizations.
2014-03-14 17:24:46 +01:00
Rodrigo Kumpera b96d05dac3 Kill the MOONLIGHT define in corlib. 2013-02-11 16:03:28 -05:00
Marek Safar 7883a2dafd Clean up some static initializers 2012-10-03 12:19:55 +01:00
Marek Safar a850901cee Revert part of 4a17e24982 which broke most of existing tests 2011-09-06 11:59:00 +01:00
Marek Habersack 4a17e24982 [corlib] Do not cache disposed resource sets. 2011-05-04 23:30:57 +02:00
Marek Safar bd05c6c836 Some .net 4.0 api compatibility fixes 2010-12-15 11:12:07 +00:00
Carlos Alberto Cortez 508ef19c50 2010-07-07 Carlos Alberto Cortez <[email protected]>
4.0 updates.

	* ResourceManager.cs: Mark ResourceSets as obsolete.
	* ResourceReader.cs: New public Dispose method.


svn path=/trunk/mcs/; revision=160005
2010-07-07 13:20:13 +00:00
Jb Evain e1b7f59d45 use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153669
2010-03-16 12:24:55 +00:00
Miguel de Icaza dd82b6b192 More removal of old defines
svn path=/trunk/mcs/; revision=145612
2009-11-06 21:29:51 +00:00
Sebastien Pouliot 1b1c161668 2009-11-01 Sebastien Pouliot <[email protected]>
* ResourceManager.cs (GetResourceFilePath): Don't use 
	'resourceDir' which should always be null for Moonlight


svn path=/trunk/mcs/; revision=145165
2009-11-01 16:45:14 +00:00
Gonzalo Paniagua Javier 67a10ac834 Do not throw exceptions when attempting to load satellite assemblies
svn path=/trunk/mcs/; revision=124405
2009-01-24 05:34:42 +00:00
Gonzalo Paniagua Javier 1606b07040 2008-12-22 Gonzalo Paniagua Javier <[email protected]>
* ResourceManager.cs: cache negative results too.


svn path=/trunk/mcs/; revision=122017
2008-12-22 22:39:27 +00:00
Gonzalo Paniagua Javier 6add7b40ad 2008-12-18 Gonzalo Paniagua Javier <[email protected]>
* ResourceManager.cs: avoid duplication of keys if more than one
	thread is creating the ResourceSet.


svn path=/trunk/mcs/; revision=121766
2008-12-18 06:31:36 +00:00
Gonzalo Paniagua Javier a5ba5c6943 2008-12-17 Gonzalo Paniagua Javier <[email protected]>
* ResourceManager.cs: cache ResourceSets instead of loading them from
	their assembly every time they are needed.


svn path=/trunk/mcs/; revision=121664
2008-12-17 08:21:55 +00:00
Zoltan Varga 6f1004d26c 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.

svn path=/trunk/mcs/; revision=106787
2008-06-27 23:23:39 +00:00
Andreas N 458c9cfeab 2008-06-27 Andreas Nahr <[email protected]>
* MissingManifestResourceException.cs:
	* MissingSatelliteAssemblyException.cs:
	* ResourceManager.cs: Fix parameter names

svn path=/trunk/mcs/; revision=106730
2008-06-27 07:47:05 +00:00
Miguel de Icaza d05e5cd463 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.


svn path=/trunk/mcs/; revision=102841
2008-05-08 22:20:07 +00:00
Gert Driesen 9c2eeebe7e * 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.
* ResourceManagerTest.cs: Enabled and added ResourceSetType asserts.
Added test for disposed ResourceSet. Avoid using ExpectedException.
* ResourceSetTest.cs: Improved tests for ctor argument checks. Avoid
using ExpectedException.

svn path=/trunk/mcs/; revision=98387
2008-03-15 12:41:37 +00:00
Sebastien Pouliot bf1c061517 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.


svn path=/trunk/mcs/; revision=97297
2008-03-04 13:44:30 +00:00
Gert Driesen 23d32e135d * 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.
* ResourceManager.cs: Added tests for null argument checks. Added test
for GetStream with resource file that does not exist.

svn path=/trunk/mcs/; revision=88308
2007-10-27 15:32:24 +00:00
Gert Driesen 43f7164507 * 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.

svn path=/trunk/mcs/; revision=85900
2007-09-17 16:35:59 +00:00
Gert Driesen 53fbc5fb1a * 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.
* ResourceManagerTest.cs: Restore the original UI Culture on TearDown.
Added ctor tests. Added tests for CreateFileBasedResourceManager.
Added tests for GetObject, GetString and GetResourceFileName.
Improved tests for GetStream. Added test for IgnoreCase.

svn path=/trunk/mcs/; revision=85866
2007-09-17 10:38:08 +00:00
Atsushi Eno c98ee48759 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.

	* UnmanagedMemoryStream.cs : added Closed event for sys.Resources use.
	* IntPtrStream.cs : added internal get_BaseAddress(), for the same.

	* ResourceManagerTest.cs : added tests for GetStream() (including
	  2.0 resource format tests).


svn path=/trunk/mcs/; revision=78024
2007-05-28 03:35:21 +00:00
Alexander Olk e988c2faeb * 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]>


svn path=/trunk/mcs/; revision=70271
2006-12-30 21:51:30 +00:00
Alexander Olk 741a9a9c21 2006-12-30 Alexander Olk <[email protected]>
* ResourceManager.cs: Iterate through the values of the ResourceSets
	hashtable in ReleaseAllResources instead through the hashtable itself.


svn path=/trunk/mcs/; revision=70258
2006-12-30 16:07:24 +00:00
Alexander Olk 31181ed8f3 In System/System.ComponentModel:
2006-10-29 Alexander Olk <[email protected]>

	* ComponentResourceManager.cs: Don't close the resource set in
	  ApplyResources, it is possible to call ApplyResources multiple
	  times. Closing the resource set means that it gets disposed.
	  Fixes bug #79182.

In corlib/System.Resources:
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.


svn path=/trunk/mcs/; revision=67076
2006-10-29 10:02:00 +00:00
Robert Jordan 410e0af78e 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.


svn path=/trunk/mcs/; revision=57937
2006-03-14 02:04:40 +00:00
Robert Jordan a8d88f55e6 Reverted until I get more details. See #77242.
svn path=/trunk/mcs/; revision=55648
2006-01-16 19:24:18 +00:00
Robert Jordan d9f3f2a889 2006-01-13 Robert Jordan <[email protected]>
* ResourceManager.cs: Fixed GetString/GetObject's recursion
	which never fall back to the invariant or neutral culture if
	the key was not found in a specific culture. Fixes bug #77242.


svn path=/trunk/mcs/; revision=55573
2006-01-14 10:14:45 +00:00
Gonzalo Paniagua Javier 04dfc04887 2005-03-22 Gonzalo Paniagua Javier <[email protected]>
* ResourceManager.cs: use culture.Equals in InternalGetResourceSet().


svn path=/trunk/mcs/; revision=42130
2005-03-23 03:22:49 +00:00
Ben Maurer 415b4749e8 2004-12-06 Ben Maurer <[email protected]>
* ResourceManager.cs (InternalResourceManager): on msft, they
	search for a case-insenstitive match too here.


svn path=/trunk/mcs/; revision=37277
2004-12-07 03:17:14 +00:00
Duncan Mak 13d1764537 Add license and copyright to all source files in corlib
svn path=/trunk/mcs/; revision=29249
2004-06-11 02:09:36 +00:00
Sebastien Pouliot 1e3d58625d 2004-05-02 Sebastien Pouliot <[email protected]>
* ResourceManager.cs: Avoid endless recursion when a resource file
	isn't found.

svn path=/trunk/mcs/; revision=28707
2004-06-02 16:27:02 +00:00
Dick Porter 06a99a7b5a 2003-09-07 Dick Porter <[email protected]>
* Temporary workaround for bug 43567, so that Npgsql at least
	can run.

svn path=/trunk/mcs/; revision=18703
2003-10-07 13:28:14 +00:00
Gonzalo Paniagua Javier 918a9a6a6e 2003-05-06 Gonzalo Paniagua Javier <[email protected]>
* ResourceManager.cs: fixed infinite loop when the resource is not
	found. Also fixes bug #34196.

svn path=/trunk/mcs/; revision=14345
2003-05-06 19:12:13 +00:00
Gonzalo Paniagua Javier 10ba48bc8f 2003-05-04 Gonzalo Paniagua Javier <[email protected]>
* System.Reflection/Assembly.cs: implemented GetSatelliteAssembly.

	* System.Resources/ResourceManager.cs: enabled the code that calls
	GetSatelliteAssembly and ignore the exception thrown if the assembly
	cannot be loaded.

svn path=/trunk/mcs/; revision=14252
2003-05-04 14:49:01 +00:00
Gonzalo Paniagua Javier 66896ebced 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.

svn path=/trunk/mcs/; revision=14234
2003-05-03 23:59:05 +00:00
Dick Porter 9de46ebb4b 2002-08-14 Dick Porter <[email protected]>
* ResourceSet.cs: Throw the correct exceptions

	* ResourceManager.cs: Implemented all unfinished methods

svn path=/trunk/mcs/; revision=6627
2002-08-14 10:29:20 +00:00
Piers Haken 84187bf9a6 fixed member accessibility to match MS (corcompare).
svn path=/trunk/mcs/; revision=3531
2002-04-01 06:07:43 +00:00
Duncan Mak 1f356938bb Huge indentation fix. Don't worry, I tested so no typos were introduced. ;-)
svn path=/trunk/mcs/; revision=2077
2002-01-20 13:58:36 +00:00
Duncan Mak 28ff4b98fc 2002-1-17 Duncan Mak <duncan@[email protected]>
* *.cs: convert to Miguel's brace style.

svn path=/trunk/mcs/; revision=2032
2002-01-18 00:17:08 +00:00
Duncan Mak 07df008a5e 2002-01-17 Duncan Mak <[email protected]>
* ResourceManager.cs: Fixed GetNeutralResourcesLanguage () and added
	      new attributes documented in 1.0 SDK.

svn path=/trunk/mcs/; revision=2024
2002-01-17 18:51:34 +00:00
Miguel de Icaza a88f8fd7de Integrate Nant sources into the mcs code base to simplify the build.
Also, make Resources compile.

svn path=/trunk/mcs/; revision=2017
2002-01-17 16:45:39 +00:00
Duncan Mak 69423ab0b6 2002-01-16 Duncan Mak <[email protected]>
* ResourceManager.cs: Removed MonoTODO from GetNeutralResourcesLanguage (Assembly)
      because Miguel just implemented the whole class, including the constructor that
      I needed (CultureInfo (string)).

svn path=/trunk/mcs/; revision=2007
2002-01-16 20:11:32 +00:00
Duncan Mak 3c2865bb5e 2002-01-16 Duncan Mak <[email protected]>
* ResourceManager.cs: After reading the tutorial from the SDK,
      finished all the ResourceManager constructors and removed those
      MonoTODO tags. 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.

svn path=/trunk/mcs/; revision=2005
2002-01-16 19:18:45 +00:00
Duncan Mak 9a8f8a4c5b Added MonoTODO to InternalGetResourceSet(). I forgot to save before my last
commit.

svn path=/trunk/mcs/; revision=1936
2002-01-09 20:18:10 +00:00
Duncan Mak 7476295ab7 * 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().

svn path=/trunk/mcs/; revision=1935
2002-01-09 20:16:23 +00:00
Duncan Mak 4bee68895b 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 Barn, so this shouldn't
	      break the build.

svn path=/trunk/mcs/; revision=1934
2002-01-09 20:02:45 +00:00
Duco Fijma e69cd3906c Added some MonoTODO attributes
svn path=/trunk/mcs/; revision=1902
2002-01-07 18:28:58 +00:00
Duco Fijma 31f5fff339 Finalized IResourceReader and IResourceWriter. Made other files compileable
svn path=/trunk/mcs/; revision=1873
2002-01-06 17:49:47 +00:00