Commit Graph
133 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 Safar 8fd1f765d7 Fix ResourceSet regression caused by 4a17e24982 2011-09-06 11:58:59 +01:00
Marek Habersack 4a17e24982 [corlib] Do not cache disposed resource sets. 2011-05-04 23:30:57 +02:00
Rolf Bjarne Kvinge f64261401d Fix many corcompare issues for moonlight 2011-03-31 16:05:03 +02:00
Gonzalo Paniagua Javier 4043ebef2c Add a case-insensitive hashtable
Use a hashtable instead of a loop when 'ignoreCase' is set.
	Based on a patch by Curtis Wensley.
2011-01-03 17:20:21 -05:00
Marek Safar 6391925927 Keep only single Dispose implementation in ResourceReader 2010-12-15 11:36:24 +00: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
Carlos Alberto Cortez 69d631c7ae * ResourceWriter.cs: Implement 4.0 TypeNameConverter.
2010-07-05  Carlos Alberto Cortez <[email protected]>


svn path=/trunk/mcs/; revision=159933
2010-07-06 03:56:45 +00:00
Carlos Alberto Cortez f6e6eb0387 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.


svn path=/trunk/mcs/; revision=159930
2010-07-06 01:10:45 +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 e7a082fb0a 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

svn path=/trunk/mcs/; revision=152739
2010-03-01 19:34:39 +00:00
Miguel de Icaza 3c39ac4586 Jumbo patch for NET_2_0, mscorlib is now clean
svn path=/trunk/mcs/; revision=145621
2009-11-06 22:23:59 +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
Jb Evain 288a6a3d9e 2009-10-19 Jb Evain <[email protected]>
* ResourceReader.cs: fix the build.


svn path=/trunk/mcs/; revision=144356
2009-10-19 08:43:52 +00:00
Sebastien Pouliot 365294284f In .:
2009-10-18  Sebastien Pouliot  <[email protected]>

	* corlib.dll.sources: Remove System.IO.IntPtrStream since it can
	be replaced by (public in 2.0+) UnmanagedMemoryStream
	* net_2_1_raw_corlib.dll.sources: Remove System.IO.IntPtrStream 
	since it can be replaced by UnmanagedMemoryStream

In System.Resources:
2009-10-18  Sebastien Pouliot  <[email protected]>

	* ResourceReader.cs, ResourceSet.cs, RuntimeResourceSet.cs: Use 
	UnmanagedMemoryStream (instead of IntPtrStream)


svn path=/trunk/mcs/; revision=144322
2009-10-18 15:01:04 +00:00
Geoff Norton 571d214c11 2009-04-16 Geoff Norton <[email protected]>
* ResourceWriter.cs: The magic internal type here is required to match
        Microsofts for SL2 resource deserialization.

svn path=/trunk/mcs/; revision=131919
2009-04-16 17:50:38 +00:00
Gonzalo Paniagua Javier bf33585141 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.


svn path=/trunk/mcs/; revision=128814
2009-03-07 00:06:04 +00:00
Gonzalo Paniagua Javier d98635e2ce 2009-02-27 Gonzalo Paniagua Javier <[email protected]>
* ResourceSet.cs: populating the resource should be locked because the
	resourceset could be shared.


svn path=/trunk/mcs/; revision=128215
2009-02-27 17:32:18 +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
Miguel de Icaza 8e07acf772 Multiple files:
Deals with the extension to Environment.OSVersion.Platform that might return a new
value MacOSX (6) on .NET
 

svn path=/trunk/mcs/; revision=121711
2008-12-17 17:56:25 +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
Marek Safar 159314e044 Warnings cleanup
svn path=/trunk/mcs/; revision=111730
2008-08-27 18:28:16 +00:00
Marek Safar cc9c53a109 Warnings cleanup
svn path=/trunk/mcs/; revision=111713
2008-08-27 15:40:13 +00:00
Larry Ewing b26f5b08cd 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.


svn path=/trunk/mcs/; revision=110159
2008-08-11 20:11:16 +00:00
Marek Safar fd5f828b6e 2008-06-30 Marek Safar <[email protected]>
* ResourceReader.cs: Cache resources enumerator in ResourceReader.


svn path=/trunk/mcs/; revision=106880
2008-06-30 11:38:02 +00:00
Marek Safar afb97c23b3 2008-06-30 Marek Safar <[email protected]>
* ResourceReader.cs: Sealed ResourceEnumerator.


svn path=/trunk/mcs/; revision=106879
2008-06-30 10:44:40 +00:00
Rodrigo Kumpera 53950f9e2c In .:
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.


svn path=/trunk/mcs/; revision=106825
2008-06-28 17:10:47 +00:00
Rodrigo Kumpera 8a35085cbe In .:
2008-06-27  Rodrigo Kumpera  <[email protected]>

	* ResourceReader.cs: Avoid an extra array copy for the resource arrays.


svn path=/trunk/mcs/; revision=106808
2008-06-28 03:18:14 +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
Marek Habersack e999470c5c 2008-05-28 Marek Habersack <[email protected]>
* ResourceReader.cs: use structs instead of classes for the
	internal ResourceInfo and ResourceCacheItem data items. Patch from
	Andreas Nahr <[email protected]>, thanks!

svn path=/trunk/mcs/; revision=104334
2008-05-28 21:33:46 +00:00
Marek Habersack b19cf7ba52 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).

svn path=/trunk/mcs/; revision=104224
2008-05-28 01:38:23 +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 f96ea1be6b * Win32Resources.cs: On 2.0 profile, initialize fixed info to empty
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.               
* AssemblyBuilder.cs: Added enum that determines the type of the
native (version) resource. Added fields for holding the native
resource type and the version culture. The versioninfo_culture was
introduced to hold the original culture of the assembly, since
the AssemblyCultureAttribute should only affect the language of the
versioninfo block when not used in compiler context. Move constructin 
of native version info to DefineVersionInfoResourceImpl to allow 
attributes to affect the versioninfo after DefineVersionInfoResource 
has been invoked. Allow ArgumentException for invalid culture string 
to bubble up. In compiler context, use FileVersion as default value
for ProductionVersion.
* AssemblyBuilderTest.cs: Enabled DefineUnmanagedResource and
DefineVersionInfoResource tests for ArgumentException when native
resource is already defined. Added tests for not supported culture
in AssemblyCultureAttribute when definining versioninfo resource.

svn path=/trunk/mcs/; revision=99280
2008-03-29 12:35:53 +00:00
Gert Driesen 799c8514f1 * RuntimeResourceSet.cs: On 2.0 profile, throw ObjectDisposedException
when ResourceSet is disposed.

svn path=/trunk/mcs/; revision=98388
2008-03-15 12:43:40 +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 a0400ec347 * ResourceWriter.cs: On 2.0 profile, do not mistakenly identify an
enum as a predefined type. Fixes bug #325223.
* ResourceWriterTest.cs: Enabled test for writing enum value on 2.0
profile.

svn path=/trunk/mcs/; revision=94016
2008-01-26 19:53:48 +00:00
Gert Driesen d5dc02f026 * ResourceWriterTest.cs: Added ctor tests. Added tests for AddResource
overloads. Added test for argument null checks. Added test for bug
#339074. Added test for invoking Generate () multiple times.
* 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.

svn path=/trunk/mcs/; revision=89412
2007-11-10 19:10:06 +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
Gert Driesen f20bb3562f * ResourceReader.cs: Fixed exception message to match MS. Removed
duplicate checks from string ctor.


svn path=/trunk/mcs/; revision=84799
2007-08-24 11:22:04 +00:00