2021-11-19 14:59:24 +01:00
|
|
|
using zero.Core.Entities;
|
|
|
|
|
|
2021-11-20 13:52:28 +01:00
|
|
|
namespace zero.Configuration;
|
2021-11-19 14:59:24 +01:00
|
|
|
|
|
|
|
|
public class SectionOptions : OptionsEnumerable<ISection>, IOptionsEnumerable
|
|
|
|
|
{
|
|
|
|
|
public SectionOptions()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Add<T>(int index = -1) where T : ISection, new()
|
|
|
|
|
{
|
|
|
|
|
if (index > -1 && index < Items.Count)
|
|
|
|
|
{
|
|
|
|
|
Items.Insert(index, new T());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Items.Add(new T());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Add(string alias, string name, string icon)
|
|
|
|
|
{
|
|
|
|
|
Items.Add(new Section(alias, name, icon));
|
|
|
|
|
}
|
|
|
|
|
}
|