Пример #1
0
        /// <summary>
        /// Loads Formatter Providers from an assembly.
        /// </summary>
        /// <param name="assembly">The path of the Assembly to load the Providers from.</param>
        public static int LoadFormatterProvidersFromAuto(string assembly)
        {
            Type[] forms;
            LoadFormatterProvidersFromAssembly(assembly, out forms);

            int count = 0;

            // Setup and add to the Collectors
            for (int i = 0; i < forms.Length; i++)
            {
                Collectors.AddPlugin(forms[i], Assembly.GetAssembly(forms[i]));
                foreach (Configuration.Wiki wiki in GlobalSettings.Provider.GetAllWikis())
                {
                    try {
                        SetUp <IFormatterProviderV50>(forms[i], Settings.GetProvider(wiki.WikiName).GetPluginConfiguration(forms[i].FullName));
                        SavePluginStatus(wiki.WikiName, forms[i].FullName, true);
                    }
                    catch (InvalidConfigurationException) {
                        SavePluginStatus(wiki.WikiName, forms[i].FullName, false);
                    }
                }
                count++;
            }

            return(count);
        }
Пример #2
0
        /// <summary>
        /// Loads all formatter providers from dlls.
        /// </summary>
        public static void LoadAllFormatterProviders()
        {
            string[] pluginAssemblies = GlobalSettings.Provider.ListPluginAssemblies();

            List <Type> forms = new List <Type>(2);

            for (int i = 0; i < pluginAssemblies.Length; i++)
            {
                Type[] f;
                LoadFormatterProvidersFromAssembly(pluginAssemblies[i], out f);
                forms.AddRange(f);
            }

            // Add to the Collectors and Setup
            for (int i = 0; i < forms.Count; i++)
            {
                Collectors.AddPlugin(forms[i], Assembly.GetAssembly(forms[i]));
                foreach (PluginFramework.Wiki wiki in GlobalSettings.Provider.GetAllWikis())
                {
                    try {
                        SetUp <IFormatterProviderV40>(forms[i], Settings.GetProvider(wiki.WikiName).GetPluginConfiguration(forms[i].FullName));
                        SavePluginStatus(wiki.WikiName, forms[i].FullName, true);
                    }
                    catch (InvalidConfigurationException) {
                        SavePluginStatus(wiki.WikiName, forms[i].FullName, false);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Loads all formatter providers from dlls.
        /// </summary>
        public static void LoadAllFormatterProviders()
        {
            string[] pluginAssemblies = GlobalSettings.Provider.ListPluginAssemblies();

            List <Type> forms = new List <Type>(2);

            for (int i = 0; i < pluginAssemblies.Length; i++)
            {
                Type[] f;
                LoadFormatterProvidersFromAssembly(pluginAssemblies[i], out f);
                forms.AddRange(f);
            }

            // Add to the Collectors and Setup
            for (int i = 0; i < forms.Count; i++)
            {
                Collectors.AddPlugin(forms[i], Assembly.GetAssembly(forms[i]));
                foreach (Configuration.Wiki wiki in GlobalSettings.Provider.GetAllWikis())
                {
                    try
                    {
                        SetUp <IFormatterProviderV50>(forms[i],
                                                      Settings.GetProvider(wiki.WikiName).GetPluginConfiguration(forms[i].FullName));
                        SavePluginStatus(wiki.WikiName, forms[i].FullName, true);
                    }
                    catch (InvalidConfigurationException)
                    {
                        SavePluginStatus(wiki.WikiName, forms[i].FullName, false);
                    }
                    catch (Exception exception)
                    {
                        SavePluginStatus(wiki.WikiName, forms[i].FullName, false);
                        Log.LogEntry(String.Format("Unable to load provider " + forms[i].FullName + " ({0}).", exception.Message), EntryType.Error, Log.SystemUsername, wiki.WikiName);
                    }
                }
            }
        }