mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-27 12:46:53 +08:00
add issues templates
This commit is contained in:
@@ -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>
|
||||
|
||||
+34
-12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user