Files
better-genshin-impact/BetterGenshinImpact/GameTask/TaskProgress/TaskProgress.cs
mfkvfhpdx 468a54e037 执行调度器任务增加继续执行功能 (#1658)
* 完全跳过的配置组,不发送通知。给周期配置增加说明。

* 启动参数增加 --no-single ,允许多开,实现特殊需求(重启需要)。增加了一个重启bgi的方法。增加了任务进度的功能,执行调度器任务时,会记录当前任务执行位置,当关闭后(比如F11),下次可以通过继续菜单,选择记录,从上次关闭任务处执行。

* 调整继续执行,最后一次成功的下一个任务执行

* 设置,其他设置,增加了调度器任务,遇到异常时,连续累计一定次数时,重启BGI,和可配置的重启游戏。

* 连续任务支持循环,右键支持从连续的某一个任务开始执行。修改了一些配置变量的写法,使之不会保存到json文件中。
2025-06-02 00:03:26 +08:00

72 lines
2.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using BetterGenshinImpact.Service;
using CommunityToolkit.Mvvm.ComponentModel;
namespace BetterGenshinImpact.GameTask.TaskProgress;
public partial class TaskProgress : ObservableObject
{
[ObservableProperty] private List<string> _scriptGroupNames = new();
[ObservableProperty] private string? _lastScriptGroupName;
[ObservableProperty] private ScriptGroupProjectInfo? _lastSuccessScriptGroupProjectInfo;
[ObservableProperty] private string? _currentScriptGroupName;
[ObservableProperty] private ScriptGroupProjectInfo? _currentScriptGroupProjectInfo;
[ObservableProperty] private string _name = DateTime.Now.ToString("yyyyMMddHHmmss");
[ObservableProperty] private DateTime _startTime = DateTime.Now;
[ObservableProperty] private DateTime? _endTime = null;
[ObservableProperty] private List<ScriptGroupProjectInfo>? _history = new();
[ObservableProperty] private bool _loop = false;
//记录完成了几圈
[ObservableProperty] private int _loopCount = 0;
private int _consecutiveFailureCount = 0;
private Progress? _next;
/// <summary>
/// 连续失败次数
/// </summary>
[JsonIgnore]
public int ConsecutiveFailureCount
{
get => _consecutiveFailureCount;
set => SetProperty(ref _consecutiveFailureCount, value);
}
/// <summary>
/// 进度信息如果next不为空则从next执行
/// </summary>
[JsonIgnore]
public Progress? Next
{
get => _next;
set => SetProperty(ref _next, value);
}
public partial class Progress : ObservableObject
{
[ObservableProperty] private string _groupName = string.Empty;
[ObservableProperty] private int _index = 0;
[ObservableProperty] private string _projectName = string.Empty;
[ObservableProperty] private string _folderName = string.Empty;
}
public partial class ScriptGroupProjectInfo : ObservableObject
{
[ObservableProperty] private string _groupName = string.Empty;
[ObservableProperty] private bool _taskEnd = false;
[ObservableProperty] private int _index = 0;
[ObservableProperty] private string _name = string.Empty;
[ObservableProperty] private string _folderName = string.Empty;
[ObservableProperty] private DateTime _startTime = DateTime.Now;
[ObservableProperty] private DateTime? _endTime = null;
//状态 1 成功 2 失败
[ObservableProperty] private int _status = 1;
}
public string ToJson()
{
return JsonSerializer.Serialize(this, ConfigService.JsonOptions);
}
}