We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
System.Globalization
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
System.Resources
-
Expand
FastResourceComparer
-
Expand
IResourceReader
-
Expand
IResourceWriter
-
Expand
MissingManifestResourceException
-
Expand
MissingSatelliteAssemblyException
-
Expand
NeutralResourcesLanguageAttribute
-
Expand
PrecannedResource
-
Expand
ResourceEnumerator
-
Expand
ResourceLocator
-
Expand
ResourceManager
-
AddResourceSet(Hashtable, CultureInfo, ResourceSet)
-
BaseName()
-
CanUseDefaultResourceClasses(string, string)
-
CaseInsensitiveManifestResourceStreamLookup(Assembly, string)
-
CommonSatelliteAssemblyInit()
-
CompareNames(string, string, AssemblyName)
-
CreateFileBasedResourceManager(string, string, Type)
-
CreateResourceSet(Stream, Assembly)
-
CreateResourceSet(string)
-
FallbackLocation()
-
FindResourceFile(CultureInfo)
-
GetNeutralResourcesLanguage(Assembly)
-
GetNeutralResourcesLanguage(Assembly, UltimateResourceFallbackLocation)
-
GetObject(string)
-
GetObject(string, CultureInfo)
-
GetObject(string, CultureInfo, bool)
-
GetResourceFileName(CultureInfo)
-
GetResourceSet(CultureInfo, bool, bool)
-
GetSatelliteAssembliesFromConfig()
-
GetSatelliteAssembly(CultureInfo)
-
GetSatelliteContractVersion(Assembly)
-
GetStream(string)
-
GetStream(string, CultureInfo)
-
GetString(string)
-
GetString(string, CultureInfo)
-
IgnoreCase()
-
InternalGetResourceSet(CultureInfo, bool, bool)
-
MainAssemblyContainsResourceBlob(string)
-
ReleaseAllResources()
-
ResourceManager()
-
ResourceManager(string, Assembly)
-
ResourceManager(string, Assembly, Type)
-
ResourceManager(string, string, Type)
-
ResourceManager(Type)
-
ResourceSetType()
-
TryLookingForSatellite(CultureInfo)
-
Expand
ResourceReader
-
Expand
ResourceSet
-
Expand
ResourceTypeCode
-
Expand
ResourceWriter
-
Expand
RuntimeResourceSet
-
Expand
SatelliteContractVersionAttribute
-
Expand
UltimateResourceFallbackLocation
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- namespace System.Resources
- {
- using System;
- using System.IO;
- using System.Globalization;
- using System.Collections;
- using System.Text;
- using System.Reflection;
- using System.Runtime.Remoting.Activation;
- using System.Runtime.Serialization;
- using System.Security.Permissions;
- using System.Threading;
- using System.Runtime.InteropServices;
- using Microsoft.Win32;
- using System.Collections.Generic;
- using System.Runtime.Versioning;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [Serializable()]
- [System.Runtime.InteropServices.ComVisible(true)]
- public class ResourceManager
- {
- protected string BaseNameField;
-
-
- protected Hashtable ResourceSets;
- private string moduleDir;
-
- protected Assembly MainAssembly;
-
- private Type _locationInfo;
-
- private Type _userResourceSet;
-
- private CultureInfo _neutralResourcesCulture;
-
- private bool _ignoreCase;
-
-
-
- private bool UseManifest;
-
-
-
- private bool UseSatelliteAssem;
-
-
- private static Hashtable _installedSatelliteInfo;
-
-
-
- private static bool _checkedConfigFile;
-
-
-
- [OptionalField()]
- private UltimateResourceFallbackLocation _fallbackLoc;
-
- [OptionalField()]
- private Version _satelliteContractVersion;
- [OptionalField()]
- private bool _lookedForSatelliteContractVersion;
-
- private Assembly _callingAssembly;
-
- public static readonly int MagicNumber = unchecked((int)3203386062u);
-
-
-
-
-
-
-
-
- public static readonly int HeaderVersionNumber = 1;
-
-
-
-
-
-
-
-
-
-
-
- private static readonly Type _minResourceSet = typeof(ResourceSet);
-
-
-
- static internal readonly string ResReaderTypeName = typeof(ResourceReader).FullName;
- static internal readonly string ResSetTypeName = typeof(RuntimeResourceSet).FullName;
- static internal readonly string MscorlibName = typeof(ResourceReader).Assembly.FullName;
- internal const string ResFileExtension = ".resources";
- internal const int ResFileExtensionLength = 10;
-
-
-
- static internal readonly int DEBUG = 0;
-
- protected ResourceManager()
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- _callingAssembly = Assembly.nGetExecutingAssembly(ref stackMark);
- }
-
-
-
-
-
-
-
-
-
-
-
- [ResourceExposure(ResourceScope.Machine)]
- [ResourceConsumption(ResourceScope.Machine)]
- private ResourceManager(string baseName, string resourceDir, Type usingResourceSet)
- {
-
-
-
-
-
-
-
-
-
- if (null == baseName)
- throw new ArgumentNullException("baseName");
- if (null == resourceDir)
- throw new ArgumentNullException("resourceDir");
-
- BaseNameField = baseName;
-
- moduleDir = resourceDir;
- _userResourceSet = usingResourceSet;
- ResourceSets = new Hashtable();
- UseManifest = false;
-
- #if _DEBUG
- if (DEBUG >= 3) {
-
- CultureInfo culture = CultureInfo.InvariantCulture;
- string defaultResPath = FindResourceFile(culture);
- if (defaultResPath == null || !File.Exists(defaultResPath)) {
- string defaultResName = GetResourceFileName(culture);
- string dir = moduleDir;
- if (defaultResPath != null)
- dir = Path.GetDirectoryName(defaultResPath);
- BCLDebug.Log("While constructing a ResourceManager, your application's neutral " + ResFileExtension + " file couldn't be found. Expected to find a " + ResFileExtension + " file called \"" + defaultResName + "\" in the directory \"" + dir + "\". However, this is optional, and if you're extremely careful, you can ignore this.");
- }
- else
- BCLDebug.Log("ResourceManager found default culture's " + ResFileExtension + " file, " + defaultResPath);
- }
- #endif
- }
-
-
- public ResourceManager(string baseName, Assembly assembly)
- {
- if (null == baseName)
- throw new ArgumentNullException("baseName");
- if (null == assembly)
- throw new ArgumentNullException("assembly");
-
- MainAssembly = assembly;
- _locationInfo = null;
- BaseNameField = baseName;
-
- CommonSatelliteAssemblyInit();
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- _callingAssembly = Assembly.nGetExecutingAssembly(ref stackMark);
- if (assembly == typeof(object).Assembly && _callingAssembly != assembly)
- _callingAssembly = null;
- }
-
- public ResourceManager(string baseName, Assembly assembly, Type usingResourceSet)
- {
- if (null == baseName)
- throw new ArgumentNullException("baseName");
- if (null == assembly)
- throw new ArgumentNullException("assembly");
-
- MainAssembly = assembly;
- _locationInfo = null;
- BaseNameField = baseName;
-
- if (usingResourceSet != null && (usingResourceSet != _minResourceSet) && !(usingResourceSet.IsSubclassOf(_minResourceSet)))
- throw new ArgumentException(Environment.GetResourceString("Arg_ResMgrNotResSet"), "usingResourceSet");
- _userResourceSet = usingResourceSet;
-
- CommonSatelliteAssemblyInit();
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- _callingAssembly = Assembly.nGetExecutingAssembly(ref stackMark);
- if (assembly == typeof(object).Assembly && _callingAssembly != assembly)
- _callingAssembly = null;
- }
-
- public ResourceManager(Type resourceSource)
- {
- if (null == resourceSource)
- throw new ArgumentNullException("resourceSource");
-
- _locationInfo = resourceSource;
- MainAssembly = _locationInfo.Assembly;
- BaseNameField = resourceSource.Name;
-
- CommonSatelliteAssemblyInit();
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- _callingAssembly = Assembly.nGetExecutingAssembly(ref stackMark);
-
- if (MainAssembly == typeof(object).Assembly && _callingAssembly != MainAssembly)
- _callingAssembly = null;
- }
-
-
-
- private void CommonSatelliteAssemblyInit()
- {
- UseManifest = true;
- UseSatelliteAssem = true;
-
- ResourceSets = new Hashtable();
-
- _fallbackLoc = UltimateResourceFallbackLocation.MainAssembly;
-
- #if _DEBUG
- if (DEBUG >= 3) {
-
- string defaultResName = GetResourceFileName(CultureInfo.InvariantCulture);
- string outputResName = defaultResName;
- if (_locationInfo != null && _locationInfo.Namespace != null)
- outputResName = _locationInfo.Namespace + Type.Delimiter + defaultResName;
- if (!MainAssemblyContainsResourceBlob(defaultResName)) {
- BCLDebug.Log("Your main assembly really should contain the neutral culture's resources. Expected to find a resource blob in your assembly manifest called \"" + outputResName + "\". Check capitalization in your assembly manifest. If you're extremely careful though, this is only optional, not a requirement.");
- }
- else {
- BCLDebug.Log("ResourceManager found default culture's " + ResFileExtension + " file, " + defaultResName);
- }
- }
- #endif
- }
-
-
- public virtual string BaseName {
- get { return BaseNameField; }
- }
-
-
-
- public virtual bool IgnoreCase {
- get { return _ignoreCase; }
- set { _ignoreCase = value; }
- }
-
-
-
- public virtual Type ResourceSetType {
- get { return (_userResourceSet == null) ? typeof(RuntimeResourceSet) : _userResourceSet; }
- }
-
- protected UltimateResourceFallbackLocation FallbackLocation {
- get { return _fallbackLoc; }
- set { _fallbackLoc = value; }
- }
-
-
-
-
-
-
-
-
-
-
- public virtual void ReleaseAllResources()
- {
- #if _DEBUG
- if (DEBUG >= 1)
- BCLDebug.Log("Calling ResourceManager::ReleaseAllResources");
- #endif
- IDictionaryEnumerator setEnum = ResourceSets.GetEnumerator();
-
-
- ResourceSets = new Hashtable();
- while (setEnum.MoveNext()) {
- ((ResourceSet)setEnum.Value).Close();
- }
- }
-
-
-
-
- #if _DEBUG
- private bool MainAssemblyContainsResourceBlob(string defaultResName)
- {
- string resName = defaultResName;
- if (_locationInfo != null && _locationInfo.Namespace != null)
- resName = _locationInfo.Namespace + Type.Delimiter + defaultResName;
- string[] blobs = MainAssembly.GetManifestResourceNames();
- foreach (string s in blobs)
- if (s.Equals(resName))
- return true;
- return false;
- }
- #endif
-
- [ResourceExposure(ResourceScope.Machine)]
- [ResourceConsumption(ResourceScope.Machine)]
- public static ResourceManager CreateFileBasedResourceManager(string baseName, string resourceDir, Type usingResourceSet)
- {
- return new ResourceManager(baseName, resourceDir, usingResourceSet);
- }
-
-
-
-
-
-
-
-
- [ResourceExposure(ResourceScope.Machine)]
- [ResourceConsumption(ResourceScope.Machine)]
- private string FindResourceFile(CultureInfo culture)
- {
-
-
-
-
-
- string fileName = GetResourceFileName(culture);
-
-
-
- if (moduleDir != null) {
- #if _DEBUG
- if (DEBUG >= 3)
- BCLDebug.Log("FindResourceFile: checking module dir: \"" + moduleDir + '"');
- #endif
-
- string path = Path.Combine(moduleDir, fileName);
- if (File.Exists(path)) {
- #if _DEBUG
- if (DEBUG >= 3)
- BCLDebug.Log("Found resource file in module dir! " + path);
- #endif
- return path;
- }
- }
-
- #if _DEBUG
- if (DEBUG >= 3)
- BCLDebug.Log("Couldn't find resource file in module dir, checking .\\" + fileName);
- #endif
-
-
- if (File.Exists(fileName))
- return fileName;
-
- return null;
-
- }
-
-
-
-
-
-
-
-
-
-
-
- protected virtual string GetResourceFileName(CultureInfo culture)
- {
- StringBuilder sb = new StringBuilder(255);
- sb.Append(BaseNameField);
-
- if (!culture.Equals(CultureInfo.InvariantCulture)) {
- CultureInfo.VerifyCultureName(culture, true);
- sb.Append('.');
- sb.Append(culture.Name);
- }
- sb.Append(ResFileExtension);
- return sb.ToString();
- }
-
-
-
-
-
-
-
-
-
- public virtual ResourceSet GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents)
- {
- if (null == culture)
- throw new ArgumentNullException("culture");
-
-
- Hashtable localResourceSets = ResourceSets;
- ResourceSet rs;
- if (localResourceSets != null) {
- rs = (ResourceSet)localResourceSets[culture];
- if (null != rs)
- return rs;
- }
-
- if (UseManifest && culture.Equals(CultureInfo.InvariantCulture)) {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- string fileName = GetResourceFileName(culture);
- Stream stream = MainAssembly.GetManifestResourceStream(_locationInfo, fileName, _callingAssembly == MainAssembly, ref stackMark);
- if (createIfNotExists && stream != null) {
- rs = CreateResourceSet(stream, MainAssembly);
- lock (localResourceSets) {
- localResourceSets.Add(culture, rs);
- }
- return rs;
- }
- }
-
- return InternalGetResourceSet(culture, createIfNotExists, tryParents);
- }
-
-
-
-
-
- [ResourceExposure(ResourceScope.None)]
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
- protected virtual ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents)
- {
- BCLDebug.Assert(culture != null, "culture != null");
-
- #if _DEBUG
- if (DEBUG >= 3)
- BCLDebug.Log("GetResourceSet(" + culture.Name + " [" + culture.LCID + "], " + createIfNotExists + ", " + tryParents + ")");
- #endif
-
- Hashtable localResourceSets = ResourceSets;
- ResourceSet rs = (ResourceSet)localResourceSets[culture];
- if (null != rs)
- return rs;
-
-
-
-
-
-
-
- Stream stream = null;
- string fileName = null;
- Assembly satellite = null;
-
- if (UseManifest) {
- fileName = GetResourceFileName(culture);
-
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- if (UseSatelliteAssem) {
- CultureInfo lookForCulture = culture;
- if (_neutralResourcesCulture == null)
- _neutralResourcesCulture = GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc);
-
-
-
- if (culture.Equals(_neutralResourcesCulture) && FallbackLocation == UltimateResourceFallbackLocation.MainAssembly) {
- #if _DEBUG
- if (DEBUG >= 4)
- BCLDebug.Log("ResMgr::InternalGetResourceSet - Your neutral resources are sufficient for this culture. Skipping satellites & using neutral resources for: " + culture.Name);
- #endif
-
- lookForCulture = CultureInfo.InvariantCulture;
- fileName = GetResourceFileName(lookForCulture);
- }
-
-
-
- if (lookForCulture.Equals(CultureInfo.InvariantCulture)) {
- if (FallbackLocation == UltimateResourceFallbackLocation.Satellite) {
- satellite = GetSatelliteAssembly(_neutralResourcesCulture);
-
-
-
- if (satellite == null) {
- string satAssemName = MainAssembly.nGetSimpleName() + ".resources.dll";
- if (_satelliteContractVersion != null)
- satAssemName += ", Version=" + _satelliteContractVersion.ToString();
-
- AssemblyName an = new AssemblyName();
- an.SetPublicKey(MainAssembly.nGetPublicKey());
- byte[] token = an.GetPublicKeyToken();
-
- int iLen = token.Length;
- StringBuilder publicKeyTok = new StringBuilder(iLen * 2);
- for (int i = 0; i < iLen; i++)
- publicKeyTok.Append(token[i].ToString("x", CultureInfo.InvariantCulture));
- satAssemName += ", PublicKeyToken=" + publicKeyTok;
- string cultureName = _neutralResourcesCulture.Name;
- if (cultureName.Length == 0)
- cultureName = "<invariant>";
- throw new MissingSatelliteAssemblyException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("MissingSatelliteAssembly_Culture_Name"), _neutralResourcesCulture, satAssemName), cultureName);
- }
-
- fileName = GetResourceFileName(_neutralResourcesCulture);
- }
- else
- satellite = MainAssembly;
- }
- else if (!TryLookingForSatellite(lookForCulture))
- satellite = null;
- else
-
-
- satellite = GetSatelliteAssembly(lookForCulture);
-
-
-
-
-
- if (satellite != null) {
-
-
-
-
-
- rs = (ResourceSet)localResourceSets[lookForCulture];
- if (null != rs) {
- #if _DEBUG
- if (DEBUG >= 1)
- BCLDebug.Log("ResMgr::GetResourceSet - After loading a satellite assembly, we already have the resource set for culture \"" + lookForCulture.Name + "\" [" + lookForCulture.LCID + "]. You must have had an assembly load callback that called into this instance of the ResourceManager! Eeew.");
- #endif
- return rs;
- }
-
-
-
-
- bool canSkipSecurityCheck = MainAssembly == satellite && _callingAssembly == MainAssembly;
- stream = satellite.GetManifestResourceStream(_locationInfo, fileName, canSkipSecurityCheck, ref stackMark);
- if (stream == null)
- stream = CaseInsensitiveManifestResourceStreamLookup(satellite, fileName);
- }
-
- #if _DEBUG
- if (DEBUG >= 3)
- BCLDebug.Log("ResMgr manifest resource lookup in satellite assembly for culture " + (lookForCulture.Equals(CultureInfo.InvariantCulture) ? "[neutral]" : lookForCulture.Name) + (stream == null ? " failed." : " succeeded.") + " assembly name: " + (satellite == null ? "<null>" : satellite.nGetSimpleName() + " assembly culture: " + satellite.GetLocale().Name + " [" + satellite.GetLocale().LCID + "]"));
- #endif
- }
- else {
-
- satellite = MainAssembly;
- stream = MainAssembly.GetManifestResourceStream(_locationInfo, fileName, _callingAssembly == MainAssembly, ref stackMark);
- }
-
- if (stream == null && tryParents) {
-
- if (culture.Equals(CultureInfo.InvariantCulture)) {
-
- if (MainAssembly == typeof(object).Assembly && BaseName.Equals("mscorlib")) {
-
- BCLDebug.Assert(false, "Couldn't get mscorlib" + ResFileExtension + " from mscorlib's assembly" + Environment.NewLine + Environment.NewLine + "Are you building the runtime on your machine? Chances are the BCL directory didn't build correctly. Type 'build -c' in the BCL directory. If you get build errors, look at buildd.log. If you then can't figure out what's wrong (and you aren't changing the assembly-related metadata code), ask a BCL dev.\n\nIf you did NOT build the runtime, you shouldn't be seeing this and you've found a bug.");
- throw new ExecutionEngineException("mscorlib" + ResFileExtension + " couldn't be found! Large parts of the BCL won't work!");
- }
-
-
- string resName = String.Empty;
- if (_locationInfo != null && _locationInfo.Namespace != null)
- resName = _locationInfo.Namespace + Type.Delimiter;
- resName += fileName;
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_NoNeutralAsm", resName, MainAssembly.nGetSimpleName()));
- }
-
- CultureInfo parent = culture.Parent;
-
-
- rs = InternalGetResourceSet(parent, createIfNotExists, tryParents);
- if (rs != null) {
- AddResourceSet(localResourceSets, culture, ref rs);
- }
- return rs;
- }
- }
-
- else {
-
- new System.Security.Permissions.FileIOPermission(System.Security.Permissions.PermissionState.Unrestricted).Assert();
-
-
- fileName = FindResourceFile(culture);
- if (fileName == null) {
- if (tryParents) {
-
- if (culture.Equals(CultureInfo.InvariantCulture)) {
-
-
-
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_NoNeutralDisk") + Environment.NewLine + "baseName: " + BaseNameField + " locationInfo: " + (_locationInfo == null ? "<null>" : _locationInfo.FullName) + " fileName: " + GetResourceFileName(culture));
- }
-
- CultureInfo parent = culture.Parent;
-
-
- rs = InternalGetResourceSet(parent, createIfNotExists, tryParents);
- if (rs != null) {
- AddResourceSet(localResourceSets, culture, ref rs);
- }
- return rs;
- }
- }
- else {
- rs = CreateResourceSet(fileName);
-
-
-
- if (rs != null) {
- AddResourceSet(localResourceSets, culture, ref rs);
- }
- return rs;
- }
- }
-
- if (createIfNotExists && stream != null && rs == null) {
- #if _DEBUG
- if (DEBUG >= 1)
- BCLDebug.Log("Creating new ResourceSet for culture " + ((culture == CultureInfo.InvariantCulture) ? "[neutral]" : culture.ToString()) + " from file " + fileName);
- #endif
- rs = CreateResourceSet(stream, satellite);
- AddResourceSet(localResourceSets, culture, ref rs);
- }
- #if _DEBUG
- else {
-
- if (!createIfNotExists && stream != null && rs == null) {
-
- if (DEBUG >= 1)
- BCLDebug.Log("NOT creating new ResourceSet because createIfNotExists was false! For culture " + ((culture == CultureInfo.InvariantCulture) ? "[neutral]" : culture.ToString()) + " from file " + fileName);
- }
- }
- #endif
- return rs;
- }
-
-
- private static void AddResourceSet(Hashtable localResourceSets, CultureInfo culture, ref ResourceSet rs)
- {
-
-
-
- lock (localResourceSets) {
-
- ResourceSet lostRace = (ResourceSet)localResourceSets[culture];
- if (lostRace != null) {
- if (!Object.Equals(lostRace, rs)) {
- rs.Dispose();
- rs = lostRace;
- }
- }
- else {
- localResourceSets.Add(culture, rs);
- }
- }
- }
-
-
-
-
-
- private Stream CaseInsensitiveManifestResourceStreamLookup(Assembly satellite, string name)
- {
- StringBuilder sb = new StringBuilder();
- if (_locationInfo != null) {
- string nameSpace = _locationInfo.Namespace;
- if (nameSpace != null) {
- sb.Append(nameSpace);
- if (name != null)
- sb.Append(Type.Delimiter);
- }
- }
- sb.Append(name);
-
- string givenName = sb.ToString();
- CompareInfo comparer = CultureInfo.InvariantCulture.CompareInfo;
- string canonicalName = null;
- foreach (string existingName in satellite.GetManifestResourceNames()) {
- if (comparer.Compare(existingName, givenName, CompareOptions.IgnoreCase) == 0) {
- if (canonicalName == null)
- canonicalName = existingName;
- else
- throw new MissingManifestResourceException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("MissingManifestResource_MultipleBlobs"), givenName, satellite.ToString()));
- }
- }
-
- #if _DEBUG
- if (DEBUG >= 4) {
- if