27 lines
754 B
C#
27 lines
754 B
C#
using ModpackUpdater.Apps.Manager.Api.Model;
|
|
using Pilz.Plugins.Advanced;
|
|
|
|
namespace ModpackUpdater.Apps.Manager.Api.Plugins.Features;
|
|
|
|
public abstract class WorkspaceFeature(string identifier, string name) : PluginFeature(FeatureTypes.Workspace, identifier, name)
|
|
{
|
|
public virtual bool CanConfigure(IWorkspace workspace)
|
|
{
|
|
return workspace?.Config == null || workspace.Config.ProviderId == Identifier;
|
|
}
|
|
|
|
public virtual bool Configure(ref IWorkspace workspace)
|
|
{
|
|
OnConfigure(ref workspace);
|
|
|
|
if (workspace?.Config == null)
|
|
return false;
|
|
|
|
workspace.Config.ProviderId = Identifier;
|
|
|
|
return true;
|
|
}
|
|
|
|
protected abstract bool OnConfigure(ref IWorkspace workspace);
|
|
}
|