mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-27 04:41:15 +08:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deee8d056f | ||
|
|
3016469c7f | ||
|
|
526fb7a78d | ||
|
|
2790ffc5f1 | ||
|
|
e22897e2ae | ||
|
|
00b8c4dfcf | ||
|
|
9a2d2c6c94 | ||
|
|
29fb43fc38 | ||
|
|
4ca3066644 | ||
|
|
890f2fab37 | ||
|
|
f561f841e3 | ||
|
|
a016631d68 | ||
|
|
367c97b480 | ||
|
|
6367bc5ed1 | ||
|
|
2b69b98f3c | ||
|
|
a6010ba5f4 |
@@ -21,7 +21,7 @@ public static partial class AssemblyInfo
|
||||
/// <summary>
|
||||
/// RC 版本号,范围 0~9,只增不减
|
||||
/// </summary>
|
||||
const string ver_for_rc = "4";
|
||||
const string ver_for_rc = "5";
|
||||
|
||||
public const string FileVersion = $"{Version2}.{ver_for_rc}0{ver_for_preview}.0";
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
<string>NSApplication</string>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>AppIcon.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.steampp.app</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
||||
@@ -44,9 +44,9 @@ public sealed partial class App : Application
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
#if WINDOWS || LINUX || MACOS
|
||||
//非主窗口不执行启动时最小化逻辑
|
||||
if (GeneralSettings.MinimizeOnStartup.Value && MainWindow is MainWindow)
|
||||
if (GeneralSettings.MinimizeOnStartup.Value)
|
||||
Startup.Instance.IsMinimize = true;
|
||||
|
||||
if (Startup.Instance.IsSteamRun)
|
||||
{
|
||||
try
|
||||
@@ -94,9 +94,10 @@ public sealed partial class App : Application
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
MainWindow = InitializeMainWindow?.Invoke(this) ?? new MainWindow();
|
||||
|
||||
desktop.MainWindow =
|
||||
#if !UI_DEMO
|
||||
Startup.Instance.IsMinimize ? null :
|
||||
Startup.Instance.IsMinimize && MainWindow is MainWindow ? null :
|
||||
#endif
|
||||
MainWindow;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<spp:Image2
|
||||
Width="{Binding $parent[UserControl].Bounds.Width}"
|
||||
Height="{Binding $parent[UserControl].Bounds.Height}"
|
||||
EnableCancelToken="False"
|
||||
Source="{Binding ImageUrl}"
|
||||
Stretch="UniformToFill" />
|
||||
</Button>
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
</Border>
|
||||
</spp:AppItem.Status>
|
||||
<spp:AppItem.Image>
|
||||
<spp:Image2 Source="{Binding ImageUrl}" />
|
||||
<spp:Image2 EnableCancelToken="False" Source="{Binding ImageUrl}" />
|
||||
</spp:AppItem.Image>
|
||||
</spp:AppItem>
|
||||
</DataTemplate>
|
||||
@@ -295,7 +295,10 @@
|
||||
</MultiBinding>
|
||||
</spp:AppItem.ClickCommandParameter>
|
||||
<spp:AppItem.Image>
|
||||
<spp:Image2 RenderOptions.BitmapInterpolationMode="HighQuality" Source="{Binding Image}" />
|
||||
<spp:Image2
|
||||
EnableCancelToken="False"
|
||||
RenderOptions.BitmapInterpolationMode="HighQuality"
|
||||
Source="{Binding Image}" />
|
||||
</spp:AppItem.Image>
|
||||
<spp:AppItem.Status>
|
||||
<Border Classes="Status">
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
Command="{Binding $parent[spp:Settings_Plugin].((spp:SettingsPageViewModel)DataContext).DeletePlugin_Click}"
|
||||
CommandParameter="{Binding Data}"
|
||||
Content="{Binding Path=Res.Plugin_Delete, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
|
||||
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
|
||||
IsClickEnabled="True" />
|
||||
</ui:SettingsExpander>
|
||||
</DataTemplate>
|
||||
|
||||
@@ -93,6 +93,9 @@ public interface IPCSubProcessService : IDisposable
|
||||
var nativeLibraryPath = Environment.GetEnvironmentVariable(EnvKey_NativeLibraryPath);
|
||||
if (!string.IsNullOrWhiteSpace(nativeLibraryPath))
|
||||
{
|
||||
var nativeLibraryPaths = nativeLibraryPath.Split(';',
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// 监听当前应用程序域的程序集加载
|
||||
AppDomain.CurrentDomain.AssemblyLoad += (_, args)
|
||||
=> CurrentDomain_AssemblyLoad(args.LoadedAssembly);
|
||||
@@ -119,23 +122,34 @@ public interface IPCSubProcessService : IDisposable
|
||||
return libraryName;
|
||||
}
|
||||
var libraryFileName = GetLibraryFileName(libraryName);
|
||||
var libraryPath = Path.Combine(nativeLibraryPath, libraryFileName);
|
||||
if (File.Exists(libraryPath) &&
|
||||
NativeLibrary.TryLoad(libraryPath, out var handle))
|
||||
string libraryPath = libraryName;
|
||||
try
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
else if (!OperatingSystem.IsWindows() && !libraryFileName.StartsWith("lib", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
libraryFileName = $"lib{libraryFileName}";
|
||||
libraryPath = Path.Combine(nativeLibraryPath, libraryFileName);
|
||||
if (File.Exists(libraryPath) &&
|
||||
NativeLibrary.TryLoad(libraryPath, out handle))
|
||||
foreach (var nativeLibraryPath in nativeLibraryPaths)
|
||||
{
|
||||
return handle;
|
||||
libraryPath = Path.Combine(nativeLibraryPath, libraryFileName);
|
||||
if (File.Exists(libraryPath) &&
|
||||
NativeLibrary.TryLoad(libraryPath, out var handle))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
else if (!OperatingSystem.IsWindows() && !libraryFileName.StartsWith("lib", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
libraryFileName = $"lib{libraryFileName}";
|
||||
libraryPath = Path.Combine(nativeLibraryPath, libraryFileName);
|
||||
if (File.Exists(libraryPath) &&
|
||||
NativeLibrary.TryLoad(libraryPath, out handle))
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NativeLibrary.Load(libraryName, assembly, searchPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new FileNotFoundException(null, libraryPath, ex);
|
||||
}
|
||||
return NativeLibrary.Load(libraryName, assembly, searchPath);
|
||||
}
|
||||
NativeLibrary.SetDllImportResolver(loadedAssembly, Delegate);
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ static class WinDivertInitHelper
|
||||
//case Architecture.X86:
|
||||
case Architecture.X64:
|
||||
IsSupported = true;
|
||||
libraryDirPath = Path.Combine(AppContext.BaseDirectory, "native", "win-x64");
|
||||
libraryPath = Path.Combine(libraryDirPath, "WinDivert.dll");
|
||||
libraryPath = GlobalDllImportResolver.GetLibraryPath("WinDivert.dll");
|
||||
libraryDirPath = Path.GetDirectoryName(libraryPath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,10 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
|
||||
if (jsSaveInfo.Exists)
|
||||
{
|
||||
if (isNoRepeat)
|
||||
{
|
||||
jsSaveInfo.Delete();
|
||||
fileInfo.CopyTo(jsSavePath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using AppResources = BD.WTTS.Client.Resources.Strings;
|
||||
|
||||
namespace BD.WTTS;
|
||||
@@ -81,7 +82,7 @@ public static partial class PathHelper
|
||||
? IOPath.ExpandEnvironmentVariables(Path.Combine(fromPath, wildcard), folderPath)
|
||||
: Path.Combine(localCachePath, fromPath, wildcard);
|
||||
toPath = toPath.Replace(wildcard, "");
|
||||
toFullPath = toPath;
|
||||
toFullPath = IOPath.ExpandEnvironmentVariables(toPath);
|
||||
}
|
||||
|
||||
var platformService = IPlatformService.Instance;
|
||||
@@ -95,9 +96,9 @@ public static partial class PathHelper
|
||||
// Handle "...\\*" folder.
|
||||
if (file == "*")
|
||||
{
|
||||
if (!Directory.Exists(Path.GetDirectoryName(fromPath)))
|
||||
if (!Directory.Exists(folder))
|
||||
return false;
|
||||
if (platformService.CopyFilesRecursive(Path.GetDirectoryName(fromPath), toFullPath))
|
||||
if (platformService.CopyFilesRecursive(folder, toFullPath))
|
||||
return true;
|
||||
|
||||
Toast.Show(ToastIcon.Error, AppResources.Error_CopyFileFailed);
|
||||
|
||||
@@ -103,8 +103,8 @@
|
||||
"ClearPaths": [ "SAME_AS_LOGIN_FILES" ],
|
||||
"LoginFiles": {
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Data\\Cookies\\": "Cookies",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Data": "RiotClientPrivateSettings.yaml",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Config": "RiotClientSettings.yaml",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Data\\RiotGamesPrivateSettings.yaml": "RiotGamesPrivateSettings.yaml",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\Config\\RiotClientSettings.yaml": "RiotClientSettings.yaml",
|
||||
"%LocalAppData%\\Riot Games\\Riot Client\\WattToolkit.id": "WattToolkit.id"
|
||||
},
|
||||
"UniqueIdPath": "%LocalAppData%\\Riot Games\\Riot Client\\WattToolkit.id",
|
||||
|
||||
+46
-38
@@ -20,52 +20,60 @@ public sealed partial class IdleSteamLoginPageViewModel : WindowViewModel
|
||||
|
||||
private async void SteamLoginAsync()
|
||||
{
|
||||
if (!IsLoading)
|
||||
try
|
||||
{
|
||||
IsLoading = true;
|
||||
|
||||
if (SteamLoginState.SteamId == 0)
|
||||
if (!IsLoading)
|
||||
{
|
||||
SteamLoginState.Username = UserNameText;
|
||||
SteamLoginState.Password = PasswordText;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.TwofactorCode ??= string.Empty;
|
||||
IsLoading = true;
|
||||
|
||||
if (SteamLoginState.Requires2FA)
|
||||
if (SteamLoginState.SteamId == 0)
|
||||
{
|
||||
SteamLoginState.TwofactorCode = this.TwofactorCode;
|
||||
SteamLoginState.Username = UserNameText;
|
||||
SteamLoginState.Password = PasswordText;
|
||||
}
|
||||
else if (SteamLoginState.RequiresEmailAuth)
|
||||
else
|
||||
{
|
||||
SteamLoginState.EmailCode = this.TwofactorCode;
|
||||
this.TwofactorCode ??= string.Empty;
|
||||
|
||||
if (SteamLoginState.Requires2FA)
|
||||
{
|
||||
SteamLoginState.TwofactorCode = this.TwofactorCode;
|
||||
}
|
||||
else if (SteamLoginState.RequiresEmailAuth)
|
||||
{
|
||||
SteamLoginState.EmailCode = this.TwofactorCode;
|
||||
}
|
||||
}
|
||||
|
||||
await Account.DoLoginV2Async(SteamLoginState);
|
||||
|
||||
Requires2FA = SteamLoginState.Requires2FA;
|
||||
RequiresEmailAuth = SteamLoginState.RequiresEmailAuth;
|
||||
|
||||
if (SteamLoginState.Success)
|
||||
{
|
||||
if (RemenberLogin)
|
||||
{
|
||||
var session = SteamSession.RentSession(SteamLoginState.SteamId.ToString());
|
||||
|
||||
if (session != null)
|
||||
await SteamSession.SaveSession(session);
|
||||
}
|
||||
Toast.Show(ToastIcon.Success, Strings.Success_.Format(Strings.User_Login));
|
||||
IsLoading = false;
|
||||
Close?.Invoke(false);
|
||||
}
|
||||
else if (SteamLoginState.Message != null)
|
||||
{
|
||||
IsLoading = false;
|
||||
Toast.Show(ToastIcon.Warning, SteamLoginState.Message);
|
||||
}
|
||||
}
|
||||
|
||||
await Account.DoLoginV2Async(SteamLoginState);
|
||||
|
||||
Requires2FA = SteamLoginState.Requires2FA;
|
||||
RequiresEmailAuth = SteamLoginState.RequiresEmailAuth;
|
||||
|
||||
if (SteamLoginState.Success)
|
||||
{
|
||||
if (RemenberLogin)
|
||||
{
|
||||
var session = SteamSession.RentSession(SteamLoginState.SteamId.ToString());
|
||||
|
||||
if (session != null)
|
||||
await SteamSession.SaveSession(session);
|
||||
}
|
||||
Toast.Show(ToastIcon.Success, Strings.Success_.Format(Strings.User_Login));
|
||||
IsLoading = false;
|
||||
Close?.Invoke(false);
|
||||
}
|
||||
else if (SteamLoginState.Message != null)
|
||||
{
|
||||
IsLoading = false;
|
||||
Toast.Show(ToastIcon.Warning, SteamLoginState.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
IsLoading = false;
|
||||
ex.LogAndShowT();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -424,11 +424,11 @@ $"""
|
||||
try
|
||||
{
|
||||
MSIXHelper.SignTool.Start(force_sign, fileNames, pfxFilePath, rootPublishDir);
|
||||
Console.WriteLine("数字签名失败,输入回车使用自签继续");
|
||||
Console.ReadLine();
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("数字签名失败,输入回车使用自签继续");
|
||||
Console.ReadLine();
|
||||
if (debug)
|
||||
throw;
|
||||
MSIXHelper.SignTool.Start(force_sign, fileNames, MSIXHelper.SignTool.pfxFilePath_BeyondDimension_CodeSigning, rootPublishDir);
|
||||
@@ -608,7 +608,7 @@ $"""
|
||||
|
||||
private static readonly Lazy<string> _AppVersion4 = new(() =>
|
||||
{
|
||||
var v = new Version(AssemblyInfo.Version);
|
||||
var v = new Version(AssemblyInfo.FileVersion);
|
||||
static int GetInt32(int value) => value < 0 ? 0 : value;
|
||||
return $"{GetInt32(v.Major)}.{GetInt32(v.Minor)}.{GetInt32(v.Build)}.{GetInt32(v.Revision)}";
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"BD.WTTS.Client.Tools.Publish": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "nsis --rids win-x64 --hsm-sign --t 240306_1204508630992",
|
||||
"commandLineArgs": "run --rids win-x64 --hsm-sign --stm-upload",
|
||||
"commandLineArgs_release": "run --rids win-x64 --hsm-sign --stm-upload",
|
||||
"commandLineArgs_nsis": "nsis --rids win-x64 --hsm-sign --t 240306_1151276715468",
|
||||
"commandLineArgs_debug": "run --rids win-x64 --hsm-sign --stm-upload --debug",
|
||||
|
||||
@@ -68,8 +68,16 @@ public static partial class GlobalDllImportResolver
|
||||
//static string GetDllDirectory() => GetLibraryPath();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string GetLibraryPath(string? libraryName = null)
|
||||
=> Path.Combine(BaseDirectory, "native", RID, libraryName ?? string.Empty);
|
||||
public static string GetLibraryPath(string? libraryName = null, string? baseDirectory = null)
|
||||
{
|
||||
var libraryPath = Path.Combine(baseDirectory ?? BaseDirectory, "native", RID, libraryName ?? string.Empty);
|
||||
if (libraryName != null &&
|
||||
libraryName.StartsWith("WinDivert"))
|
||||
{
|
||||
libraryPath = Path.Combine(IOPath.AppDataDirectory, "native", RID, libraryName ?? string.Empty);
|
||||
}
|
||||
return libraryPath;
|
||||
}
|
||||
|
||||
const string fileExtension_ =
|
||||
#if WINDOWS
|
||||
|
||||
@@ -196,7 +196,8 @@ internal sealed class RequestCacheRepository : CacheRepository<RequestCache, str
|
||||
}
|
||||
Write(s, request.Headers.Accept);
|
||||
s.Write("\r\n"u8);
|
||||
Write(s, request.Headers.AcceptEncoding);
|
||||
//Write(s, request.Headers.AcceptEncoding); // AcceptEncoding 在 Fetch 中为空,Save 时有值😅
|
||||
s.Write("gzip|deflate|br"u8);
|
||||
s.Write("\r\n"u8);
|
||||
var referrer = request.Headers.Referrer;
|
||||
if (referrer == default)
|
||||
|
||||
@@ -124,7 +124,7 @@ partial class Startup // 自定义控制台命令参数
|
||||
});
|
||||
rootCommand.AddCommand(steamuser);
|
||||
|
||||
// -clt app -id 282800
|
||||
// -clt app -id 282800 -achievement
|
||||
var run_SteamApp = new Command("app", "运行 Steam 应用");
|
||||
run_SteamApp.AddOption(new Option<int>("-id", "指定一个 Steam 游戏 Id"));
|
||||
run_SteamApp.AddOption(new Option<bool>("-achievement", "打开成就解锁窗口"));
|
||||
|
||||
@@ -187,14 +187,19 @@ partial class Startup // Properties
|
||||
|
||||
public Task WaitConfiguredServices => waitConfiguredServices.Task;
|
||||
|
||||
static readonly Lazy<string?> _NativeLibraryPath = new(() =>
|
||||
{
|
||||
#if WINDOWS || LINUX
|
||||
return $"{GlobalDllImportResolver.GetLibraryPath(null)};{GlobalDllImportResolver.GetLibraryPath(null, IOPath.AppDataDirectory)}";
|
||||
#endif
|
||||
#if MACOS
|
||||
return AppContext.BaseDirectory;
|
||||
#endif
|
||||
return null;
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// 自定义本机库加载路径
|
||||
/// </summary>
|
||||
public static string? NativeLibraryPath { get; }
|
||||
#if WINDOWS || LINUX
|
||||
= GlobalDllImportResolver.GetLibraryPath(null);
|
||||
#endif
|
||||
#if MACOS
|
||||
= AppContext.BaseDirectory;
|
||||
#endif
|
||||
public static string? NativeLibraryPath => _NativeLibraryPath.Value;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public abstract partial class Startup
|
||||
}
|
||||
|
||||
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
|
||||
readonly string[]? args;
|
||||
string[]? args;
|
||||
|
||||
public Startup(string[]? args = null)
|
||||
{
|
||||
@@ -78,11 +78,12 @@ public abstract partial class Startup
|
||||
{
|
||||
var handledArgs = HandleProtocolActivation(protocolActivatedEventArgs);
|
||||
if (handledArgs != null)
|
||||
return handledArgs;
|
||||
this.args = handledArgs;
|
||||
}
|
||||
break;
|
||||
case ActivationKind.StartupTask:
|
||||
return IPlatformService.SystemBootRunArguments.Split(' ');
|
||||
this.args = IPlatformService.SystemBootRunArguments.Split(' ');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user