rename Pilz.Plugins.Advanced to Pilz.Features
This commit is contained in:
34
Pilz.Features/Extensions.cs
Normal file
34
Pilz.Features/Extensions.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace Pilz.Features;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
public static T? ExecuteIfEnabled<T>(this PluginFunction @this, params object?[]? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute<T>(@params) : default;
|
||||
}
|
||||
|
||||
public static object? ExecuteIfEnabled(this PluginFunction @this, params object?[]? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute(@params) : default;
|
||||
}
|
||||
|
||||
public static T? ExecuteIfEnabled<T>(this PluginFunction @this, PluginFunctionSimpleParamter? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute<T>(@params) : default;
|
||||
}
|
||||
|
||||
public static object? ExecuteIfEnabled(this PluginFunction @this, PluginFunctionParameter? @params)
|
||||
{
|
||||
return @this.Enabled ? @this.Execute(@params) : default;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> Enabled<T>(this IEnumerable<T> @this) where T : PluginFeature
|
||||
{
|
||||
return @this.Where(n => n.Enabled);
|
||||
}
|
||||
|
||||
public static IEnumerable<T> Ordered<T>(this IEnumerable<T> @this) where T : PluginFeature
|
||||
{
|
||||
return @this.OrderByDescending(n => n.Prioritization);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user