47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System.Configuration;
|
|
|
|
namespace DTS.Common.Core.PluginLib
|
|
{
|
|
/// <summary>
|
|
/// Support class that parses data from DTS.Common.Core.PluginLib.Config configuration section
|
|
/// </summary>
|
|
public class PluginConfigSectionHandler : ConfigurationSection
|
|
{
|
|
[ConfigurationProperty("PluginFolders")]
|
|
public FilterHashKeyCollection HashKeys => (FilterHashKeyCollection)base["PluginFolders"];
|
|
}
|
|
|
|
[ConfigurationCollection(typeof(FilterHashElement))]
|
|
public class FilterHashKeyCollection : ConfigurationElementCollection
|
|
{
|
|
protected override ConfigurationElement CreateNewElement()
|
|
{
|
|
return new FilterHashElement();
|
|
}
|
|
|
|
protected override object GetElementKey(ConfigurationElement element)
|
|
{
|
|
return ((FilterHashElement)element).Key;
|
|
}
|
|
|
|
public FilterHashElement this[int idx] => (FilterHashElement)BaseGet(idx);
|
|
}
|
|
|
|
public class FilterHashElement : ConfigurationElement
|
|
{
|
|
[ConfigurationProperty("key", DefaultValue = "", IsKey = true, IsRequired = true)]
|
|
public string Key
|
|
{
|
|
get => (string)base["key"];
|
|
set => base["key"] = value;
|
|
}
|
|
|
|
[ConfigurationProperty("value", DefaultValue = "", IsKey = false, IsRequired = false)]
|
|
public string Value
|
|
{
|
|
get => (string)base["value"];
|
|
set => base["value"] = value;
|
|
}
|
|
}
|
|
}
|