draft:执行shell抽成task,并支持配置 (#1306)

* Shell抽象成为一个Task,并抽出Config

* 代码格式化

* 格式化代码
This commit is contained in:
Takaranoao
2025-03-15 20:09:59 +08:00
committed by GitHub
parent 6eb1d33965
commit 981068b38c
6 changed files with 214 additions and 130 deletions

View File

@@ -0,0 +1,27 @@
using BetterGenshinImpact.Core.Config;
using BetterGenshinImpact.GameTask.Model;
namespace BetterGenshinImpact.GameTask.Shell;
public class ShellTaskParam : BaseTaskParam
{
private ShellTaskParam(string command, int configTimeoutSeconds, bool configNoWindow, bool configOutput, bool configDisable)
{
Command = command;
TimeoutSeconds = configTimeoutSeconds;
NoWindow = configNoWindow;
Output = configOutput;
Disable = configDisable;
}
public readonly bool Disable;
public readonly string Command;
public readonly int TimeoutSeconds;
public readonly bool NoWindow;
public readonly bool Output;
public static ShellTaskParam BuildFromConfig(string command, ShellConfig config)
{
return new ShellTaskParam(command, config.Timeout, config.NoWindow, config.Output, config.Disable);
}
}