public static LibraryCustomization GetForAssembly(string assemblyPath, IPathManager pathManager, bool useAdditionalPaths = true) { if (triedPaths.ContainsKey(assemblyPath)) { return(triedPaths[assemblyPath] ? cache[assemblyPath] : null); } var customizationPath = ""; var resourceAssemblyPath = ""; XDocument xDocument = null; Assembly resAssembly = null; if (ResolveForAssembly(assemblyPath, pathManager, ref customizationPath)) { xDocument = XDocument.Load(customizationPath); } if (ResolveResourceAssembly(assemblyPath, pathManager, useAdditionalPaths, out resourceAssemblyPath)) { resAssembly = Assembly.LoadFrom(resourceAssemblyPath); } // We need 'LibraryCustomization' if either one is not 'null' if (xDocument != null || (resAssembly != null)) { var c = new LibraryCustomization(resAssembly, xDocument); triedPaths.Add(assemblyPath, true); cache.Add(assemblyPath, c); return(c); } triedPaths.Add(assemblyPath, false); return(null); }
public static LibraryCustomization GetForAssembly(string assemblyPath, IPathManager pathManager, bool useAdditionalPaths = true) { if (triedPaths.ContainsKey(assemblyPath)) { return triedPaths[assemblyPath] ? cache[assemblyPath] : null; } var customizationPath = ""; var resourceAssemblyPath = ""; XDocument xDocument = null; Assembly resAssembly = null; if (ResolveForAssembly(assemblyPath, pathManager, ref customizationPath)) { xDocument = XDocument.Load(customizationPath); } if (ResolveResourceAssembly(assemblyPath, pathManager, useAdditionalPaths, out resourceAssemblyPath)) { resAssembly = Assembly.LoadFrom(resourceAssemblyPath); } // We need 'LibraryCustomization' if either one is not 'null' if (xDocument != null || (resAssembly != null)) { var c = new LibraryCustomization(resAssembly, xDocument); triedPaths.Add(assemblyPath, true); cache.Add(assemblyPath, c); return c; } triedPaths.Add(assemblyPath, false); return null; }
private string GetRootCategory() { if (string.IsNullOrEmpty(Assembly)) { return(CoreUtils.IsInternalMethod(FunctionName) ? LibraryServices.Categories.Operators : LibraryServices.Categories.BuiltIns); } LibraryCustomization cust = LibraryCustomizationServices.GetForAssembly(Assembly, pathManager); if (cust != null) { string f = cust.GetNamespaceCategory(Namespace); if (!String.IsNullOrEmpty(f)) { return(f); } } string filename = Path.GetFileNameWithoutExtension(Assembly); return(string.IsNullOrEmpty(Namespace) ? filename : filename + "." + Namespace); }