Esempio n. 1
0
        private static void LoadOneProvider(
            ICatalogLog log,
            string codebase,
            AggregateCatalog catalog
            )
        {
            AssemblyCatalog assemblyCatalog = null;

            const string FailedToLoadAssemblyMessage = "Failed to load interpreter provider assembly {0} {1}";

            try {
                assemblyCatalog = new AssemblyCatalog(codebase);
            } catch (Exception ex) {
                log.Log(String.Format(FailedToLoadAssemblyMessage, codebase, ex));
            }

            if (assemblyCatalog == null)
            {
                return;
            }

            const string FailedToLoadMessage = "Failed to load interpreter provider {0} {1}";

            try {
                catalog.Catalogs.Add(assemblyCatalog);
            } catch (Exception ex) {
                log.Log(String.Format(FailedToLoadMessage, codebase, ex));
            }
        }
Esempio n. 2
0
        private static void LoadOneProvider(
            ICatalogLog log,
            string codebase,
            AggregateCatalog catalog
        ) {

            AssemblyCatalog assemblyCatalog = null;

            const string FailedToLoadAssemblyMessage = "Failed to load interpreter provider assembly {0} {1}";
            try {
                assemblyCatalog = new AssemblyCatalog(codebase);
            } catch (Exception ex) {
                log.Log(String.Format(FailedToLoadAssemblyMessage, codebase, ex));
            }

            if (assemblyCatalog == null) {
                return;
            }

            const string FailedToLoadMessage = "Failed to load interpreter provider {0} {1}";
            try {
                catalog.Catalogs.Add(assemblyCatalog);
            } catch (Exception ex) {
                log.Log(String.Format(FailedToLoadMessage, codebase, ex));
            }
        }
Esempio n. 3
0
        private static CompositionContainer CreateCatelog(ICatalogLog log, IEnumerable <string> asms)
        {
            var catalog = new AggregateCatalog();

            foreach (var codeBase in asms)
            {
                LoadOneProvider(
                    log,
                    codeBase,
                    catalog
                    );
            }

            return(new CompositionContainer(catalog));
        }
Esempio n. 4
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params string[] paths)
 {
     return(CreateCatelog(log, paths));
 }
Esempio n. 5
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params Type[] additionalTypes)
 {
     return(CreateContainer(log, GetProviderPaths(additionalTypes).ToArray()));
 }
Esempio n. 6
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params string[] paths) {
     return CreateCatelog(log, paths);
 }
Esempio n. 7
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params Type[] additionalTypes) {
     return CreateContainer(log, GetProviderPaths(additionalTypes).ToArray());
 }
Esempio n. 8
0
        private static CompositionContainer CreateCatelog(ICatalogLog log, IEnumerable<string> asms) {
            var catalog = new AggregateCatalog();
            foreach (var codeBase in asms) {
                LoadOneProvider(
                    log,
                    codeBase,
                    catalog
                );
            }

            return new CompositionContainer(catalog);
        }