diff options
Diffstat (limited to 'OpenSim/Framework/PluginLoader.cs')
-rw-r--r-- | OpenSim/Framework/PluginLoader.cs | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index 15e0b9f..b586fe3 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs | |||
@@ -278,6 +278,9 @@ namespace OpenSim.Framework | |||
278 | public class PluginExtensionNode : ExtensionNode | 278 | public class PluginExtensionNode : ExtensionNode |
279 | { | 279 | { |
280 | [NodeAttribute] | 280 | [NodeAttribute] |
281 | string id = ""; | ||
282 | |||
283 | [NodeAttribute] | ||
281 | string provider = ""; | 284 | string provider = ""; |
282 | 285 | ||
283 | [NodeAttribute] | 286 | [NodeAttribute] |
@@ -285,6 +288,7 @@ namespace OpenSim.Framework | |||
285 | 288 | ||
286 | Type typeobj; | 289 | Type typeobj; |
287 | 290 | ||
291 | public string ID { get { return id; } } | ||
288 | public string Provider { get { return provider; } } | 292 | public string Provider { get { return provider; } } |
289 | public string TypeName { get { return type; } } | 293 | public string TypeName { get { return type; } } |
290 | 294 | ||
@@ -349,7 +353,7 @@ namespace OpenSim.Framework | |||
349 | } | 353 | } |
350 | 354 | ||
351 | /// <summary> | 355 | /// <summary> |
352 | /// Filters out which plugin to load based on its the plugin name or names given. Plugin names are contained in | 356 | /// Filters out which plugin to load based on the plugin name or names given. Plugin names are contained in |
353 | /// their addin.xml | 357 | /// their addin.xml |
354 | /// </summary> | 358 | /// </summary> |
355 | public class PluginProviderFilter : IPluginFilter | 359 | public class PluginProviderFilter : IPluginFilter |
@@ -390,4 +394,46 @@ namespace OpenSim.Framework | |||
390 | return false; | 394 | return false; |
391 | } | 395 | } |
392 | } | 396 | } |
397 | |||
398 | /// <summary> | ||
399 | /// Filters plugins according to their ID. Plugin IDs are contained in their addin.xml | ||
400 | /// </summary> | ||
401 | public class PluginIdFilter : IPluginFilter | ||
402 | { | ||
403 | private string[] m_filters; | ||
404 | |||
405 | /// <summary> | ||
406 | /// Constructor. | ||
407 | /// </summary> | ||
408 | /// <param name="p"> | ||
409 | /// Plugin ID or IDs on which to filter. Multiple names should be separated by commas. | ||
410 | /// </param> | ||
411 | public PluginIdFilter(string p) | ||
412 | { | ||
413 | m_filters = p.Split(','); | ||
414 | |||
415 | for (int i = 0; i < m_filters.Length; i++) | ||
416 | { | ||
417 | m_filters[i] = m_filters[i].Trim(); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | /// <summary> | ||
422 | /// Apply this filter to <paramref name="plugin" />. | ||
423 | /// </summary> | ||
424 | /// <param name="plugin">PluginExtensionNode instance to check whether it passes the filter.</param> | ||
425 | /// <returns>true if the plugin's ID matches one of the filters, false otherwise.</returns> | ||
426 | public bool Apply (PluginExtensionNode plugin) | ||
427 | { | ||
428 | for (int i = 0; i < m_filters.Length; i++) | ||
429 | { | ||
430 | if (m_filters[i] == plugin.ID) | ||
431 | { | ||
432 | return true; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | return false; | ||
437 | } | ||
438 | } | ||
393 | } | 439 | } |