Beispiel #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));
            }
        }
Beispiel #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));
            }
        }
Beispiel #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));
        }
Beispiel #4
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params string[] paths)
 {
     return(CreateCatelog(log, paths));
 }
Beispiel #5
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params Type[] additionalTypes)
 {
     return(CreateContainer(log, GetProviderPaths(additionalTypes).ToArray()));
 }
Beispiel #6
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params string[] paths) {
     return CreateCatelog(log, paths);
 }
Beispiel #7
0
 public static CompositionContainer CreateContainer(ICatalogLog log, params Type[] additionalTypes) {
     return CreateContainer(log, GetProviderPaths(additionalTypes).ToArray());
 }
Beispiel #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);
        }