diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/PluginLoader.cs | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index ab4e217..a39f787 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs | |||
@@ -342,20 +342,45 @@ namespace OpenSim.Framework | |||
342 | } | 342 | } |
343 | 343 | ||
344 | /// <summary> | 344 | /// <summary> |
345 | /// Filters out which plugin to load based on its "Provider", which is name given by in the addin.xml | 345 | /// Filters out which plugin to load based on its the plugin name or names given. Plugin names are contained in |
346 | /// their addin.xml | ||
346 | /// </summary> | 347 | /// </summary> |
347 | public class PluginProviderFilter : IPluginFilter | 348 | public class PluginProviderFilter : IPluginFilter |
348 | { | 349 | { |
349 | private string provider; | 350 | private string[] m_filters; |
350 | 351 | ||
351 | public PluginProviderFilter (string p) | 352 | /// <summary> |
353 | /// Constructor. | ||
354 | /// </summary> | ||
355 | /// <param name="p"> | ||
356 | /// Plugin name or names on which to filter. Multiple names should be separated by commas. | ||
357 | /// </param> | ||
358 | public PluginProviderFilter(string p) | ||
352 | { | 359 | { |
353 | provider = p; | 360 | m_filters = p.Split(','); |
361 | |||
362 | for (int i = 0; i < m_filters.Length; i++) | ||
363 | { | ||
364 | m_filters[i] = m_filters[i].Trim(); | ||
365 | } | ||
354 | } | 366 | } |
355 | 367 | ||
368 | /// <summary> | ||
369 | /// Apply this filter to the given plugin. | ||
370 | /// </summary> | ||
371 | /// <param name="plugin"></param> | ||
372 | /// <returns>true if the plugin's name matched one of the filters, false otherwise.</returns> | ||
356 | public bool Apply (PluginExtensionNode plugin) | 373 | public bool Apply (PluginExtensionNode plugin) |
357 | { | 374 | { |
358 | return (plugin.Provider == provider); | 375 | for (int i = 0; i < m_filters.Length; i++) |
376 | { | ||
377 | if (m_filters[i] == plugin.Provider) | ||
378 | { | ||
379 | return true; | ||
380 | } | ||
381 | } | ||
382 | |||
383 | return false; | ||
359 | } | 384 | } |
360 | } | 385 | } |
361 | } | 386 | } |