From 9b1e2d1d4b91d8f2f00b4f42bcf81f83b5cbe872 Mon Sep 17 00:00:00 2001 From: xkeyC <3334969096@qq.com> Date: Sat, 17 Feb 2024 00:48:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=94=AE=E5=90=AF=E5=8A=A8=EF=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=97=AA=E9=80=80=E8=AF=8A=E6=96=AD=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/home/home_ui_model.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/ui/home/home_ui_model.dart b/lib/ui/home/home_ui_model.dart index 7b97e6f..060fda4 100644 --- a/lib/ui/home/home_ui_model.dart +++ b/lib/ui/home/home_ui_model.dart @@ -389,9 +389,23 @@ class HomeUIModel extends BaseUIModel { dPrint('Exit code: ${result.exitCode}'); dPrint('stdout: ${result.stdout}'); dPrint('stderr: ${result.stderr}'); + if (result.exitCode != 0) { + final logs = await SCLoggerHelper.getGameRunningLogs(scInstalledPath); + MapEntry? exitInfo; + bool hasUrl = false; + if (logs != null) { + exitInfo = SCLoggerHelper.getGameRunningLogInfo(logs); + if (exitInfo!.value.startsWith("https://")) { + hasUrl = true; + } + } showToast(context!, - "游戏非正常退出\nexitCode=${result.exitCode}\nstdout=${result.stdout}\nstderr=${result.stderr}\n\n诊断信息:"); + "游戏非正常退出\nexitCode=${result.exitCode}\nstdout=${result.stdout ?? ""}\nstderr=${result.stderr ?? ""}\n\n诊断信息:${exitInfo == null ? "未知错误,请通过一键诊断加群反馈。" : exitInfo.key} \n${hasUrl ? "请查看弹出的网页链接获得详细信息。" : exitInfo?.value ?? ""}"); + if (hasUrl) { + await Future.delayed(const Duration(seconds: 3)); + launchUrlString(exitInfo!.value); + } } final launchFile = File("$installPath\\loginData.json");