add feature identifier

This commit is contained in:
2023-12-14 07:55:59 +01:00
parent e1618da170
commit 6e6eb6b8f6
5 changed files with 63 additions and 13 deletions

View File

@@ -4,6 +4,8 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Telerik.Pdf;
using Telerik.WinControls;
namespace Pilz.Plugins.Advanced
{
@@ -79,14 +81,24 @@ namespace Pilz.Plugins.Advanced
return controller.features.AsReadOnly();
}
public virtual IEnumerable<PluginFeature> Get(string moduleType)
public virtual IEnumerable<PluginFeature> Get(string featureType)
{
return controller.features.Where(n => n.Type == moduleType);
return controller.features.Where(n => n.Type == featureType);
}
public virtual PluginFeature? GetFirst(string moduleType)
public virtual PluginFeature? GetFirst(string featureType)
{
return controller.features.FirstOrDefault(n => n.Type == moduleType);
return controller.features.FirstOrDefault(n => n.Type == featureType);
}
public virtual PluginFeature? GetByIdentifier(string fullIdentifier)
{
return controller.features.FirstOrDefault(n => n.FullIdentifier == fullIdentifier);
}
public virtual PluginFeature? GetByIdentifier(string featureType, string identifier)
{
return controller.features.FirstOrDefault(n => n.Type == featureType && n.Identifier == identifier);
}
}
@@ -108,7 +120,17 @@ namespace Pilz.Plugins.Advanced
public override T? GetFirst(string moduleType)
{
return GetAll().FirstOrDefault(n => n.Type == moduleType);
return base.GetFirst(moduleType) as T;
}
public override T? GetByIdentifier(string fullIdentifier)
{
return base.GetByIdentifier(fullIdentifier) as T;
}
public override T? GetByIdentifier(string featureType, string identifier)
{
return base.GetByIdentifier(featureType, identifier) as T;
}
}