Exemplo n.º 1
0
        public static LibraryCustomization GetForAssembly(string assemblyPath)
        {
            if (triedPaths.ContainsKey(assemblyPath))
            {
                return(triedPaths[assemblyPath] ? cache[assemblyPath] : null);
            }

            var customizationPath    = "";
            var resourceAssemblyPath = "";

            XDocument xDocument   = null;
            Assembly  resAssembly = null;

            if (ResolveForAssembly(assemblyPath, ref customizationPath))
            {
                xDocument = XDocument.Load(customizationPath);
            }

            if (ResolveResourceAssembly(assemblyPath, 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);
        }
Exemplo n.º 2
0
        public static LibraryCustomization GetForAssembly(string assemblyPath)
        {
            if (triedPaths.ContainsKey(assemblyPath))
            {
                return triedPaths[assemblyPath] ? cache[assemblyPath] : null;
            }

            var customizationPath = "";
            if (ResolveForAssembly(assemblyPath, ref customizationPath))
            {
                var c = new LibraryCustomization(XDocument.Load(customizationPath));
                triedPaths.Add(assemblyPath, true);
                cache.Add(assemblyPath, c);
                return c;
            }

            triedPaths.Add(assemblyPath, false);
            return null;
            
        }
Exemplo n.º 3
0
        public static LibraryCustomization GetForAssembly(string assemblyPath)
        {
            if (triedPaths.ContainsKey(assemblyPath))
            {
                return(triedPaths[assemblyPath] ? cache[assemblyPath] : null);
            }

            var customizationPath = "";

            if (ResolveForAssembly(assemblyPath, ref customizationPath))
            {
                var c = new LibraryCustomization(XDocument.Load(customizationPath));
                triedPaths.Add(assemblyPath, true);
                cache.Add(assemblyPath, c);
                return(c);
            }

            triedPaths.Add(assemblyPath, false);
            return(null);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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;

        }