Files
mixtape/zero.Core/Options/ModuleOptions.cs
T

49 lines
1.2 KiB
C#
Raw Normal View History

2020-08-19 11:22:45 +02:00
using System;
using System.Collections.Generic;
using zero.Core.Entities;
namespace zero.Core.Options
{
public class ModuleOptions : ZeroBackofficeCollection<ModuleType>, IZeroCollectionOptions
{
public ModuleOptions()
{
}
public void Add<T>(ModuleType<T> moduleType) where T : Module, new()
{
Items.Add(ModuleType.Convert(moduleType));
}
public void Add<T>(string alias, string name, string description, string icon, string group = null, List<string> disallowedPageTypes = null) where T : Module, new()
{
Items.Add(new ModuleType(typeof(T))
{
Alias = alias,
Name = name,
Description = description,
Icon = icon,
Group = group,
DisallowedPageTypes = disallowedPageTypes ?? new List<string>()
});
}
public void Add(Type type, string alias, string name, string description, string icon, string group = null, List<string> disallowedPageTypes = null)
{
Items.Add(new ModuleType(type)
{
Alias = alias,
Name = name,
Description = description,
Icon = icon,
Group = group,
DisallowedPageTypes = disallowedPageTypes ?? new List<string>()
});
}
}
}