示例#1
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void RegisterOwinMiddleware()
        {
            var log = Factory.ResolveSingleton <ILog>();

            foreach (var plugin in LoadedPlugins.ToArray())
            {
                if (plugin is IPlugin_V2 v2Plugin)
                {
                    try {
                        v2Plugin.RegisterOwinMiddleware();
                    } catch (Exception ex) {
                        log.WriteLine($"Caught exception registering web pipelines for plugin {v2Plugin.Name}: {FormatException(ex)}");
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void RegisterImplementations()
        {
            var log = Factory.ResolveSingleton <ILog>();

            foreach (var plugin in LoadedPlugins.ToArray())
            {
                var snapshot = Provider.ClassFactoryTakeSnapshot();
                try {
                    plugin.RegisterImplementations(Factory.Singleton);
                } catch (Exception ex) {
                    Provider.ClassFactoryRestoreSnapshot(snapshot);

                    var dllFileName = _PluginIDToFileNameMap[plugin.Id];
                    _PluginIDToFileNameMap.Remove(plugin.Id);
                    LoadedPlugins.Remove(plugin);
                    IgnoredPlugins.Add(dllFileName, String.Format(Strings.PluginCannotBeLoaded, ex.Message));
                    log.WriteLine("Caught exception loading plugin {0}: {1}", dllFileName, FormatException(ex));
                }
            }
        }