add issues templates

This commit is contained in:
Aigio Liu
2021-03-07 09:25:13 +08:00
parent 8a22641d2c
commit c5a0864d99
6 changed files with 129 additions and 12 deletions
@@ -74,6 +74,15 @@ namespace System.Application.Properties {
}
}
/// <summary>
/// 查找类似 找不到 Steam 安装路径 的本地化字符串。
/// </summary>
internal static string SteamInstallPathNotFound {
get {
return ResourceManager.GetString("SteamInstallPathNotFound", resourceCulture);
}
}
/// <summary>
/// 查找类似 更新包解压失败,请打开官网手动更新 的本地化字符串。
/// </summary>
@@ -126,6 +126,9 @@ rmdir /s /q "{1}"
del %0</value>
<comment>升级程序CMD命令行</comment>
</data>
<data name="SteamInstallPathNotFound" xml:space="preserve">
<value>找不到 Steam 安装路径</value>
</data>
<data name="UpdateUnpackFail" xml:space="preserve">
<value>更新包解压失败,请打开官网手动更新</value>
</data>
@@ -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
/// </item>
/// </list>
/// </summary>
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