feat: check RSI Launcher running

This commit is contained in:
xkeyC 2024-05-01 14:30:47 +08:00
parent f6907f233a
commit 6019cc96fd
2 changed files with 18 additions and 0 deletions

View File

@ -61,6 +61,15 @@ class RsiLauncherEnhanceDialogUI extends HookConsumerWidget {
}
void doInstall() async {
if ((await SystemHelper.getPID("\"RSI Launcher\"")).isNotEmpty) {
if (!context.mounted) return;
showToast(
context, S.current.tools_action_info_rsi_launcher_running_warning,
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * .35));
return;
}
if (!context.mounted) return;
workingText.value = "生成补丁 ...";
final newScript =
await _genNewScript(assarState).unwrap(context: context);

View File

@ -594,6 +594,15 @@ class ToolsUIModel extends _$ToolsUIModel {
}
_rsiEnhance(BuildContext context) async {
if ((await SystemHelper.getPID("\"RSI Launcher\"")).isNotEmpty) {
if (!context.mounted) return;
showToast(
context, S.current.tools_action_info_rsi_launcher_running_warning,
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * .35));
return;
}
if (!context.mounted) return;
showDialog(
context: context,
builder: (BuildContext context) => const RsiLauncherEnhanceDialogUI());