diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 000000000..37e458c21 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,37 @@ +--- +name: Bug Report 🐛 +about: 创建 Bug 报告以帮助我们改进 / Create a report to help us improve +title: "🐛[BUG] " +labels: bug +assignees: '' + +--- + +### 🐛 描述(Description) + + + +### 📷 复现步骤(Steps to Reproduce) + + +1. +2. +3. + +### 📄 [异常/日志]信息([Exception/Log] Information) + +### 🚑 基本信息(Basic Information) + +- 有问题的版本(Version with issue): +- 程序版本(Program Version): +- 系统版本号(OS Version): + +### 🖼 截图(Screenshots) + + diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 000000000..c76f57e1e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,26 @@ +--- +name: Feature request +about: 对程序的需求或建议 / Suggest an idea for program +title: "👑[Enhancement] " +labels: enhancement +assignees: '' + +--- + +### 🥰 需求描述(Description) + + + +### 🧐 解决方案(Solution) + + + +### 🚑 其他信息(Other Information) + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 000000000..116d925bc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,20 @@ +--- +name: question +about: 对程序使用的疑问或需要帮助 / Questions about the use of the program or need help +title: "🧐[Question] " +labels: question +assignees: '' + +--- + +### 🧐 问题描述(Description) + + + +### 🚑 其他信息(Other Information) + + \ No newline at end of file diff --git a/System.Application.SteamTools.Client.Desktop/Properties/SR.Designer.cs b/System.Application.SteamTools.Client.Desktop/Properties/SR.Designer.cs index 6f612b1b4..17505ab1c 100644 --- a/System.Application.SteamTools.Client.Desktop/Properties/SR.Designer.cs +++ b/System.Application.SteamTools.Client.Desktop/Properties/SR.Designer.cs @@ -74,6 +74,15 @@ namespace System.Application.Properties { } } + /// + /// 查找类似 找不到 Steam 安装路径 的本地化字符串。 + /// + internal static string SteamInstallPathNotFound { + get { + return ResourceManager.GetString("SteamInstallPathNotFound", resourceCulture); + } + } + /// /// 查找类似 更新包解压失败,请打开官网手动更新 的本地化字符串。 /// diff --git a/System.Application.SteamTools.Client.Desktop/Properties/SR.resx b/System.Application.SteamTools.Client.Desktop/Properties/SR.resx index c9e16a1e2..0fc80206d 100644 --- a/System.Application.SteamTools.Client.Desktop/Properties/SR.resx +++ b/System.Application.SteamTools.Client.Desktop/Properties/SR.resx @@ -126,6 +126,9 @@ rmdir /s /q "{1}" del %0 升级程序CMD命令行 + + 找不到 Steam 安装路径 + 更新包解压失败,请打开官网手动更新 diff --git a/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs b/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs index 648946117..ca6f4405b 100644 --- a/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs +++ b/System.Application.SteamTools.Client.Desktop/Services/Implementation/SteamServiceImpl.cs @@ -1,4 +1,5 @@ using System.Application.Models; +using System.Application.Properties; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -24,19 +25,22 @@ namespace System.Application.Services.Implementation /// /// /// - readonly string UserVdfPath; + readonly string? UserVdfPath; const string UserDataDirectory = "userdata"; readonly IDesktopPlatformService platformService; readonly string? mSteamDirPath; readonly string? mSteamProgramPath; + readonly IToast toast; readonly string[] steamProcess = new[] { "steam", "steamservice", "steamwebhelper" }; - public SteamServiceImpl(IDesktopPlatformService platformService) + public SteamServiceImpl(IDesktopPlatformService platformService, IToast toast) { + this.toast = toast; this.platformService = platformService; mSteamDirPath = platformService.GetSteamDirPath(); mSteamProgramPath = platformService.GetSteamProgramPath(); - UserVdfPath = Path.Combine(SteamDirPath, "config", "loginusers.vdf"); + UserVdfPath = SteamDirPath == null ? null : Path.Combine(SteamDirPath, "config", "loginusers.vdf"); + if (!File.Exists(UserVdfPath)) UserVdfPath = null; } public string? SteamDirPath => mSteamDirPath; @@ -88,6 +92,10 @@ namespace System.Application.Services.Implementation { Process.Start(SteamProgramPath, arguments); } + else + { + toast.Show(SR.SteamInstallPathNotFound); + } } public string GetLastLoginUserName() => platformService.GetLastSteamLoginUserName(); @@ -203,21 +211,35 @@ namespace System.Application.Services.Implementation public void DeleteLocalUserData(SteamUser user) { - VdfHelper.DeleteValueByKey(UserVdfPath, user.SteamId64.ToString()); - var temp = Path.Combine(SteamDirPath, UserDataDirectory, user.SteamId3_Int.ToString()); - if (Directory.Exists(temp)) + if (string.IsNullOrWhiteSpace(UserVdfPath) || string.IsNullOrWhiteSpace(SteamDirPath)) { - Directory.Delete(temp, true); + toast.Show(SR.SteamInstallPathNotFound); + } + else + { + VdfHelper.DeleteValueByKey(UserVdfPath, user.SteamId64.ToString()); + var temp = Path.Combine(SteamDirPath, UserDataDirectory, user.SteamId3_Int.ToString()); + if (Directory.Exists(temp)) + { + Directory.Delete(temp, true); + } } } public void UpdateLocalUserData(SteamUser user) { - var originVdfStr = user.OriginVdfString; - VdfHelper.UpdateValueByReplace( - UserVdfPath, - originVdfStr.ThrowIsNull(nameof(originVdfStr)), - user.CurrentVdfString); + if (string.IsNullOrWhiteSpace(UserVdfPath)) + { + toast.Show(SR.SteamInstallPathNotFound); + } + else + { + var originVdfStr = user.OriginVdfString; + VdfHelper.UpdateValueByReplace( + UserVdfPath, + originVdfStr.ThrowIsNull(nameof(originVdfStr)), + user.CurrentVdfString); + } } #if DEBUG