Пример #1
0
        private static Stream InternalTryGetResource(string assemblyName, string defaultNamespace, IEnumerable <string> resourcePath, bool failOnMissingResource)
        {
            Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == assemblyName);

            if (!(assembly == null))
            {
                return(ResourcesManager.InternalTryGetResource(assembly, defaultNamespace, resourcePath, failOnMissingResource));
            }
            if (failOnMissingResource)
            {
                throw new InvalidOperationException("Assembly not found: " + assemblyName);
            }
            return(null);
        }
Пример #2
0
 public static Stream TryGetResourceWithFullPath(string assemblyName, IEnumerable <string> resourcePath)
 {
     return(ResourcesManager.InternalTryGetResource(assemblyName, resourcePath.First <string>(), resourcePath.Skip(1), false));
 }
Пример #3
0
 public static Stream TryGetResource(string assemblyName, IEnumerable <string> resourcePath)
 {
     return(ResourcesManager.InternalTryGetResource(assemblyName, assemblyName, resourcePath, false));
 }
Пример #4
0
 public static Stream GetResource(Assembly assembly, IEnumerable <string> resourcePath)
 {
     return(ResourcesManager.InternalTryGetResource(assembly, assembly.GetName().Name, resourcePath, true));
 }
Пример #5
0
 public static Stream GetResourceWithFullPath(Assembly assembly, IEnumerable <string> resourcePath)
 {
     return(ResourcesManager.InternalTryGetResource(assembly, resourcePath.First <string>(), resourcePath.Skip(1), true));
 }