// <summary> // Searches the available ResourceManagerWrapper list for one that matches the given Uri. // It could be either ResourceManagerWrapper for specific libary assembly or Application // main assembly. Package enforces that all Uri will be correctly formated. // </summary> // <param name="uri">Assumed to be relative</param> // <param name="partName">The name of the file in the resource manager</param> // <param name="isContentFile">A flag to indicate that this path is a known loose file at compile time</param> // <returns></returns> private ResourceManagerWrapper GetResourceManagerWrapper(Uri uri, out string partName, out bool isContentFile) { string assemblyName; string assemblyVersion; string assemblyKey; ResourceManagerWrapper rmwResult = ApplicationResourceManagerWrapper; isContentFile = false; BaseUriHelper.GetAssemblyNameAndPart(uri, out partName, out assemblyName, out assemblyVersion, out assemblyKey); if (!String.IsNullOrEmpty(assemblyName)) { string key = assemblyName + assemblyVersion + assemblyKey; _registeredResourceManagers.TryGetValue(key.ToLowerInvariant(), out rmwResult); // first time. Add this to the hash table if (rmwResult == null) { Assembly assembly; assembly = BaseUriHelper.GetLoadedAssembly(assemblyName, assemblyVersion, assemblyKey); if (assembly.Equals(Application.ResourceAssembly)) { // This Uri maps to Application Entry assembly even though it has ";component". rmwResult = ApplicationResourceManagerWrapper; } else { rmwResult = new ResourceManagerWrapper(assembly); } _registeredResourceManagers[key.ToLowerInvariant()] = rmwResult; } } if ((rmwResult == ApplicationResourceManagerWrapper)) { if (rmwResult != null) { // If this is not a resource from a component then it might be // a content file and not an application resource. if (ContentFileHelper.IsContentFile(partName)) { isContentFile = true; rmwResult = null; } } else { // Throw when Application.ResourceAssembly is null. throw new IOException(SR.Get(SRID.EntryAssemblyIsNull)); } } return(rmwResult); }
// Token: 0x06007A52 RID: 31314 RVA: 0x0022AA1C File Offset: 0x00228C1C private ResourceManagerWrapper GetResourceManagerWrapper(Uri uri, out string partName, out bool isContentFile) { ResourceManagerWrapper resourceManagerWrapper = ResourceContainer.ApplicationResourceManagerWrapper; isContentFile = false; string text; string text2; string text3; BaseUriHelper.GetAssemblyNameAndPart(uri, out partName, out text, out text2, out text3); if (!string.IsNullOrEmpty(text)) { string text4 = text + text2 + text3; ResourceContainer._registeredResourceManagers.TryGetValue(text4.ToLowerInvariant(), out resourceManagerWrapper); if (resourceManagerWrapper == null) { Assembly loadedAssembly = BaseUriHelper.GetLoadedAssembly(text, text2, text3); if (loadedAssembly.Equals(Application.ResourceAssembly)) { resourceManagerWrapper = ResourceContainer.ApplicationResourceManagerWrapper; } else { resourceManagerWrapper = new ResourceManagerWrapper(loadedAssembly); } ResourceContainer._registeredResourceManagers[text4.ToLowerInvariant()] = resourceManagerWrapper; } } if (resourceManagerWrapper == ResourceContainer.ApplicationResourceManagerWrapper) { if (resourceManagerWrapper == null) { throw new IOException(SR.Get("EntryAssemblyIsNull")); } if (ContentFileHelper.IsContentFile(partName)) { isContentFile = true; resourceManagerWrapper = null; } } return(resourceManagerWrapper); }