Compare commits

..
50 Commits
Author SHA1 Message Date
Mossimo 86122510b4 Merge branch 'develop' of https://github.com/BeyondDimension/SteamTools into develop 2026-03-11 19:32:23 +08:00
Mossimo 67f047735f Update Startup.cs
Macos Dot DisposeAsync
2026-03-11 19:31:46 +08:00
RMBGAME 8ee7e09ecf Steam编辑数据支持导入导出
修复Steam新成就格式无限加载问题
2026-03-11 19:12:56 +08:00
LY e464f285e2 Merge branch 'develop' of https://github.com/BeyondDimension/SteamTools into develop 2026-03-11 04:08:32 +08:00
LY 68d1435ade 🔧 更新预览版本号至 5
将 AssemblyInfo.Constants.cs 中 AssemblyInfo 类的 ver_for_preview 常量从 "3" 提升至 "5",以反映最新的预览版本进度。
2026-03-11 04:07:53 +08:00
RMBGAME d42f6ba07a 😭 没有办法只能特殊处理github脚本注入问题 2026-03-10 20:55:31 +08:00
RMBGAME 662a5aca6f 🔨 优化脚本注入路径为同源,修复github加速在启用脚本的情况下出现异常 2026-03-09 23:33:38 +08:00
RMBGAME f422c76805 挂卡支持黑名单游戏自动排除 2026-03-09 18:28:30 +08:00
LY cd85ff7f17 🔧 升级预览版本号,优化登录注册异常处理
- 将预览版本号提升至 3
- 注释掉短信验证码校验方法 CanSubmit
- 登录/注册流程移除验证码校验,增加异常捕获与提示,确保 IsLoading 状态正确重置
2026-03-07 23:51:53 +08:00
LY bd30f0dcc2 🔧 更新 Common 子模块及预览版本号
更新 Common 子模块至最新提交(799d7da),并将 AssemblyInfo.Constants.cs 中的预览版本号(ver_for_preview)从 1 升级为 2。
2026-03-05 16:25:54 +08:00
LY 5c4564931c 🚀 增加 macOS 发布支持并优化资源释放
新增 macOS ARM64 发布配置,发布命令支持自包含包;注释模块退出异步调用,提升资源释放安全性。
2026-02-13 19:15:08 +08:00
Mossimo 923c553da8 Merge branch 'develop' of https://github.com/BeyondDimension/SteamTools into develop 2026-02-13 17:55:57 +08:00
LY de36e33c5b 🛠️ 增强异常处理,记录反序列化失败信息
在 ReverseProxyServiceImpl 抽象类中,将反序列化 ReverseProxySettings 的 catch 语句改为 catch (Exception e),并在捕获异常时调用 OnException(e) 进行异常处理。这样可以在反序列化失败时记录异常信息,提高代码健壮性和可维护性。
2026-02-13 17:11:53 +08:00
Mossimo d95c797afa Merge branch 'develop' of https://github.com/BeyondDimension/SteamTools into develop 2026-02-13 15:43:40 +08:00
Mossimo f217902424 Update Info.plist 2026-02-13 15:42:48 +08:00
rmbadmin d6e6bd6cc3 🛠️ 修复图片流类型与文件名判断逻辑 2026-02-13 13:22:39 +08:00
LY 8b521ff7c2 🔄 更新子模块引用至最新提交
更新了 Common 和 DirectoryPackages 子模块,指向各自的最新提交版本,以保持依赖同步和代码库的最新状态。
2026-02-13 10:19:07 +08:00
rmbadmin ed061db526 🛠️ 更新子模块 2026-02-12 15:49:55 +08:00
rmbadmin 880d88749f Merge branch 'develop' of https://github.com/BeyondDimension/SteamTools into develop 2026-02-12 15:31:31 +08:00
rmbadmin 01dee6f61a 🧹 头像加载逻辑 2026-02-12 15:31:17 +08:00
LY 3267624951 🔧 调整 FileVersion 格式以兼容 msix 要求
将 AssemblyInfo.Constants.cs 中的 FileVersion 常量格式修改为始终包含四位,确保第四位为 0,满足 msix 安装包对版本号的格式要求。
2026-02-12 12:10:49 +08:00
rmbadmin 5bb8b2bde8 Merge branch 'develop' of https://github.com/BeyondDimension/SteamTools into develop 2026-02-12 11:36:10 +08:00
rmbadmin 736e9c405b 🔼 升级 .NET 版本至 10.0.3 2026-02-12 11:35:56 +08:00
LY 36619868e5 🗑️ 删除解决方案文件并增强证书处理健壮性
本次提交包括以下变更:
- 完全删除 WattToolkit.sln 解决方案文件,移除项目结构和配置。
- 优化 MSIXHelper.cs 中签名证书(pfxFilePath)处理逻辑,新增证书文件存在性判断,缺失时跳过签名流程,提升自动化构建容错性。
2026-02-12 11:17:59 +08:00
LY 13ad0c7142 🔒 优化代码签名密码文件处理逻辑
优化了代码签名时对密码文件(.txt)不存在的处理方式。现在仅在密码文件存在时才读取和解密密码,并动态调整 signtool 命令行参数,避免无谓操作和异常。相关目录与熵文件的读取也仅在需要时进行。
2026-02-12 11:06:43 +08:00
LY 2155c6a91e 🛠️ 优化 GC 配置,改进符号文件处理及签名流程
重构了 BD.WTTS.Client.Avalonia.App.csproj 的 GC 配置方式,新增 runtimeconfig.json 的 GC 高内存占比设置。IDotNetPublishCommand.cs 现支持同步移动 .pdb 符号文件,提升调试体验。MSIXHelper.cs 注释掉了签名证书路径的限制,支持更多签名场景。
2026-02-12 10:52:44 +08:00
LY 40893ce6b1 ✨ 新增 WattToolkit.slnx 并优化解决方案查找
新增自定义解决方案文件 WattToolkit.slnx,完善项目结构描述。更新 Common、DirectoryPackages、appcenter-sdk-dotnet 子模块引用。优化 ProjectUtils.GetProjectPath 方法,支持同时查找 .sln 和 .slnx 文件,提升兼容性。
2026-02-12 10:31:23 +08:00
LY 023d5a98b6 🔄 更新子模块引用至最新提交
本次提交将 Common、DirectoryPackages、SteamClient 及 WTTS.MicroServices.ClientSDK 四个子模块指向了各自的新提交哈希。具体代码变更请参考各子模块仓库,可能包含功能优化、缺陷修复等内容。
2026-02-11 19:17:25 +08:00
LY e501f46aa7 ✨ 新增 -silence 参数支持挂运行服务
增加了 -silence 命令行参数,允许运行 Steam 应用时选择挂运行服务模式(不加载窗口,内存占用更小)。该参数默认值为 false,并已集成到 app 命令参数列表及执行逻辑中。
2026-02-11 19:07:14 +08:00
rmbadmin c96c30fa40 Merge branch 'develop' of https://github.com/BeyondDimension/SteamTools into develop 2026-02-09 19:55:02 +08:00
rmbadmin b76f77c017 ✨ 更新子模块并优化图片流处理 2026-02-09 19:54:46 +08:00
LY 74b2c3b3e7 🗑️ 移除 SAM.API 项目并重置版本号为 0
本次提交移除了 WattToolkit.sln 解决方案中的 SAM.API 项目及其所有相关配置,同时将 AssemblyInfo.Constants.cs 中的 VersionBuild 从 1 修改为 0,使程序集版本号回退。
2026-02-09 18:31:14 +08:00
rmbadmin be6b58f7f0 🔄 更新子模块引用及标记本地更改
更新了 Fusillade、Titanium-Web-Proxy 和 dotnet-packaging 子模块的提交状态,添加了 -dirty 标记,表示存在未提交的本地更改。同时将 SteamClient 子模块引用从 6370e99 更新为 460d55c,指向了新的上游提交。
2026-02-09 18:17:16 +08:00
LY 651a229a24 🔄 更新 DirectoryPackages 子模块版本
将 DirectoryPackages 子模块从 d28073cee219c8a54d2cec38a314da24b22d85db 更新至 96eb03bd07beaf475584841434df07d53f0d4d1b,以同步最新依赖或修复。
2026-02-09 17:36:42 +08:00
LY 6db92b60ce 🔼 升级 .NET 版本及相关配置
升级 .NET 版本至 10.0.2,更新 Version2 为 3.1,替换 HSM 代码签名证书指纹,标记 DirectoryPackages 子项目为 dirty。
2026-02-09 17:05:22 +08:00
LY b25c682e55 迁移动图控件至BD.Avalonia8.Image2.Compat并引入关机检测
新增BD.Avalonia8.Image2.Compat项目,替换原Avalonia.Gif动图控件,支持Gif/Apng。引入OSShuttingDownHelper跨项目共享代码,统一操作系统关机检测逻辑,并在主程序及IPC服务中应用。调整解决方案结构和项目引用,优化构建配置,统一引入SourceLink,提升可维护性和一致性。同步部分依赖子模块。
2026-02-09 16:39:18 +08:00
LY c457037a09 新增 Avalonia8 子模块并锁定特定提交
新增 ref/Avalonia8 子模块,指向 https://github.com/BeyondDimension/Avalonia8,并锁定在提交 2a842298c87e1ff8b0fe80b28f45ca52a31cbf21,便于后续集成和管理。
2026-02-09 16:38:49 +08:00
LY c222ae2a57 新增虚拟文件夹项目并调整嵌套关系
本次提交新增了 "Image2" 和 "Avalonia8" 两个虚拟文件夹项目,调整了部分项目的嵌套关系,并更新了 Common、DirectoryPackages、SteamClient、WinAuth 四个子模块的 commit。
2026-02-09 15:17:29 +08:00
rmbadmin e2a5e7ef11 🛡️ 增加加速进程关机检测,防止关机时报错 2026-02-09 12:18:41 +08:00
LY 32d3fa92ca 🔄 更新子模块并增强ReverseProxySettings序列化兼容性
更新了多个子模块(Avalonia.Image2、DirectoryPackages、SteamClient、WTTS.MicroServices.ClientSDK、WinAuth)到最新提交。
在 IReverseProxyService.Constants.cs 中,将 ReverseProxySettings 的 MP2Obj 特性增加了 GenerateType.VersionTolerant 参数,使其支持版本容错序列化,提升了数据结构的兼容性和可扩展性。
2026-02-06 19:05:24 +08:00
rmbadmin db30652b22 ✨ 统一关闭 UI 动画并优化 XAML 属性顺序
本次提交主要做了以下改动:

- 全面将各页面 Border 控件的 spp:Animations.EnableAnimations 属性由 True 改为 False,关闭 UI 动画效果,提升性能与兼容性。
- 优化 HomePage.axaml 及相关 XAML 文件的属性顺序,提升代码可读性和一致性。
- 调整 HomePage.axaml 中 NavButtonStyle 等资源定义顺序,增强可维护性。
- ProxyService.Operate.cs 中,异常隐式转换现在会将 Exception.Message 作为 Error 字段,便于错误信息展示。
- 更新了 DirectoryPackages 和 SteamClient 子模块状态为 dirty,提示有本地未提交更改。
- 本次变更未涉及核心业务逻辑,仅为 UI 表现和异常信息优化。
2026-02-06 17:39:25 +08:00
rmbgame cb00861532 Fix Epic 19.0.1 Switch 2026-02-03 11:57:05 +08:00
LY 64f60440a3 ✨ 优化自动化打包流程与命令兼容性
本次提交包括以下更新:
- 优化 CommandCompat.cs 中 SetHandler 的反射调用逻辑,提升类型兼容性与健壮性
- INSISBuildCommand 支持 timestamp=latest 自动查找最新发布目录,简化打包流程
- MSIXHelper.cs 新增多项 Windows 版本枚举,便于后续适配
- launchSettings.json 增加多种一键发布/打包/签名启动配置,提升运维效率
- DirectoryPackages 子模块标记为 dirty,提示有本地未提交更改
2026-02-02 13:59:27 +08:00
LY 0465f6f578 🛠️ 命令行兼容性升级与依赖优化
本次提交主要内容如下:

- 升级开发环境文档,VS/Xcode 版本提升
- 多项目依赖由包引用切换为源码引用,便于本地开发
- 注释 Aigio.AppCenter 相关包,恢复 fusillade
- 新增 CommandCompat,统一命令行参数与 Handler 绑定方式,适配新版 System.CommandLine
- NoticeService 优化,确保 UI 线程安全
- 细节修正:特性标记、空值保护、无用节点清理等
- 更新子模块指向

为后续开发和维护提供更好的兼容性和可维护性。
2026-02-02 11:45:18 +08:00
LY a8701adbb4 🚀 CI 配置迁移及依赖与命名空间调整
本次提交包括以下主要变更:

- CI/CD 配置从 CI.yml 迁移至 CI.yml.bak,流程内容基本一致,仅启用 aigio-win10ltsc-vm 平台,release 步骤仍为注释状态。
- BD.WTTS.Client.csproj 中 fusillade 依赖切换为 BD.Common.fusillade,自有维护版本。
- 全面将 UI 相关代码中的 using Avalonia.ReactiveUI; 替换为 using ReactiveUI.Avalonia;,并同步更新全局 using。
- 更新了 Avalonia.Image2、Common、DirectoryPackages、WTTS.MicroServices.ClientSDK 四个子模块指向的 commit,依赖同步至新版本。
2026-01-30 19:04:03 +08:00
LY d954e99f12 🔗 新增 Fusillade 作为子模块依赖
在 .gitmodules 文件中添加了 ref/Fusillade 子模块,指向 https://github.com/reactiveui/Fusillade,并在项目中引入了指定提交的 Fusillade 依赖。这样项目可以直接使用 Fusillade 库的功能。
2026-01-30 18:44:59 +08:00
rmbgame ab1dcbdcaf 🎨 优化设置界面结构,替换自定义颜色选择器
本次提交主要内容如下:

- 新增 Avalonia.Controls.ColorPicker 依赖,替换原有自定义颜色选择器,简化颜色选择逻辑
- 统一和优化 Settings_UI.axaml 中控件属性顺序、缩进和结构,提升可读性与维护性
- 优化 Accent 颜色预览区域和图片相关设置项的布局与属性
- ComboBox ItemTemplate 类型声明规范化
- Tab 项模板结构调整
- 更新 Common 和 DirectoryPackages 子模块指向最新 commit

整体提升了 UI 代码规范性和可维护性,为后续功能扩展打下基础
2026-01-30 17:40:32 +08:00
LY 7e4319695f 🛠️ 重构命令行工具并优化依赖管理
本次提交包含以下主要更新:

- 解决方案结构调整,新增 BD.Common 相关源码引用,升级 VS 版本至 18
- 多项目依赖由 PackageReference 改为 ProjectReference,便于源码调试
- 命令行工具(CLT)全面重构,采用新版 System.CommandLine API,参数定义更规范,注册方式更现代化
- 移除 StyleCop.Analyzers,简化构建流程;多平台配置精简 TargetFrameworks
- 更新各子模块至最新 commit
- IPlugin 等接口参数支持 null,提升兼容性;AppSettings 属性 Obsolete 标记调整
- 其他细节优化及无用代码清理
2026-01-30 16:53:03 +08:00
LY 6a78e9aa71 🚀 升级 .NET 10 并优化版本号管理
本次提交包含以下主要变更:

- 升级 .NET 目标版本至 10.0,提升运行时和语言特性支持。
- 优化版本号管理逻辑,增加 VersionBuild 字段,调整 FileVersion 和 InformationalVersion 格式,便于区分不同版本阶段。
- 更新 Common、appcenter-sdk-dotnet 等子模块依赖,保持依赖库最新。
- DirectoryPackages 标记为 dirty,提示有本地未提交更改。
2026-01-30 12:02:56 +08:00
Aigio Liu ece1768b2a 🐛 BD.AppCenter 2025-05-06 10:37:12 +08:00
141 changed files with 2326 additions and 2486 deletions
+6
View File
@@ -40,3 +40,9 @@
[submodule "ref/appcenter-sdk-dotnet"]
path = ref/appcenter-sdk-dotnet
url = https://github.com/BeyondDimension/appcenter-sdk-dotnet.git
[submodule "ref/Fusillade"]
path = ref/Fusillade
url = https://github.com/reactiveui/Fusillade
[submodule "ref/Avalonia8"]
path = ref/Avalonia8
url = https://github.com/BeyondDimension/Avalonia8
+2 -3
View File
@@ -71,13 +71,12 @@ See details [./doc/download-guide.en.md](./doc/download-guide.en.md)
Read what we [milestones](https://github.com/BeyondDimension/SteamTools/milestones), and feel free to ask questions.
## ⌨️ Development Environment
[Visual Studio 2022](https://visualstudio.microsoft.com/vs)
[Visual Studio 2022 for Mac](https://visualstudio.microsoft.com/vs/mac)
[Visual Studio 2026](https://visualstudio.microsoft.com/vs)
[JetBrains Rider](https://www.jetbrains.com/rider)
[Visual Studio Code](https://code.visualstudio.com)
[OpenJDK 17](https://learn.microsoft.com/en-us/java/openjdk/download#openjdk-17)
[Android Studio Electric Eel Or Higher](https://developer.android.com/studio)
[Xcode 14 Or Higher](https://developer.apple.com/xcode)
[Xcode 26 Or Higher](https://developer.apple.com/xcode)
## 🏗️ Project Structure
See details  [./src/README.md](./src/README.md)
+2 -18
View File
@@ -93,28 +93,12 @@
查看这个 [milestones](https://github.com/BeyondDimension/SteamTools/milestones) 来了解我们下一步的开发计划,并随时提出问题。
## ⌨️ 开发环境
[Visual Studio 2022](https://visualstudio.microsoft.com/zh-hans/vs) 或 [Visual Studio 2022 for Mac](https://visualstudio.microsoft.com/zh-hans/vs/mac)
- 系统要求
- [Windows 11 版本 21H2 或更高版本:家庭版、专业版、专业教育版、专业工作站版、企业版和教育版](https://learn.microsoft.com/zh-cn/visualstudio/releases/2022/system-requirements)
- [macOS Big Sur 11.0 或更高版本](https://learn.microsoft.com/zh-cn/visualstudio/releases/2022/mac-system-requirements)
- 工作负荷
- Web 和云
- ASP.NET 和 Web 开发
- 桌面应用和移动应用
- 使用 .NET 的移动开发 / .NET Multi-platform App UI 开发
- .NET 桌面开发
- 通用 Windows 平台开发
- 单个组件
- GitHub Extension for Visual Studio(可选)
- [Visual Studio Marketplace](https://marketplace.visualstudio.com)
- [Avalonia for Visual Studio(可选)](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS)
- [NUnit VS Templates(可选)](https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.NUnitTemplatesforVisualStudio)
[Visual Studio 2026](https://visualstudio.microsoft.com/zh-hans/vs)
[JetBrains Rider](https://www.jetbrains.com/rider)
[Visual Studio Code](https://code.visualstudio.com)
[OpenJDK 17](https://learn.microsoft.com/zh-cn/java/openjdk/download#openjdk-17)
[Android Studio Electric Eel 或更高版本](https://developer.android.google.cn/studio)
[Xcode 14 或更高版本](https://developer.apple.com/xcode)
[Xcode 26 或更高版本](https://developer.apple.com/xcode)
## 🏗️ [项目结构](./src/README.md)
详见  [./src/README.md](./src/README.md)
-1372
View File
File diff suppressed because it is too large Load Diff
+178
View File
@@ -0,0 +1,178 @@
<Solution>
<Configurations>
<Platform Name="Any CPU" />
<Platform Name="ARM" />
<Platform Name="ARM64" />
<Platform Name="x64" />
<Platform Name="x86" />
</Configurations>
<Folder Name="/0.Root/">
<File Path=".github/workflows/CI.yml" />
<File Path=".gitignore" />
<File Path=".gitmodules" />
<File Path="nuget.config" />
<File Path="README.en.md" />
<File Path="README.md" />
<File Path="ref/DirectoryPackages/Directory.Packages.props" />
<File Path="src/.editorconfig" />
<File Path="src/Directory.Build.props" />
</Folder>
<Folder Name="/0.Root/Build/">
<File Path="build/publish_apphost_linux_x64.sh" />
<File Path="build/settings_v4_app.json" />
</Folder>
<Folder Name="/0.Root/Document/">
<File Path="doc/file-system.md" />
<File Path="doc/open-source-library.md" />
<File Path="doc/openwrt.md" />
<File Path="doc/publish.md" />
<File Path="doc/release-keylol.md" />
</Folder>
<Folder Name="/0.Root/Document/Program File Structure/">
<File Path="doc/program-file-structure/Linux.md" />
<File Path="doc/program-file-structure/macOS.md" />
<File Path="doc/program-file-structure/Windows.md" />
</Folder>
<Folder Name="/0.Root/Source/">
<File Path="src/AssemblyInfo.Constants.cs" />
<File Path="src/AssemblyInfo.cs" />
<File Path="src/AssemblyInfo.Version.Max.cs" />
<File Path="src/README.md" />
<File Path="src/Utils.cs" />
</Folder>
<Folder Name="/0.Root/Source/ImplicitUsings/">
<File Path="src/ImplicitUsings.ArchiSteamFarm.cs" />
<File Path="src/ImplicitUsings.AspNetCore.cs" />
<File Path="src/ImplicitUsings.AutoMapper.cs" />
<File Path="src/ImplicitUsings.Avalonia.cs" />
<File Path="src/ImplicitUsings.BCL.cs" />
<File Path="src/ImplicitUsings.Common.cs" />
<File Path="src/ImplicitUsings.Controllers.cs" />
<File Path="src/ImplicitUsings.Data.cs" />
<File Path="src/ImplicitUsings.EntityFrameworkCore.cs" />
<File Path="src/ImplicitUsings.Identity.cs" />
<File Path="src/ImplicitUsings.Jobs.cs" />
<File Path="src/ImplicitUsings.JsonProperty.cs" />
<File Path="src/ImplicitUsings.JWT.cs" />
<File Path="src/ImplicitUsings.MessagePack.cs" />
<File Path="src/ImplicitUsings.Models.cs" />
<File Path="src/ImplicitUsings.MSEX.cs" />
<File Path="src/ImplicitUsings.Nito.cs" />
<File Path="src/ImplicitUsings.NLog.cs" />
<File Path="src/ImplicitUsings.Plugins.cs" />
<File Path="src/ImplicitUsings.Quartz.cs" />
<File Path="src/ImplicitUsings.ReactiveUI.cs" />
<File Path="src/ImplicitUsings.Repositories.cs" />
<File Path="src/ImplicitUsings.Services.cs" />
<File Path="src/ImplicitUsings.Settings.cs" />
<File Path="src/ImplicitUsings.SQLite.cs" />
<File Path="src/ImplicitUsings.Steam.cs" />
<File Path="src/ImplicitUsings.UI.cs" />
<File Path="src/ImplicitUsings.UI.ViewModels.cs" />
<File Path="src/ImplicitUsings.UI.Views.cs" />
<File Path="src/ImplicitUsings.UnitTest.cs" />
<File Path="src/ImplicitUsings.WTTS.cs" />
</Folder>
<Folder Name="/0.Root/TFM/">
<File Path="src/TFM_NETX.props" />
<File Path="src/TFM_NETX_SINGLE.props" />
<File Path="src/TFM_NETX_WINDOWS.props" />
<File Path="src/TFM_NETX_WITH_ALL.props" />
<File Path="src/TFM_NETX_WITH_DESKTOP.props" />
<File Path="src/TFM_NETX_WITH_WINDOWS.props" />
</Folder>
<Folder Name="/1.AppHost/">
<Project Path="src/BD.WTTS.Client.AppHost.Bridge/Steam++.csproj" />
<Project Path="src/BD.WTTS.Client.AppHost/BD.WTTS.Client.AppHost.csproj" />
</Folder>
<Folder Name="/2.Reference/" />
<Folder Name="/2.Reference/AppCenter/">
<Project Path="ref/appcenter-sdk-dotnet/SDK/AppCenter/BD.AppCenter.Any/BD.AppCenter.Any.csproj" />
<Project Path="ref/appcenter-sdk-dotnet/SDK/AppCenterAnalytics/BD.AppCenter.Analytics.Any/BD.AppCenter.Analytics.Any.csproj" />
</Folder>
<Folder Name="/2.Reference/Avalonia/">
<Project Path="ref/Avalonia.Image2/Avalonia.Gif/Avalonia.Gif.csproj" />
<Project Path="ref/Avalonia.Image2/LibAPNG/LibAPNG.csproj" />
</Folder>
<Folder Name="/2.Reference/Common/">
<Project Path="ref/Common/src/BD.Common.Area/BD.Common.Area.csproj" />
<Project Path="ref/Common/src/BD.Common.Essentials.Maui.Runtime/BD.Common.Essentials.Maui.Runtime.csproj" />
<Project Path="ref/Common/src/BD.Common.Essentials.Preferences.SQLite/BD.Common.Essentials.Preferences.SQLite.csproj" />
<Project Path="ref/Common/src/BD.Common.Essentials.Primitives/BD.Common.Essentials.Primitives.csproj" />
<Project Path="ref/Common/src/BD.Common.Essentials.Utils/BD.Common.Essentials.Utils.csproj" />
<Project Path="ref/Common/src/BD.Common.Essentials/BD.Common.Essentials.csproj" />
<Project Path="ref/Common/src/BD.Common.Mvvm.ReactiveUI/BD.Common.Mvvm.ReactiveUI.csproj" />
<Project Path="ref/Common/src/BD.Common.Mvvm/BD.Common.Mvvm.csproj" />
<Project Path="ref/Common/src/BD.Common.Pinyin.TinyPinyin/BD.Common.Pinyin.TinyPinyin.csproj" />
<Project Path="ref/Common/src/BD.Common.Pinyin/BD.Common.Pinyin.csproj" />
<Project Path="ref/Common/src/BD.Common.Primitives/BD.Common.Primitives.csproj" />
<Project Path="ref/Common/src/BD.Common.Repositories.SQLitePCL/BD.Common.Repositories.SQLitePCL.csproj" />
<Project Path="ref/Common/src/BD.Common.Security/BD.Common.Security.csproj" />
<Project Path="ref/Common/src/BD.Common.Settings/BD.Common.Settings.csproj" />
<Project Path="ref/Common/src/BD.Common/BD.Common.csproj" />
</Folder>
<Folder Name="/2.Reference/Steam/">
<Project Path="ref/ArchiSteamFarm/ArchiSteamFarm/ArchiSteamFarm.csproj" />
<Project Path="ref/Facepunch.Steamworks/Facepunch.Steamworks/Facepunch.Steamworks.Posix.csproj" />
<Project Path="ref/Facepunch.Steamworks/Facepunch.Steamworks/Facepunch.Steamworks.Win64.csproj" />
<Project Path="ref/Gameloop.Vdf/Gameloop.Vdf/Gameloop.Vdf.csproj" />
<Project Path="ref/Steam4NET/Steam4NET/Steam4NET.csproj" />
<Project Path="ref/SteamClient/ref/ValveKeyValue/ValveKeyValue/ValveKeyValue/ValveKeyValue.csproj" />
<Project Path="ref/SteamClient/src/BD.SteamClient.Models.Protobuf/BD.SteamClient.Models.Protobuf.csproj" />
<Project Path="ref/SteamClient/src/BD.SteamClient/BD.SteamClient.csproj" />
</Folder>
<Folder Name="/2.Reference/WinAuth/">
<Project Path="ref/WinAuth/src/WinAuth/WinAuth.csproj" />
</Folder>
<Folder Name="/3.Test/">
<Project Path="src/BD.WTTS.UnitTest/BD.WTTS.UnitTest.csproj" />
</Folder>
<Folder Name="/4.Shared/">
<Project Path="src/BD.Avalonia8.Image2.Compat/BD.Avalonia8.Image2.Compat.csproj" />
<Project Path="src/BD.WTTS.Client.Avalonia/BD.WTTS.Client.Avalonia.csproj" />
<Project Path="src/BD.WTTS.Client.IPC/BD.WTTS.Client.IPC.csproj" />
<Project Path="src/BD.WTTS.Client/BD.WTTS.Client.csproj" />
<Project Path="src/OSShuttingDownHelper/OSShuttingDownHelper.shproj" />
</Folder>
<Folder Name="/4.Shared/Avalonia.Ref/">
<Project Path="src/Avalonia.Base.Internals/Avalonia.Base.Internals.csproj" />
<Project Path="src/Avalonia.Base/Avalonia.Base.csproj" />
<Project Path="src/Avalonia.Controls.Internals/Avalonia.Controls.Internals.csproj" />
<Project Path="src/Avalonia.Desktop/Avalonia.Desktop.csproj" />
<Project Path="src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj" />
<Project Path="src/Avalonia.Native/Avalonia.Native.csproj" />
<Project Path="src/Avalonia.Skia.Internals/Avalonia.Skia.Internals.csproj" />
<Project Path="src/Avalonia.WebView2/Avalonia.WebView2.csproj" />
<Project Path="src/Avalonia.Win32/Avalonia.Win32.csproj" />
<Project Path="src/Avalonia.X11/Avalonia.X11.csproj" />
</Folder>
<Folder Name="/4.Shared/ClientSDK/">
<Project Path="ref/WTTS.MicroServices.ClientSDK/ref/WTTS.Public/src/BD.WTTS.MicroServices.Primitives.Resources/BD.WTTS.MicroServices.Primitives.Resources.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/ref/WTTS.Public/src/BD.WTTS.Primitives.Resources/BD.WTTS.Primitives.Resources.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/src/BD.WTTS.MicroServices.ClientSDK/BD.WTTS.MicroServices.ClientSDK.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/src/BD.WTTS.MicroServices.Primitives.Models/BD.WTTS.MicroServices.Primitives.Models.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/src/BD.WTTS.MicroServices.Primitives.ViewModels/BD.WTTS.MicroServices.Primitives.ViewModels.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/src/BD.WTTS.MicroServices.Primitives/BD.WTTS.MicroServices.Primitives.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/src/BD.WTTS.Primitives.Models/BD.WTTS.Primitives.Models.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/src/BD.WTTS.Primitives.ViewModels/BD.WTTS.Primitives.ViewModels.csproj" />
<Project Path="ref/WTTS.MicroServices.ClientSDK/src/BD.WTTS.Primitives/BD.WTTS.Primitives.csproj" />
</Folder>
<Folder Name="/5.Plugins/">
<Project Path="src/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy/BD.WTTS.Client.Plugins.Accelerator.ReverseProxy.csproj" />
<Project Path="src/BD.WTTS.Client.Plugins.Accelerator/BD.WTTS.Client.Plugins.Accelerator.csproj" />
<Project Path="src/BD.WTTS.Client.Plugins.ArchiSteamFarmPlus/BD.WTTS.Client.Plugins.ArchiSteamFarmPlus.csproj" />
<Project Path="src/BD.WTTS.Client.Plugins.Authenticator/BD.WTTS.Client.Plugins.Authenticator.csproj" />
<Project Path="src/BD.WTTS.Client.Plugins.GameAccount/BD.WTTS.Client.Plugins.GameAccount.csproj" />
<Project Path="src/BD.WTTS.Client.Plugins.GameList/BD.WTTS.Client.Plugins.GameList.csproj" />
<Project Path="src/BD.WTTS.Client.Plugins.GameTools/BD.WTTS.Client.Plugins.GameTools.csproj" />
<Project Path="src/BD.WTTS.Client.Plugins.SteamIdleCard/BD.WTTS.Client.Plugins.SteamIdleCard.csproj" />
</Folder>
<Folder Name="/6.Tools/">
<Project Path="ref/Common/src/BD.Common.Settings.V4.SourceGenerator.Tools/BD.Common.Settings.V4.SourceGenerator.Tools.csproj" />
<Project Path="src/BD.WTTS.Client.Avalonia.Designer.HostApp/BD.WTTS.Client.Avalonia.Designer.HostApp.csproj" />
<Project Path="src/BD.WTTS.Client.Tools.HostsTest/BD.WTTS.Client.Tools.HostsTest.csproj" />
<Project Path="src/BD.WTTS.Client.Tools.OpenSourceLibraryList/BD.WTTS.Client.Tools.OpenSourceLibraryList.csproj" />
<Project Path="src/BD.WTTS.Client.Tools.Publish/BD.WTTS.Client.Tools.Publish.csproj" />
</Folder>
<Project Path="src/BD.WTTS.Client.Avalonia.App/BD.WTTS.Client.Avalonia.App.csproj" />
</Solution>
Submodule
+1
Submodule ref/Avalonia8 added at 1260f0054f
Submodule
+1
Submodule ref/Fusillade added at e53e10aef3
+9 -7
View File
@@ -5,29 +5,31 @@ namespace BD.WTTS;
/// </summary>
public static partial class AssemblyInfo
{
const string Version2 = "3.0";
const string Version2 = "3.1";
/// <summary>
/// 语义化应用程序版本
/// https://semver.org/lang/zh-CN/
/// </summary>
public const string Version = $"{Version2}.0";
public const string Version = $"{Version2}.{VersionBuild}";
const string VersionBuild = "0";
/// <summary>
/// 预览版本号,范围 1~9,只增不减
/// </summary>
const string ver_for_preview = "0";
const string ver_for_preview = "5";
/// <summary>
/// RC 版本号,范围 0~9,只增不减
/// </summary>
const string ver_for_rc = "16";
const string ver_for_rc = "0";
public const string FileVersion = $"{Version2}.{ver_for_rc}2{ver_for_preview}.0";
public const string FileVersion = $"{Version2}.2{ver_for_rc}2{ver_for_preview}.0"; // msix 需要保持第四位为0
//public const string InformationalVersion = Version;
public const string InformationalVersion = Version;
//public const string InformationalVersion = $"{Version}-preview.{ver_for_preview}";
public const string InformationalVersion = $"{Version}-rc.{ver_for_rc}";
//public const string InformationalVersion = $"{Version}-rc.{ver_for_rc}";
#if !APP_HOST
/// <summary>
@@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net$(DotNet_Version)</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>提供动图控件,支持 Gif/Apng</Description>
<AssemblyName>BD.Avalonia8.Image2</AssemblyName>
<RootNamespace>BD.Avalonia8.Image2</RootNamespace>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>true</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
</PropertyGroup>
<!-- Avalonia -->
<PropertyGroup>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\ref\Avalonia8\src\Sdk\Links\LibAPNG.props" />
<ItemGroup>
<Compile Remove="..\ImplicitUsings.Common.cs" />
<Compile Remove="..\AssemblyInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\..\ref\Avalonia8\src\BD.Avalonia8.Image2\**\*.cs">
<LinkBase></LinkBase>
</Compile>
<Compile Remove="$(MSBuildThisFileDirectory)..\..\ref\Avalonia8\src\BD.Avalonia8.Image2\bin\**\*.cs" />
<Compile Remove="$(MSBuildThisFileDirectory)..\..\ref\Avalonia8\src\BD.Avalonia8.Image2\obj\**\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="ReactiveUI" />
<PackageReference Include="ReactiveUI.Fody" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ref\Common\src\BD.Common.Mvvm\BD.Common.Mvvm.csproj" />
<ProjectReference Include="..\..\ref\Common\src\BD.Common\BD.Common.csproj" />
</ItemGroup>
</Project>
@@ -0,0 +1,41 @@
// Common\src\BD.Common8.Bcl\Extensions\StreamExtensions.cs
namespace System.Extensions;
/// <summary>
/// 提供对 <see cref="Stream"/> 类型的扩展函数
/// </summary>
internal static partial class StreamExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int ReadInt32(this Stream stream)
{
Span<byte> data = stackalloc byte[sizeof(int)];
stream.ReadExactly(data);
return BitConverter.ToInt32(data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ushort ReadUInt16(this Stream stream)
{
Span<byte> data = stackalloc byte[sizeof(ushort)];
stream.ReadExactly(data);
return BitConverter.ToUInt16(data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint ReadUInt32(this Stream stream)
{
Span<byte> data = stackalloc byte[sizeof(uint)];
stream.ReadExactly(data);
return BitConverter.ToUInt32(data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void WriteUInt32(this Stream stream, uint value)
{
Span<byte> data = stackalloc byte[sizeof(uint)];
BitConverter.TryWriteBytes(data, value);
stream.Write(data);
}
}
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ReactiveUI />
</Weavers>
@@ -0,0 +1,4 @@
// steampp
using Avalonia.Metadata;
[assembly: XmlnsDefinition("https://steampp.net/ui", "BD.Avalonia8.Image2")]
@@ -0,0 +1,24 @@
// <auto-generated/>
global using Avalonia;
global using Avalonia.Animation;
global using Avalonia.Controls;
global using Avalonia.Logging;
global using Avalonia.Media;
global using Avalonia.Media.Imaging;
global using Avalonia.Metadata;
global using Avalonia.Platform;
global using Avalonia.Rendering.Composition;
global using Avalonia.Threading;
global using Avalonia.VisualTree;
global using BD.Avalonia8.Image2;
global using BD.Avalonia8.Image2.Decoding;
global using System.Extensions;
global using System.Numerics;
global using System.Reactive.Linq;
global using AvaBitmap = Avalonia.Media.Imaging.Bitmap;
global using AvaPixelFormat = Avalonia.Platform.PixelFormat;
global using AvaPoint = Avalonia.Point;
global using AvaRect = Avalonia.Rect;
global using AvaSize = Avalonia.Size;
global using AvaVector = Avalonia.Vector;
global using CommonImageSource = BD.Common.UI.ViewModels.ImageSource.ClipStream;
@@ -0,0 +1,5 @@
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
[assembly: SuppressMessage("Style", "IDE0005:Using 指令是不需要的。", Justification = "<挂起>")]
+1 -1
View File
@@ -9,6 +9,6 @@
<legacyCorruptedStateExceptionsPolicy enabled="true"/>
</runtime>
<appSettings>
<add key="d" value="7.0.11"/>
<add key="d" value="10.0.3"/>
</appSettings>
</configuration>
+1 -1
View File
@@ -10,6 +10,6 @@
<legacyCorruptedStateExceptionsPolicy enabled="true"/>
</runtime>
<appSettings>
<add key="d" value="9.0.0"/>
<add key="d" value="10.0.3"/>
</appSettings>
</configuration>
+2 -2
View File
@@ -16,9 +16,9 @@ static unsafe partial class Program
{
static Program()
{
dotnet_version_major = "9";
dotnet_version_major = "10";
dotnet_version_minor = "0";
dotnet_version_build = "0";
dotnet_version_build = "3";
dotnet_version = $"{dotnet_version_major}.{dotnet_version_minor}.{dotnet_version_build}";
}
@@ -6,9 +6,6 @@
<RootNamespace>BD.WTTS</RootNamespace>
<DefineConstants>AVALONIA;$(DefineConstants)</DefineConstants>
<ApplicationId>net.steampp.app</ApplicationId>
<ServerGarbageCollection>false</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
<RetainVMGarbageCollection>false</RetainVMGarbageCollection>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
@@ -36,6 +33,18 @@
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<PropertyGroup>
<!-- 👇 GC 配置 MSBuild 属性 -->
<ServerGarbageCollection>false</ServerGarbageCollection>
<RetainVMGarbageCollection>false</RetainVMGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
</PropertyGroup>
<ItemGroup>
<!-- 👇 GC 配置 runtimeconfig.json -->
<RuntimeHostConfigurationOption Include="System.GC.HighMemoryPercent" Value="75" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\ImplicitUsings.MessagePack.cs">
<LinkBase>Properties</LinkBase>
+2 -2
View File
@@ -7,9 +7,9 @@
<key>CFBundleDisplayName</key>
<string>Watt Toolkit</string>
<key>CFBundleShortVersionString</key>
<string>3.0.0</string>
<string>3.1.0</string>
<key>CFBundleVersion</key>
<string>3.0.1219.0</string>
<string>3.1.2021.0</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
@@ -73,36 +73,34 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BD.Common" />
<PackageReference Include="BD.Common.Primitives" />
<PackageReference Include="BD.Common.Essentials" />
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="ReactiveUI.Avalonia" />
<PackageReference Include="Avalonia.Controls.DataGrid" />
<PackageReference Include="Avalonia.Controls.ItemsRepeater" />
<PackageReference Include="Avalonia.Xaml.Behaviors" />
<PackageReference Include="Xaml.Behaviors.Avalonia" />
<PackageReference Include="Avalonia.AvaloniaEdit" />
<PackageReference Include="AvaloniaEdit.TextMate" />
<!--<PackageReference Include="Markdown.Avalonia" />-->
<PackageReference Include="FluentAvaloniaUI" />
<PackageReference Include="Avalonia.Controls.ColorPicker" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.Avalonia" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" />
<!--ProjectReference Include="..\Avalonia.Themes.Default\Avalonia.Themes.Default.csproj" />
<ProjectReference Include="..\Avalonia.Themes.Fluent\Avalonia.Themes.Fluent.csproj" />-->
<ProjectReference Include="..\Avalonia.Desktop\Avalonia.Desktop.csproj" />
<ProjectReference Include="..\..\ref\Avalonia.Image2\Avalonia.Gif\Avalonia.Gif.csproj" />
<ProjectReference Include="..\BD.Avalonia8.Image2.Compat\BD.Avalonia8.Image2.Compat.csproj" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
<!-- Windows Only -->
<ProjectReference Include="..\Avalonia.X11\Avalonia.X11.csproj" />
<ProjectReference Include="..\Avalonia.Native\Avalonia.Native.csproj" />
<PackageReference Include="Aigio.Avalonia.AppCenter" />
<!--<PackageReference Include="Aigio.Avalonia.AppCenter" />
<PackageReference Include="Aigio.Avalonia.AppCenter.Analytics" />
<PackageReference Include="Aigio.Avalonia.AppCenter.Crashes" />
<PackageReference Include="Aigio.Avalonia.AppCenter.Crashes" />-->
<PackageReference Include="Avalonia.Win32" />
<PackageReference Include="BD.Common.Essentials.Maui.Runtime" />
<ProjectReference Include="..\..\ref\Common\src\BD.Common.Essentials.Maui.Runtime\BD.Common.Essentials.Maui.Runtime.csproj" />
<PackageReference Include="JumpLists.Win32.Avalonia" />
</ItemGroup>
@@ -111,7 +109,7 @@
<ProjectReference Include="..\Avalonia.X11\Avalonia.X11.csproj" />
<ProjectReference Include="..\Avalonia.Win32\Avalonia.Win32.csproj" />
<PackageReference Include="Avalonia.Native" />
<PackageReference Include="BD.Common.Essentials.Maui.Runtime" />
<ProjectReference Include="..\..\ref\Common\src\BD.Common.Essentials.Maui.Runtime\BD.Common.Essentials.Maui.Runtime.csproj" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == ''">
@@ -1,18 +1,18 @@
<UserControl
d:DesignHeight="900"
d:DesignWidth="1080"
mc:Ignorable="d"
x:Class="BD.WTTS.UI.Views.Pages.HomePage"
x:CompileBindings="True"
x:DataType="spp:HomePageViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:col="using:System.Collections.Generic"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
d:DesignHeight="900"
d:DesignWidth="1080"
x:CompileBindings="True"
x:DataType="spp:HomePageViewModel"
mc:Ignorable="d">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--<spp:PageBase.PreviewImage>
<ui:ImageIconSource Source="{Binding IconKey, Mode=OneWay, Converter={StaticResource BitmapAssetValueConverter}}" />
</spp:PageBase.PreviewImage>-->
@@ -70,87 +70,87 @@
<ScrollViewer Padding="20">
<!--<spp:ContentLoader IsLoading="False">-->
<StackPanel
x:Name="HomeRoot"
MaxWidth="1080"
Spacing="20">
Spacing="20"
x:Name="HomeRoot">
<spp:Snackbar
VerticalAlignment="Top"
IsClosable="False"
IsOpen="True"
IsVisible="{spp:OnPlatform !GA}"
Message="当前使用的程序版本为测试版本,可能会有各种各样不可言明的 Bug,遇到问题请理性反馈,谢谢。"
Severity="Warning" />
Severity="Warning"
VerticalAlignment="Top" />
<spp:Snackbar
VerticalAlignment="Top"
IsClosable="False"
IsOpen="True"
IsVisible="{spp:OnPlatform !GA}"
Message="如果您不喜欢当前主页为默认启动页面可以在【设置-界面设置-启动时默认打开页面】处更改" />
Message="如果您不喜欢当前主页为默认启动页面可以在【设置-界面设置-启动时默认打开页面】处更改"
VerticalAlignment="Top" />
<spp:Snackbar
Title="{Binding Path=Res.Notice_Tray_Title, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Top"
IsClosable="False"
IsOpen="True"
IsVisible="{Binding !!!MainWindow2.PluginCount, Mode=OneWay, Source={x:Static s:IViewModelManager.Instance}}"
Message="检测到你没有安装插件,请去下载插件即可使用更多功能。"
Severity="Warning" />
Severity="Warning"
Title="{Binding Path=Res.Notice_Tray_Title, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Top" />
<WrapPanel Margin="5,0">
<WrapPanel IsVisible="{Binding Source={x:Static s:SteamConnectService.Current}, Path=CurrentSteamUser, Mode=OneWay, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
<spp:Image2
Width="36"
DecodeWidth="36"
Height="36"
Margin="0,0,5,0"
VerticalAlignment="Center"
DecodeWidth="36"
Source="{Binding Source={x:Static s:SteamConnectService.Current}, Path=CurrentSteamUser.AvatarMedium, Mode=OneWay}"
Stretch="Uniform">
Stretch="Uniform"
VerticalAlignment="Center"
Width="36">
<spp:Image2.Clip>
<EllipseGeometry Rect="0,0,36,36" />
</spp:Image2.Clip>
</spp:Image2>
<TextBlock
VerticalAlignment="Center"
Text="{Binding Source={x:Static s:SteamConnectService.Current}, Path=CurrentSteamUser.SteamNickName, Mode=OneWay}"
Theme="{StaticResource SubtitleTextBlockStyle}" />
Theme="{StaticResource SubtitleTextBlockStyle}"
VerticalAlignment="Center" />
<TextBlock
VerticalAlignment="Center"
IsVisible="{Binding Source={x:Static s:SteamConnectService.Current}, Path=CurrentSteamUser.IPCountry, Mode=OneWay, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}"
Text="{Binding Source={x:Static s:SteamConnectService.Current}, Path=CurrentSteamUser.IPCountry, Mode=OneWay, StringFormat={}({0})}"
Theme="{StaticResource SubtitleTextBlockStyle}" />
Theme="{StaticResource SubtitleTextBlockStyle}"
VerticalAlignment="Center" />
<TextBlock
Margin="0,0,10,0"
VerticalAlignment="Center"
Text=","
Theme="{StaticResource SubtitleTextBlockStyle}" />
Theme="{StaticResource SubtitleTextBlockStyle}"
VerticalAlignment="Center" />
</WrapPanel>
<TextBlock VerticalAlignment="Center" Theme="{StaticResource SubtitleTextBlockStyle}">
<TextBlock Theme="{StaticResource SubtitleTextBlockStyle}" VerticalAlignment="Center">
<Run Text="{Binding Path=Res.Welcome_User_, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</TextBlock>
</WrapPanel>
<Grid Margin="0,-10,0,0" RowDefinitions="Auto,*">
<spp:CarouselBanner
MinHeight="350"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
ItemsSource="{Binding NavigationBanners}">
ItemsSource="{Binding NavigationBanners}"
MinHeight="350"
VerticalContentAlignment="Stretch">
<spp:CarouselBanner.ItemTemplate>
<DataTemplate DataType="spp:AdvertisementDTO">
<spp:AppItem
Title="{Binding Describe}"
Height="350"
Classes="Banner Scale"
ClickCommand="{Binding OpenBrowserCommand, Source={x:Static spp:App.Instance}}"
ClickCommandParameter="{Binding Url}"
Description="{Binding Name}"
Height="350"
Title="{Binding Describe}"
ToolTip.Tip="{Binding Describe}">
<spp:AppItem.Status>
<Border
Padding="20,10"
Background="{DynamicResource AccentFillColorSelectedTextBackgroundBrush}"
ClipToBounds="True"
CornerRadius="{StaticResource ControlCornerRadius}">
CornerRadius="{StaticResource ControlCornerRadius}"
Padding="20,10">
<TextBlock FontSize="16" Text="阅读更多" />
</Border>
</spp:AppItem.Status>
@@ -176,22 +176,22 @@
Spacing="10">
<DockPanel>
<TextBlock
VerticalAlignment="Center"
Text="最新消息"
Theme="{StaticResource TitleTextBlockStyle}" />
Theme="{StaticResource TitleTextBlockStyle}"
VerticalAlignment="Center" />
<Button
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding OpenBrowserCommand, Source={x:Static spp:App.Instance}}"
CommandParameter="{x:Static spp:HomePageViewModel.OfficialWebsite_Article}"
Content="查看更多"
DockPanel.Dock="Right"
Theme="{StaticResource HyperlinkButton}" />
HorizontalAlignment="Right"
Theme="{StaticResource HyperlinkButton}"
VerticalAlignment="Center" />
</DockPanel>
<Grid Margin="0,0,0,20" ColumnDefinitions="*,10,*,10,*">
<Grid ColumnDefinitions="*,10,*,10,*" Margin="0,0,0,20">
<Grid.Styles>
<Style x:DataType="spp:ArticleItemDTO" Selector="spp|AppItem">
<Style Selector="spp|AppItem" x:DataType="spp:ArticleItemDTO">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Title" Value="{Binding Title}" />
<Setter Property="Description" Value="{Binding Introduction}" />
@@ -225,13 +225,13 @@
</Grid.Styles>
<spp:AppItem Classes="Vertical Scale" DataContext="{Binding Articles[0]}" />
<spp:AppItem
Grid.Column="2"
Classes="Vertical Scale"
DataContext="{Binding Articles[1]}" />
DataContext="{Binding Articles[1]}"
Grid.Column="2" />
<spp:AppItem
Grid.Column="4"
Classes="Vertical Scale"
DataContext="{Binding Articles[2]}" />
DataContext="{Binding Articles[2]}"
Grid.Column="4" />
</Grid>
<!--<spp:CarouselItems ItemsPerPage="3" ItemsSource="{Binding Articles}">
@@ -265,34 +265,34 @@
<DockPanel>
<TextBlock
VerticalAlignment="Center"
Text="精选"
Theme="{StaticResource TitleTextBlockStyle}" />
Theme="{StaticResource TitleTextBlockStyle}"
VerticalAlignment="Center" />
<Button
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding OpenBrowserCommand, Source={x:Static spp:App.Instance}}"
CommandParameter="{x:Static spp:HomePageViewModel.WattGameUrl}"
Content="访问 WattGame 商城"
DockPanel.Dock="Right"
Theme="{StaticResource HyperlinkButton}" />
HorizontalAlignment="Right"
Theme="{StaticResource HyperlinkButton}"
VerticalAlignment="Center" />
</DockPanel>
<spp:CarouselItems
MinHeight="250"
ItemsPerPage="4"
ItemsSource="{Binding Shops}">
ItemsSource="{Binding Shops}"
MinHeight="250">
<spp:CarouselItems.ItemTemplate>
<DataTemplate x:DataType="spp:ShopRecommendGoodItem">
<!--<Border spp:Animations.EnableAnimations="True">-->
<spp:AppItem
Title="{Binding Name}"
MinHeight="250"
MaxWidth="260"
Classes="Vertical Scale"
ClickCommand="{Binding OpenBrowserCommand, Source={x:Static spp:App.Instance}}"
Cursor="Hand"
MaxWidth="260"
MinHeight="250"
Tags="{Binding GoodsAllCategorysText}"
Title="{Binding Name}"
ToolTip.Tip="{Binding Brief}">
<spp:AppItem.ClickCommandParameter>
<MultiBinding Converter="{StaticResource StringFormatConverter}">
@@ -310,31 +310,31 @@
<Border Classes="Status">
<StackPanel Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
IsVisible="{Binding !!DiscountValue}"
Text="{Binding Mktprice, Converter={StaticResource StringFormatConverter}, ConverterParameter={x:Static spp:CurrencyCode.CNY}}"
TextDecorations="Strikethrough" />
TextDecorations="Strikethrough"
VerticalAlignment="Center" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="{Binding Price, Converter={StaticResource StringFormatConverter}, ConverterParameter={x:Static spp:CurrencyCode.CNY}}" />
Text="{Binding Price, Converter={StaticResource StringFormatConverter}, ConverterParameter={x:Static spp:CurrencyCode.CNY}}"
VerticalAlignment="Center" />
</StackPanel>
</Border>
</spp:AppItem.Status>
<spp:AppItem.ActionButton>
<Border
Height="24"
Padding="8,0"
Background="#4c6b22"
ClipToBounds="True"
CornerRadius="4"
IsVisible="{Binding !!DiscountValue}">
Height="24"
IsVisible="{Binding !!DiscountValue}"
Padding="8,0">
<TextBlock
VerticalAlignment="Center"
Foreground="#beee11"
Text="{Binding DiscountValue, StringFormat={}-{0}%}" />
Text="{Binding DiscountValue, StringFormat={}-{0}%}"
VerticalAlignment="Center" />
</Border>
</spp:AppItem.ActionButton>
</spp:AppItem>
@@ -522,9 +522,9 @@
<ItemsControl ItemsSource="{Binding MainWindow2.TabItems, Mode=OneWay, Source={x:Static s:IViewModelManager.Instance}}">
<ItemsControl.Resources>
<ControlTheme
x:Key="NavButtonStyle"
BasedOn="{StaticResource {x:Type Button}}"
TargetType="Button">
TargetType="Button"
x:Key="NavButtonStyle">
<Setter Property="Width" Value="120" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="6" />
@@ -543,28 +543,28 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="spp:TabItemViewModel">
<Border spp:Animations.EnableAnimations="True">
<Border spp:Animations.EnableAnimations="False">
<Button
Command="{Binding $parent[spp:HomePage].((spp:HomePageViewModel)DataContext).NavgationToMenuPageCommand}"
CommandParameter="{Binding}"
Theme="{StaticResource NavButtonStyle}">
<Grid RowDefinitions="3*,*">
<Border
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="4 4 0 0"
RenderOptions.BitmapInterpolationMode="HighQuality">
HorizontalAlignment="Stretch"
RenderOptions.BitmapInterpolationMode="HighQuality"
VerticalAlignment="Stretch">
<spp:Image2
Width="96"
Height="96"
Margin="0,10,0,0"
Source="{Binding IconKey}"
Stretch="Uniform" />
Stretch="Uniform"
Width="96" />
</Border>
<TextBlock
FontWeight="SemiBold"
Grid.Row="1"
Margin="12"
FontWeight="SemiBold"
Text="{Binding Name}" />
</Grid>
</Button>
@@ -703,9 +703,9 @@
</TabControl>-->
<TextBlock
Margin="0,30"
HorizontalAlignment="Center"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
HorizontalAlignment="Center"
Margin="0,30"
Text="不忘初心,方得始终。"
Theme="{StaticResource SubtitleTextBlockStyle}" />
</StackPanel>
@@ -16,48 +16,48 @@
x:CompileBindings="True"
x:DataType="spp:MainWindowViewModel"
mc:Ignorable="d">
<UserControl.Styles>
<Style Selector="ui|NavigationView.AppNav">
<Setter Property="IsPaneToggleButtonVisible" Value="False" />
<Setter Property="OpenPaneLength" Value="72" />
<Setter Property="IsPaneOpen" Value="True" />
</Style>
<UserControl.Styles>
<Style Selector="ui|NavigationView.AppNav">
<Setter Property="IsPaneToggleButtonVisible" Value="False" />
<Setter Property="OpenPaneLength" Value="72" />
<Setter Property="IsPaneOpen" Value="True" />
</Style>
<Style Selector="ui|NavigationView.AppNav[IsBackButtonVisible=False] SplitView /template/ ContentPresenter#PART_PanePresenter">
<Setter Property="Margin" Value="0 42 0 0" />
</Style>
<Style Selector="ui|NavigationView.AppNav[IsBackButtonVisible=True] SplitView /template/ ContentPresenter#PART_PanePresenter">
<Setter Property="Margin" Value="0 2 0 0" />
</Style>
<Style Selector="ui|NavigationView.AppNav[IsBackButtonVisible=False] SplitView /template/ ContentPresenter#PART_PanePresenter">
<Setter Property="Margin" Value="0 42 0 0" />
</Style>
<Style Selector="ui|NavigationView.AppNav[IsBackButtonVisible=True] SplitView /template/ ContentPresenter#PART_PanePresenter">
<Setter Property="Margin" Value="0 2 0 0" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav">
<Setter Property="Transitions">
<Setter.Value>
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.05" />
</Transitions>
</Setter.Value>
</Setter>
</Style>
<Style Selector="ui|NavigationViewItem.AppNav">
<Setter Property="Transitions">
<Setter.Value>
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.05" />
</Transitions>
</Setter.Value>
</Setter>
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter">
<Setter Property="Width" Value="72" />
<Setter Property="MinHeight" Value="75" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
<Setter Property="Template">
<ControlTemplate>
<Border
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter">
<Setter Property="Width" Value="72" />
<Setter Property="MinHeight" Value="75" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
<Setter Property="Template">
<ControlTemplate>
<Border
Name="LayoutRoot"
Margin="4,6"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
TemplatedControl.IsTemplateFocusTarget="True">
<Panel>
<Panel HorizontalAlignment="Left" VerticalAlignment="Center">
<Panel>
<Panel HorizontalAlignment="Left" VerticalAlignment="Center">
<Border
<Border
Name="SelectionIndicator"
Width="3"
Height="20"
@@ -65,11 +65,11 @@
Background="{DynamicResource NavigationViewSelectionIndicatorForeground}"
CornerRadius="{StaticResource ControlCornerRadius}"
Opacity="0" />
</Panel>
</Panel>
<DockPanel>
<ContentPresenter
<DockPanel>
<ContentPresenter
Name="ContentPresenter"
Grid.Row="1"
Margin="0,-15,0,3"
@@ -80,80 +80,80 @@
ContentTemplate="{TemplateBinding ContentTemplate}"
DockPanel.Dock="Bottom"
FontSize="10">
<ContentPresenter.Styles>
<Style Selector="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</ContentPresenter.Styles>
</ContentPresenter>
<ContentPresenter.Styles>
<Style Selector="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</ContentPresenter.Styles>
</ContentPresenter>
<Viewbox
<Viewbox
Name="IconBox"
Height="28"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ContentPresenter Name="Icon" Content="{Binding TemplateSettings.Icon, RelativeSource={RelativeSource TemplatedParent}}" />
</Viewbox>
<ContentPresenter Name="Icon" Content="{Binding TemplateSettings.Icon, RelativeSource={RelativeSource TemplatedParent}}" />
</Viewbox>
</DockPanel>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</Style>
</DockPanel>
</Panel>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pointerover /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pointerover /template/ ContentPresenter#Icon">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pointerover /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pointerover /template/ ContentPresenter#Icon">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pressed /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pressed /template/ ContentPresenter#Icon">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pressed /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:pressed /template/ ContentPresenter#Icon">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:selected /template/ ContentPresenter#ContentPresenter">
<Setter Property="IsVisible" Value="False" />
<Setter Property="Foreground" Value="{DynamicResource AccentFillColorDefaultBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:selected /template/ ContentPresenter#ContentPresenter">
<Setter Property="IsVisible" Value="False" />
<Setter Property="Foreground" Value="{DynamicResource AccentFillColorDefaultBrush}" />
</Style>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:selected /template/ ContentPresenter#Icon">
<Setter Property="Foreground" Value="{DynamicResource AccentFillColorDefaultBrush}" />
</Style>
</UserControl.Styles>
<Style Selector="ui|NavigationViewItem.AppNav uip|NavigationViewItemPresenter:selected /template/ ContentPresenter#Icon">
<Setter Property="Foreground" Value="{DynamicResource AccentFillColorDefaultBrush}" />
</Style>
</UserControl.Styles>
<Grid RowDefinitions="Auto, *">
<spp:TitleBar Name="TitleBarHost">
<spp:TitleBar.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="8">
<DropDownButton
<Grid RowDefinitions="Auto, *">
<spp:TitleBar Name="TitleBarHost">
<spp:TitleBar.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="8">
<DropDownButton
Width="40"
Height="40"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding Path=MarkNotificationsHasRead, Mode=OneWay, Source={x:Static s:NoticeService.Current}}"
Theme="{DynamicResource TransparentButton}">
<Panel>
<ui:InfoBadge
<Panel>
<ui:InfoBadge
Margin="0,-3,-3,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Classes="Attention Dot"
IsVisible="{Binding Path=!!UnreadNotificationsCount, Mode=OneWay, Source={x:Static s:NoticeService.Current}}" />
<Viewbox
<Viewbox
Width="22"
Height="22"
VerticalAlignment="Center">
<ui:SymbolIcon Symbol="Alert" />
</Viewbox>
</Panel>
<ui:SymbolIcon Symbol="Alert" />
</Viewbox>
</Panel>
<DropDownButton.Flyout>
<!--<ui:FAMenuFlyout
<DropDownButton.Flyout>
<!--<ui:FAMenuFlyout
FlyoutPresenterClasses="NoPadding"
ItemsSource="{Binding Path=Notices, Mode=OneWay, Source={x:Static s:NoticeService.Current}}"
Placement="BottomEdgeAlignedRight">
@@ -166,79 +166,81 @@
</DataTemplate>
</ui:FAMenuFlyout.ItemTemplate>
</ui:FAMenuFlyout>-->
<Flyout FlyoutPresenterClasses="NoPadding" Placement="BottomEdgeAlignedRight">
<spp:NoticeFlyout Margin="5" />
</Flyout>
</DropDownButton.Flyout>
</DropDownButton>
<Flyout FlyoutPresenterClasses="NoPadding" Placement="BottomEdgeAlignedRight">
<spp:NoticeFlyout Margin="5" />
</Flyout>
</DropDownButton.Flyout>
</DropDownButton>
<DropDownButton Padding="4" Theme="{DynamicResource TransparentButton}">
<Border
<DropDownButton Padding="4" Theme="{DynamicResource TransparentButton}">
<Border
Width="32"
Height="32"
Background="{DynamicResource ControlOnImageFillColorDefaultBrush}"
ClipToBounds="True"
CornerRadius="30">
<spp:Image2
<spp:Image2
DecodeWidth="36"
FallbackSource="{StaticResource DefaultAvatar}"
RenderOptions.BitmapInterpolationMode="HighQuality"
KeepSourceStreamOpen="True"
Source="{Binding Path=AvatarPath, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
</Border>
<DropDownButton.Flyout>
<MenuFlyout FlyoutPresenterClasses="NoPadding" Placement="BottomEdgeAlignedRight">
<MenuItem
</Border>
<DropDownButton.Flyout>
<MenuFlyout FlyoutPresenterClasses="NoPadding" Placement="BottomEdgeAlignedRight">
<MenuItem
Command="{Binding Path=ShowWindow, Source={x:Static s:UserService.Current}}"
CommandParameter="{x:Static spp:AppEndPoint.LoginOrRegister}"
Cursor="Hand"
IsHitTestVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}}">
<MenuItem.Header>
<DockPanel>
<DockPanel DockPanel.Dock="Top">
<Border
<MenuItem.Header>
<DockPanel>
<DockPanel DockPanel.Dock="Top">
<Border
Width="64"
Height="64"
Margin="0,0,8,0"
ClipToBounds="True"
CornerRadius="64"
DockPanel.Dock="Left">
<spp:Image2
<spp:Image2
DecodeWidth="64"
FallbackSource="{StaticResource DefaultAvatar}"
RenderOptions.BitmapInterpolationMode="HighQuality"
KeepSourceStreamOpen="True"
Source="{Binding Path=AvatarPath, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
</Border>
<Panel>
<TextBlock
</Border>
<Panel>
<TextBlock
VerticalAlignment="Center"
IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}}"
Text="{Binding Path=Res.User_UnLogin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<StackPanel VerticalAlignment="Center" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
<TextBlock Text="{Binding Path=User.NickName, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
<Border
<StackPanel VerticalAlignment="Center" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
<TextBlock Text="{Binding Path=User.NickName, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
<Border
Padding="5,1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
CornerRadius="2"
IsVisible="{Binding Path=User.UserType, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource EnumEqualValueConverter}, ConverterParameter={x:Static enum:UserType.Sponsor}}">
<Border.Background>
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%">
<GradientStop Offset="0.0" Color="#453a94" />
<GradientStop Offset="1.0" Color="#f43b47" />
</LinearGradientBrush>
</Border.Background>
<TextBlock
<Border.Background>
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%">
<GradientStop Offset="0.0" Color="#453a94" />
<GradientStop Offset="1.0" Color="#f43b47" />
</LinearGradientBrush>
</Border.Background>
<TextBlock
VerticalAlignment="Center"
FontSize="10"
Foreground="White"
Text="{Binding Path=Res.User_Sponsor, Mode=OneWay, Source={x:Static s:ResourceService.Current}, StringFormat={}❤️{0}}" />
</Border>
</Border>
</StackPanel>
</Panel>
</DockPanel>
<!--<WrapPanel HorizontalAlignment="Center" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
</StackPanel>
</Panel>
</DockPanel>
<!--<WrapPanel HorizontalAlignment="Center" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}">
<Button Margin="5,0" FontSize="10">
<ToolTip.Tip>
<MultiBinding StringFormat="{}{0} : {1} / {2}">
@@ -273,33 +275,33 @@
</Button.Content>
</Button>
</WrapPanel>-->
</DockPanel>
</MenuItem.Header>
</MenuItem>
<MenuItem Header="-" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem
</DockPanel>
</MenuItem.Header>
</MenuItem>
<MenuItem Header="-" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem
Command="{Binding Path=OpenAuthOfficialCommand, Source={x:Static s:UserService.Current}}"
CommandParameter="https://steampp.net/account/center/info"
Header="{Binding Path=Res.PersonalCenter, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<!--<MenuItem Header="{Binding Path=Res.MyOrder, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />-->
<MenuItem
<!--<MenuItem Header="{Binding Path=Res.MyOrder, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />-->
<MenuItem
Command="{Binding Path=OpenAuthOfficialCommand, Source={x:Static s:UserService.Current}}"
CommandParameter="https://steampp.net/account/center/bind"
Header="{Binding Path=Res.BindThirdPartyAccount, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem
<MenuItem
Command="{Binding Path=OpenAuthOfficialCommand, Source={x:Static s:UserService.Current}}"
CommandParameter="https://steampp.net/account/center/safe"
Header="{Binding Path=Res.PersonalSafe, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="-" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem
<MenuItem Header="-" IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem
Command="{Binding Path=SignOut, Mode=OneWay, Source={x:Static s:UserService.Current}}"
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
Header="{Binding Path=Res.SignOut, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsVisible="{Binding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<!--<MenuItem
<!--<MenuItem
Command="{Binding Path=ShowWindow,
Source={x:Static s:UserService.Current}}"
CommandParameter="{x:Static spp:AppEndPoint.LoginOrRegister}"
@@ -311,14 +313,14 @@
Mode=OneWay,
Source={x:Static s:UserService.Current},
Converter={StaticResource IsNullConverter}}" />-->
</MenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
</StackPanel>
</spp:TitleBar.ActionContent>
</spp:TitleBar>
</MenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
</StackPanel>
</spp:TitleBar.ActionContent>
</spp:TitleBar>
<ui:NavigationView
<ui:NavigationView
Name="NavView"
Grid.RowSpan="2"
AlwaysShowHeader="False"
@@ -330,35 +332,35 @@
IsSettingsVisible="False"
MenuItemsSource="{Binding TabItems}"
PaneDisplayMode="Left">
<ui:NavigationView.Resources>
<!-- Override this -->
<Thickness x:Key="NavigationViewContentMargin">0,50,0,0</Thickness>
</ui:NavigationView.Resources>
<ui:NavigationView.Styles>
<Style Selector="Button#NavigationViewBackButton">
<Setter Property="FontFamily" Value="{DynamicResource SymbolThemeFontFamily}" />
<Setter Property="Width" Value="36" />
<Setter Property="Height" Value="36" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Content" Value="&#xF0D5;" />
</Style>
<Style Selector="Grid#PaneToggleButtonGrid">
<Setter Property="Margin" Value="5 0 0 0" />
<Setter Property="ToolTip.Tip" Value="{Binding Path=Res.Back, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Setter Property="ToolTip.Placement" Value="Bottom" />
</Style>
</ui:NavigationView.Styles>
<ui:NavigationView.MenuItemTemplate>
<DataTemplate DataType="spp:TabItemViewModel">
<ui:NavigationViewItem Classes="AppNav" Content="{Binding Name}">
<ui:NavigationViewItem.IconSource>
<!--<ui:FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{Binding IconKey, Converter={StaticResource ResourceKeyValueConverter}, ConverterParameter=fonticon}" />-->
<ui:ImageIconSource Source="{Binding IconKey, Converter={StaticResource BitmapAssetValueConverter}}" />
</ui:NavigationViewItem.IconSource>
</ui:NavigationViewItem>
</DataTemplate>
</ui:NavigationView.MenuItemTemplate>
<ui:Frame Name="FrameView" />
</ui:NavigationView>
</Grid>
<ui:NavigationView.Resources>
<!-- Override this -->
<Thickness x:Key="NavigationViewContentMargin">0,50,0,0</Thickness>
</ui:NavigationView.Resources>
<ui:NavigationView.Styles>
<Style Selector="Button#NavigationViewBackButton">
<Setter Property="FontFamily" Value="{DynamicResource SymbolThemeFontFamily}" />
<Setter Property="Width" Value="36" />
<Setter Property="Height" Value="36" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Content" Value="&#xF0D5;" />
</Style>
<Style Selector="Grid#PaneToggleButtonGrid">
<Setter Property="Margin" Value="5 0 0 0" />
<Setter Property="ToolTip.Tip" Value="{Binding Path=Res.Back, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Setter Property="ToolTip.Placement" Value="Bottom" />
</Style>
</ui:NavigationView.Styles>
<ui:NavigationView.MenuItemTemplate>
<DataTemplate DataType="spp:TabItemViewModel">
<ui:NavigationViewItem Classes="AppNav" Content="{Binding Name}">
<ui:NavigationViewItem.IconSource>
<!--<ui:FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{Binding IconKey, Converter={StaticResource ResourceKeyValueConverter}, ConverterParameter=fonticon}" />-->
<ui:ImageIconSource Source="{Binding IconKey, Converter={StaticResource BitmapAssetValueConverter}}" />
</ui:NavigationViewItem.IconSource>
</ui:NavigationViewItem>
</DataTemplate>
</ui:NavigationView.MenuItemTemplate>
<ui:Frame Name="FrameView" />
</ui:NavigationView>
</Grid>
</UserControl>
@@ -53,7 +53,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="spp:TabItemViewModel">
<Border spp:Animations.EnableAnimations="True">
<Border spp:Animations.EnableAnimations="False">
<Button
Command="{Binding $parent[spp:PluginStorePage].((spp:PluginStorePageViewModel)DataContext).NavgationToMenuPageCommand}"
CommandParameter="{Binding}"
@@ -1,7 +1,11 @@
<UserControl
d:DesignHeight="680"
d:DesignWidth="1080"
mc:Ignorable="d"
x:Class="BD.WTTS.UI.Views.Pages.Settings_UI"
x:CompileBindings="True"
x:DataType="spp:SettingsPageViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:com="https://steampp.net/common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:enum="using:BD.WTTS.Enums"
@@ -11,11 +15,7 @@
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
d:DesignHeight="680"
d:DesignWidth="1080"
x:CompileBindings="True"
x:DataType="spp:SettingsPageViewModel"
mc:Ignorable="d">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel Spacing="{StaticResource SettingsSpacing}">
<TextBlock
Margin="0,0,0,10"
@@ -82,125 +82,125 @@
<StackPanel Orientation="Horizontal" Spacing="10">
<RadioButton Content="{Binding Path=Res.Settings_UI_SystemDefault, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsChecked="{Binding Source={x:Static ms:UISettings.UseSystemThemeAccent}, Path=Value, Mode=TwoWay}" />
<RadioButton
x:Name="AccentCustom"
Content="{Binding Path=Res.Settings_UI_Custom, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsChecked="{Binding Source={x:Static ms:UISettings.UseSystemThemeAccent}, Path=!Value, Mode=OneWay}" />
IsChecked="{Binding Source={x:Static ms:UISettings.UseSystemThemeAccent}, Path=!Value, Mode=OneWay}"
x:Name="AccentCustom" />
</StackPanel>
</spp:OptionsDisplayItem.ActionButton>
<spp:OptionsDisplayItem.Content>
<StackPanel Spacing="4">
<DockPanel Margin="24,0,0,6" LastChildFill="False">
<DockPanel LastChildFill="False" Margin="24,0,0,6">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="{Binding Path=Res.Settings_UI_PreviewColor, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Text="{Binding Path=Res.Settings_UI_PreviewColor, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
<Grid
HorizontalAlignment="Left"
ColumnDefinitions="*,*"
DockPanel.Dock="Right"
HorizontalAlignment="Left"
RowDefinitions="*,*,*,*">
<Border
Background="{DynamicResource SystemAccentColor}"
Grid.ColumnSpan="2"
Height="40"
Background="{DynamicResource SystemAccentColor}">
Height="40">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="SystemAccentColor" />
HorizontalAlignment="Center"
Text="SystemAccentColor"
VerticalAlignment="Center" />
</Border>
<Border
Background="{DynamicResource SystemAccentColorLight1}"
Grid.Column="0"
Grid.Row="1"
Grid.Column="0"
Width="90"
Height="40"
Background="{DynamicResource SystemAccentColorLight1}">
Width="90">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="Light1" />
HorizontalAlignment="Center"
Text="Light1"
VerticalAlignment="Center" />
</Border>
<Border
Background="{DynamicResource SystemAccentColorLight2}"
Grid.Column="0"
Grid.Row="2"
Grid.Column="0"
Width="90"
Height="40"
Background="{DynamicResource SystemAccentColorLight2}">
Width="90">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="Light2" />
HorizontalAlignment="Center"
Text="Light2"
VerticalAlignment="Center" />
</Border>
<Border
Grid.Row="3"
Background="{DynamicResource SystemAccentColorLight3}"
Grid.Column="0"
Width="90"
Grid.Row="3"
Height="40"
Background="{DynamicResource SystemAccentColorLight3}">
Width="90">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="Light3" />
HorizontalAlignment="Center"
Text="Light3"
VerticalAlignment="Center" />
</Border>
<Border
Background="{DynamicResource SystemAccentColorDark1}"
Grid.Column="1"
Grid.Row="1"
Grid.Column="1"
Width="90"
Height="40"
Background="{DynamicResource SystemAccentColorDark1}">
Width="90">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="Dark1" />
HorizontalAlignment="Center"
Text="Dark1"
VerticalAlignment="Center" />
</Border>
<Border
Background="{DynamicResource SystemAccentColorDark2}"
Grid.Column="1"
Grid.Row="2"
Grid.Column="1"
Width="90"
Height="40"
Background="{DynamicResource SystemAccentColorDark2}">
Width="90">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="Dark2" />
HorizontalAlignment="Center"
Text="Dark2"
VerticalAlignment="Center" />
</Border>
<Border
Grid.Row="3"
Background="{DynamicResource SystemAccentColorDark3}"
Grid.Column="1"
Width="90"
Grid.Row="3"
Height="40"
Background="{DynamicResource SystemAccentColorDark3}">
Width="90">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="Dark3" />
HorizontalAlignment="Center"
Text="Dark3"
VerticalAlignment="Center" />
</Border>
</Grid>
</DockPanel>
<Border
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}"
Height="1"
Margin="-20"
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}" />
Margin="-20" />
<TextBlock Margin="24,24,0,0" Text="Windows 颜色" />
<ListBox
Name="ColorListBox"
MaxWidth="441"
Margin="24,0,24,12"
HorizontalAlignment="Left"
AutoScrollToSelectedItem="False"
HorizontalAlignment="Left"
Margin="24,0,24,12"
MaxWidth="441"
Name="ColorListBox"
SelectedItem="{Binding Source={x:Static ms:UISettings.ThemeAccent}, Converter={StaticResource ColorStringToBrushConverter}, Path=Value, Mode=TwoWay}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
@@ -218,22 +218,22 @@
<ControlTemplate>
<Panel>
<Border
Name="Root"
BorderThickness="2"
CornerRadius="{StaticResource ControlCornerRadius}">
CornerRadius="{StaticResource ControlCornerRadius}"
Name="Root">
<Border.Background>
<SolidColorBrush Color="{Binding}" />
</Border.Background>
</Border>
<Border
Name="Check"
Width="20"
Background="{DynamicResource FocusStrokeColorOuter}"
Height="20"
Margin="0,2,2,0"
HorizontalAlignment="Right"
Margin="0,2,2,0"
Name="Check"
VerticalAlignment="Top"
Background="{DynamicResource FocusStrokeColorOuter}">
Width="20">
<ui:SymbolIcon
FontSize="18"
Foreground="{DynamicResource SystemAccentColor}"
@@ -261,26 +261,17 @@
</ListBox>
<Border
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}"
Height="1"
Margin="-20"
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}" />
Margin="-20" />
<DockPanel Margin="24,6,0,0" LastChildFill="False">
<DockPanel LastChildFill="False" Margin="24,6,0,0">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="{Binding Path=Res.Settings_UI_CustomColor, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Text="{Binding Path=Res.Settings_UI_CustomColor, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
<ui:ColorPickerButton
DockPanel.Dock="Right"
IsCompact="True"
IsMoreButtonVisible="True"
ShowAcceptDismissButtons="True"
UseColorPalette="False"
UseColorTriangle="False"
UseColorWheel="False"
UseSpectrum="True"
Color="{Binding Source={x:Static ms:UISettings.ThemeAccent}, Converter={StaticResource ColorStringToBrushConverter}, Path=Value, Mode=TwoWay}" />
<ColorPicker Color="{Binding Source={x:Static ms:UISettings.ThemeAccent}, Converter={StaticResource ColorStringToBrushConverter}, Path=Value, Mode=TwoWay}" DockPanel.Dock="Right" />
</DockPanel>
</StackPanel>
</spp:OptionsDisplayItem.Content>
@@ -298,7 +289,7 @@
<ComboBox.ItemTemplate>
<DataTemplate>
<DataTemplate.DataType>
<x:Type x:TypeArguments="x:String, x:String" TypeName="generic:KeyValuePair" />
<x:Type TypeName="generic:KeyValuePair" x:TypeArguments="x:String, x:String" />
</DataTemplate.DataType>
<TextBlock Text="{Binding Value, Mode=OneWay}" />
</DataTemplate>
@@ -321,7 +312,7 @@
<ComboBox.ItemTemplate>
<DataTemplate>
<DataTemplate.DataType>
<x:Type x:TypeArguments="x:String, x:String" TypeName="generic:KeyValuePair" />
<x:Type TypeName="generic:KeyValuePair" x:TypeArguments="x:String, x:String" />
</DataTemplate.DataType>
<TextBlock FontFamily="{Binding Value, Mode=OneWay, Converter={StaticResource NameToFontFamilyConverter}}" Text="{Binding Key, Mode=OneWay}" />
</DataTemplate>
@@ -360,8 +351,8 @@
</spp:OptionsDisplayItem.Icon>
<spp:OptionsDisplayItem.ActionButton>
<Slider
MinWidth="250"
Maximum="1.0"
MinWidth="250"
Minimum="0"
Value="{Binding Value, Source={x:Static ms:UISettings.WindowBackgroundOpacity}, Mode=TwoWay}" />
</spp:OptionsDisplayItem.ActionButton>
@@ -381,72 +372,72 @@
<spp:OptionsDisplayItem.Content>
<StackPanel Spacing="4">
<DockPanel Margin="24,0,0,6" LastChildFill="False">
<DockPanel LastChildFill="False" Margin="24,0,0,6">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="{Binding Path=Res.PreviewPictures, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Text="{Binding Path=Res.PreviewPictures, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
<Image
Width="250"
DockPanel.Dock="Right"
Height="150"
HorizontalAlignment="Left"
DockPanel.Dock="Right"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="{Binding Source={x:Static ms:UISettings.WindowBackgroundCustomImagePath}, Path=Value, Mode=OneWay, Converter={StaticResource BitmapAssetValueConverter}}"
Stretch="{Binding Source={x:Static ms:UISettings.WindowBackgroundCustomImageStretch}, Path=Value, Mode=OneWay, Converter={StaticResource EnumConverter}, ConverterParameter={x:Type Stretch}}" />
Stretch="{Binding Source={x:Static ms:UISettings.WindowBackgroundCustomImageStretch}, Path=Value, Mode=OneWay, Converter={StaticResource EnumConverter}, ConverterParameter={x:Type Stretch}}"
Width="250" />
</DockPanel>
<Border
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}"
Height="1"
Margin="-20"
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}" />
Margin="-20" />
<DockPanel Margin="24,6,0,6" LastChildFill="False">
<DockPanel LastChildFill="False" Margin="24,6,0,6">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="{Binding Path=Res.Settings_UI_BackgroundImageOpacity, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Text="{Binding Path=Res.Settings_UI_BackgroundImageOpacity, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
<Slider
MinWidth="250"
DockPanel.Dock="Right"
Maximum="1.0"
MinWidth="250"
Minimum="0"
Value="{Binding Value, Source={x:Static ms:UISettings.WindowBackgroundCustomImageOpacity}, Mode=TwoWay}" />
</DockPanel>
<Border
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}"
Height="1"
Margin="-20"
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}" />
Margin="-20" />
<DockPanel Margin="24,6,0,6" LastChildFill="False">
<DockPanel LastChildFill="False" Margin="24,6,0,6">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="{Binding Path=Res.SelectPicture, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Text="{Binding Path=Res.SelectPicture, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
<Button
MinWidth="150"
Command="{Binding SelectImage_Click}"
Content="{Binding Path=Res.Settings_UI_SelectImage, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
DockPanel.Dock="Right" />
DockPanel.Dock="Right"
MinWidth="150" />
</DockPanel>
<Border
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}"
Height="1"
Margin="-20"
Background="{DynamicResource ApplicationPageBackgroundThemeBrush}" />
Margin="-20" />
<DockPanel Margin="24,6,0,0" LastChildFill="False">
<DockPanel LastChildFill="False" Margin="24,6,0,0">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="{Binding Path=Res.PictureZoom, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Text="{Binding Path=Res.PictureZoom, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
<ComboBox
MinWidth="150"
DockPanel.Dock="Right"
MinWidth="150"
SelectedItem="{Binding Source={x:Static ms:UISettings.WindowBackgroundCustomImageStretch}, Path=Value, Mode=TwoWay}">
<ComboBox.Items>
<spp:XamlMediaStretch>Fill</spp:XamlMediaStretch>
@@ -472,21 +463,21 @@
<ListBoxItem>
<Grid ColumnDefinitions="Auto,*,Auto">
<ui:ImageIcon
Width="24"
Height="24"
Margin="8"
Source="{Binding IconKey, Converter={StaticResource BitmapAssetValueConverter}}"
VerticalAlignment="Center"
Source="{Binding IconKey, Converter={StaticResource BitmapAssetValueConverter}}" />
Width="24" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{Binding Name}" />
Text="{Binding Name}"
VerticalAlignment="Center" />
<Viewbox
Grid.Column="2"
Width="18"
Height="18"
Margin="8,0"
VerticalAlignment="Center">
VerticalAlignment="Center"
Width="18">
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource Move}" />
</Viewbox>
</Grid>
@@ -190,7 +190,7 @@ public sealed class AppSplashScreen : IApplicationSplashScreen
});
AdvertiseService.Current.InitAdvertise();
await NoticeService.Current.GetNewsAsync();
NoticeService.Current.GetNews();
var mainWindow = App.Instance.MainWindow;
mainWindow.ThrowIsNull();
@@ -48,7 +48,7 @@
<ItemGroup>
<!-- PackageReference -->
<PackageReference Include="BD.Common" />
<ProjectReference Include="..\..\ref\Common\src\BD.Common\BD.Common.csproj" />
<PackageReference Include="dotnetCampus.Ipc" />
<PackageReference Include="NLog" />
<PackageReference Include="NLog.Extensions.Logging" />
@@ -92,8 +92,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BD.Common" />
<PackageReference Include="BD.Common.Repositories.SQLitePCL" />
<!--<PackageReference Include="BD.Common" />
<PackageReference Include="BD.Common.Repositories.SQLitePCL" />-->
<ProjectReference Include="..\..\ref\Common\src\BD.Common.Repositories.SQLitePCL\BD.Common.Repositories.SQLitePCL.csproj" />
<ProjectReference Include="..\..\ref\Common\src\BD.Common\BD.Common.csproj" />
<PackageReference Include="NLog" />
<PackageReference Include="System.Linq.Async" />
<PackageReference Include="Ae.DNS.Client" />
@@ -101,9 +103,9 @@
<PackageReference Include="DnsClient" />
<PackageReference Include="Yarp.ReverseProxy" />
<PackageReference Include="NLog.Web.AspNetCore" />
<PackageReference Include="Aigio.Any.AppCenter" />
<!--<PackageReference Include="Aigio.Any.AppCenter" />
<PackageReference Include="Aigio.Any.AppCenter.Analytics" />
<PackageReference Include="Aigio.Any.AppCenter.Crashes" />
<PackageReference Include="Aigio.Any.AppCenter.Crashes" />-->
<PackageReference Include="System.Drawing.Common" />
<PackageReference Include="System.Runtime.Caching" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
@@ -119,6 +121,8 @@
<ProjectReference Include="..\BD.WTTS.Client.IPC\BD.WTTS.Client.IPC.csproj" />
</ItemGroup>
<Import Project="..\OSShuttingDownHelper\OSShuttingDownHelper.projitems" Label="Shared" />
<!-- 此项目不使用平台 TFM !!! -->
<Import Project="..\TFM_NETX.props" />
@@ -1,5 +1,6 @@
using BD.Common.Repositories.Abstractions;
using dotnetCampus.Ipc.CompilerServices.GeneratedProxies;
using Windows.Win32;
using KeyValuePair = BD.Common.Entities.KeyValuePair;
const string moduleName = AssemblyInfo.Accelerator;
@@ -35,6 +36,12 @@ static bool IsProcessElevated_DEBUG_Only()
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
#endif
if (OSShuttingDownHelper.IsSystemShuttingDown())
{
return 0;
}
try
{
var exitCode = await IPCSubProcessService.MainAsync(moduleName, pluginName, ConfigureServices, static ipcProvider =>
@@ -77,7 +84,7 @@ static void ConfigureServices(IServiceCollection services)
services.AddLogging(l =>
{
l.ClearProviders();
l.AddNLog(LogManager.Configuration); // 添加 NLog 日志
l.AddNLog(LogManager.Configuration!); // 添加 NLog 日志
#if DEBUG
l.AddConsole();
#endif
@@ -30,6 +30,12 @@ sealed class HttpLocalRequestMiddleware
/// <returns></returns>
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
if (TryGetInjectScriptLocalId(context.Request.Path, out var injectScriptLid))
{
await HandleScriptRequestAsync(context, injectScriptLid);
return;
}
if (HttpMethods.IsOptions(context.Request.Method) && context.Request.Headers.ContainsKey("Access-Control-Request-Private-Network"))
{
// https://wicg.github.io/private-network-access/
@@ -60,34 +66,50 @@ sealed class HttpLocalRequestMiddleware
await HandleHttpRequestAsync(context);
return;
default: //默认处理脚本匹配
if (!int.TryParse(context.Request.Path.Value?.Trim('/'), out var lid) && lid <= 0)
{
await Handle404NotFoundAsync(context);
return;
}
// TODO: Scripts
if (reverseProxyConfig.TryGetScriptContent(lid, out string? content))
{
if (string.IsNullOrEmpty(content))
{
await Handle404NotFoundAsync(context);
return;
}
context.Response.Headers.ContentType = "text/javascript;charset=UTF-8";
await context.Response.WriteAsync(content);
return;
}
else
if (!int.TryParse(context.Request.Path.Value?.Trim('/'), out var lid) || lid <= 0)
{
await Handle404NotFoundAsync(context);
return;
}
await HandleScriptRequestAsync(context, lid);
return;
}
}
await next(context);
}
static bool TryGetInjectScriptLocalId(PathString path, out int localId)
{
localId = default;
var pathValue = path.Value;
if (string.IsNullOrEmpty(pathValue))
return false;
var prefix = IReverseProxyService.Constants.InjectScriptPathPrefix;
if (!pathValue.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
return false;
var idPart = pathValue[prefix.Length..];
if (!idPart.EndsWith(".js", StringComparison.OrdinalIgnoreCase))
return false;
idPart = idPart[..^3];
return int.TryParse(idPart, out localId) && localId > 0;
}
async Task HandleScriptRequestAsync(HttpContext context, int lid)
{
if (reverseProxyConfig.TryGetScriptContent(lid, out var content) && !string.IsNullOrEmpty(content))
{
context.Response.Headers.ContentType = "application/javascript;charset=UTF-8";
await context.Response.WriteAsync(content);
return;
}
await Handle404NotFoundAsync(context);
}
/// <summary>
/// 处理脚本所需要的 HTTP 请求
/// </summary>
@@ -90,4 +90,122 @@ partial class HttpReverseProxyMiddleware
notfound: insertPosition = -1;
return false;
}
internal static bool FindScriptInjectInsertPositionForGithub(byte[] buffer_, Encoding encoding, out ReadOnlyMemory<byte> buffer, out int insertPosition)
{
buffer = buffer_.AsMemory();
ReadOnlySpan<byte> mark = "<script"u8;
var lastScriptWithSrcStart = -1;
var span = buffer_.AsSpan();
if (span.Length >= mark.Length)
{
for (var i = 0; i <= span.Length - mark.Length; i++)
{
if (!EqualsAsciiIgnoreCase(span.Slice(i, mark.Length), mark))
{
continue;
}
var afterMarkIndex = i + mark.Length;
if (afterMarkIndex < span.Length && IsHtmlAttributeNameChar(span[afterMarkIndex]))
{
continue;
}
var tagEndOffset = span.Slice(afterMarkIndex).IndexOf((byte)'>');
if (tagEndOffset < 0)
{
break;
}
var tagEndIndex = afterMarkIndex + tagEndOffset;
var scriptTag = span.Slice(i, tagEndIndex - i + 1);
if (ScriptTagHasSrcAttribute(scriptTag))
{
lastScriptWithSrcStart = i;
}
i = tagEndIndex;
}
}
if (lastScriptWithSrcStart >= 0)
{
insertPosition = lastScriptWithSrcStart;
return true;
}
return FindScriptInjectInsertPosition(buffer_, encoding, out buffer, out insertPosition);
}
static bool ScriptTagHasSrcAttribute(ReadOnlySpan<byte> scriptTag)
{
ReadOnlySpan<byte> src = "src"u8;
if (scriptTag.Length < src.Length)
return false;
for (var i = 0; i <= scriptTag.Length - src.Length; i++)
{
if (!EqualsAsciiIgnoreCase(scriptTag.Slice(i, src.Length), src))
continue;
if (i > 0 && IsHtmlAttributeNameChar(scriptTag[i - 1]))
continue;
var j = i + src.Length;
while (j < scriptTag.Length && IsAsciiWhitespace(scriptTag[j]))
{
j++;
}
if (j < scriptTag.Length && scriptTag[j] == (byte)'=')
{
return true;
}
}
return false;
}
static bool EqualsAsciiIgnoreCase(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
{
if (left.Length != right.Length)
return false;
for (var i = 0; i < left.Length; i++)
{
var l = ToUpperAscii(left[i]);
var r = ToUpperAscii(right[i]);
if (l != r)
return false;
}
return true;
}
static byte ToUpperAscii(byte value)
{
if (value is >= (byte)'a' and <= (byte)'z')
return (byte)(value - 32);
return value;
}
static bool IsAsciiWhitespace(byte value) =>
value == (byte)' ' ||
value == (byte)'\t' ||
value == (byte)'\r' ||
value == (byte)'\n' ||
value == (byte)'\f';
static bool IsHtmlAttributeNameChar(byte value) =>
(value is >= (byte)'a' and <= (byte)'z') ||
(value is >= (byte)'A' and <= (byte)'Z') ||
(value is >= (byte)'0' and <= (byte)'9') ||
value == (byte)'-' ||
value == (byte)'_' ||
value == (byte)':' ||
value == (byte)'.';
}
@@ -327,7 +327,12 @@ Actual value was {actualValue}.
}
}
if (FindScriptInjectInsertPosition(buffer_, encoding, out var buffer, out var position))
var isGithubHost = IsGithubHost(context.Request.Host.Host);
var isFindPosition = isGithubHost
? FindScriptInjectInsertPositionForGithub(buffer_, encoding, out var buffer, out var position)
: FindScriptInjectInsertPosition(buffer_, encoding, out buffer, out position);
if (isFindPosition)
{
using var bodyWriter = new MemoryStream();
using Stream? bodyCompress = GetStreamByContentCompression(bodyWriter, contentCompression, CompressionMode.Compress, true);
@@ -350,8 +355,8 @@ Actual value was {actualValue}.
// var html_start_string = encoding.GetString(html_start.Span);
//#endif
await bodyCoreWriter.WriteAsync(html_start);
ReadOnlyMemory<byte> script_xml_start = "<script type=\"text/javascript\" src=\"https://local.steampp.net/"u8.ToArray();
ReadOnlyMemory<byte> script_xml_end = "\"></script>"u8.ToArray();
var script_xml_start = Encoding.ASCII.GetBytes($"<script type=\"text/javascript\" src=\"{IReverseProxyService.Constants.InjectScriptPathPrefix}");
ReadOnlyMemory<byte> script_xml_end = ".js\"></script>"u8.ToArray();
foreach (var script in scripts)
{
await bodyCoreWriter.WriteAsync(script_xml_start);
@@ -398,6 +403,15 @@ Actual value was {actualValue}.
context.Response.Body = originalBody;
}
}
static bool IsGithubHost(string? host)
{
if (string.IsNullOrWhiteSpace(host))
return false;
return host.Equals("github.com", StringComparison.OrdinalIgnoreCase) ||
host.EndsWith(".github.com", StringComparison.OrdinalIgnoreCase);
}
}
static Stream? GetStreamByContentCompression(Stream stream, string contentCompression, CompressionMode mode, bool leaveOpen) => contentCompression switch
@@ -154,8 +154,9 @@ abstract class ReverseProxyServiceImpl : IReverseProxySettings
{
reverseProxySettings = Serializable.DMP2<ReverseProxySettings>(reverseProxySettings_);
}
catch
catch (Exception e)
{
OnException(e);
return StartProxyResultCode.DeserializeReverseProxySettingsFail;
}
@@ -34,6 +34,11 @@ public partial interface IReverseProxyService : IDisposable
public const string LocalDomain = "local.steampp.net";
/// <summary>
/// 同源脚本注入路径前缀,避免使用外域 script src 造成页面脚本 publicPath 污染。
/// </summary>
public const string InjectScriptPathPrefix = "/WattToolkit_Inject/";
public static IPAddress DefaultProxyIp => IPAddress.Any;
}
@@ -179,7 +184,7 @@ public partial interface IReverseProxySettings
string? ServerSideProxyToken { get; set; }
}
[MP2Obj(SerializeLayout.Explicit)]
[MP2Obj(GenerateType.VersionTolerant, SerializeLayout.Explicit)]
public readonly partial record struct ReverseProxySettings(
[property: MP2Key(0)]
IReadOnlyCollection<AccelerateProjectDTO>? ProxyDomains,
@@ -74,6 +74,9 @@ partial class ProxyService
bool useDoh = ProxySettings.UseDoh.Value;
string? customDohAddres = ProxySettings.CustomDohAddres2.Value;
string? proxyToken = proxyDomains.Any_Nullable(s => s.ProxyType == ProxyType.ServerAccelerate || s.Items.Any_Nullable(x => x.ProxyType == ProxyType.ServerAccelerate)) ?
await TryRequestServerSideProxyToken() : null;
if (ProxySettings.ProxyBeforeDNSCheck.Value)
{
if (useDoh)
@@ -229,9 +232,6 @@ partial class ProxyService
}
}
string? proxyToken = proxyDomains.Any_Nullable(s => s.ProxyType == ProxyType.ServerAccelerate || s.Items.Any_Nullable(x => x.ProxyType == ProxyType.ServerAccelerate)) ?
await TryRequestServerSideProxyToken() : null;
ReverseProxySettings reverseProxySettings = new(proxyDomains, scripts,
isEnableScript, isOnlyWorkSteamBrowser, proxyPort,
proxyIp, proxyMode, isProxyGOG, onlyEnableProxyScript,
@@ -436,7 +436,7 @@ partial class ProxyService
{
public static implicit operator OperateProxyServiceResult(string error) => new(error);
public static implicit operator OperateProxyServiceResult(Exception exception) => new(null, exception);
public static implicit operator OperateProxyServiceResult(Exception exception) => new(exception.Message, exception);
/// <summary>
/// 将返回结果使用 Toast 显示并且返回当前应设置的代理状态
@@ -11,7 +11,7 @@ internal partial class GameAcceleratorSettingsContext : JsonSerializerContext
=> instance ??= new GameAcceleratorSettingsContext(ISettings.GetDefaultOptions());
}
[MPObj, MP2Obj(SerializeLayout.Explicit)]
[MP2Obj(SerializeLayout.Explicit)]
public sealed partial class GameAcceleratorSettings_ : ISettings, ISettings<GameAcceleratorSettings_>
{
public const string Name = nameof(GameAcceleratorSettings);
@@ -1,6 +1,6 @@
using Avalonia.Controls;
using Avalonia.Platform.Storage;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using BD.WTTS.Helpers;
namespace BD.WTTS.UI.Views.Controls;
@@ -1,6 +1,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Controls;
@@ -1,7 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using System.CommandLine;
namespace BD.WTTS.UI.Views.Controls;
@@ -1,6 +1,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Controls;
@@ -1,4 +1,4 @@
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -31,7 +31,7 @@
</ItemsRepeater.Layout>
<ItemsRepeater.ItemTemplate>
<DataTemplate DataType="spp:ScriptDTO">
<Border spp:Animations.EnableAnimations="True">
<Border spp:Animations.EnableAnimations="False">
<spp:AppItem
Title="{Binding Name}"
MaxWidth="135"
@@ -1,4 +1,4 @@
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -135,10 +135,6 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Settings\" />
</ItemGroup>
<Import Project="..\TFM_NETX_WITH_DESKTOP.props" />
</Project>
@@ -1,6 +1,6 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using BD.WTTS.UI.Views.Controls;
namespace BD.WTTS.UI.Views.Pages;
@@ -98,10 +98,6 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>
<!--<Import Project="..\TFM_NETX_WITH_ALL.props" />-->
<Import Project="..\TFM_NETX_WITH_DESKTOP.props" />
@@ -1,4 +1,4 @@
using Avalonia.Gif;
using BD.Avalonia8.Image2;
using BD.WTTS.UI.Views.Pages;
using System.Threading;
@@ -21,7 +21,7 @@
<Border
Width="200"
Margin="3"
spp:Animations.EnableAnimations="True">
spp:Animations.EnableAnimations="False">
<spp:AppItem
Title="{Binding Name}"
Classes="Vertical"
@@ -1,7 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using BD.WTTS.UI.Views.Controls;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Media.Animation;
@@ -1,7 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -1,6 +1,6 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using BD.WTTS.UI.Views.Controls;
using KeyEventArgs = Avalonia.Input.KeyEventArgs;
@@ -103,10 +103,4 @@
<Import Project="..\TFM_NETX_WITH_DESKTOP.props" />
<ProjectExtensions>
<VisualStudio>
<UserProperties />
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -1,8 +1,10 @@
namespace BD.WTTS.Models;
[MessagePackObjectAttribute]
[MP2Obj(SerializeLayout.Explicit)]
public partial class PlatformSettings : BaseNotifyPropertyChanged
{
[MessagePack.Key(0)]
[Reactive, MP2Key(0)]
public string? PlatformPath { get; set; }
}
@@ -9,7 +9,7 @@
"PlatformIds": [ "e", "epg", "epic", "epicgames" ],
"ExesToEnd": [ "EpicGamesLauncher.exe" ],
"LoginFiles": {
"%LocalAppData%\\EpicGamesLauncher\\Saved\\Config\\Windows\\GameUserSettings.ini": "GameUserSettings.ini",
"%LocalAppData%\\EpicGamesLauncher\\Saved\\Config\\WindowsEditor\\GameUserSettings.ini": "GameUserSettings.ini",
"REG:HKCU\\Software\\Epic Games\\Unreal Engine\\Identifiers:AccountId": "UNIQUE_ID"
},
"ClearPaths": [ "SAME_AS_LOGIN_FILES" ],
@@ -211,7 +211,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="spp:IAccount">
<Border Margin="5" spp:Animations.EnableAnimations="True">
<Border Margin="5" spp:Animations.EnableAnimations="False">
<spp:AppItem
x:Name="Item"
Title="{Binding DisplayName}"
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using BD.SteamClient.Helpers;
using FluentAvalonia.UI.Controls;
@@ -1,21 +1,21 @@
<spp:PageBase
Description="{Binding Description, Source={x:Static s:Plugin.Instance}, Mode=OneWay}"
Subtitle="{Binding Author, Source={x:Static s:Plugin.Instance}, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter=Plugin_Author}"
Title="{Binding Name, Source={x:Static s:Plugin.Instance}, Mode=OneWay}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="BD.WTTS.UI.Views.Pages.GameAccountPage"
x:CompileBindings="True"
x:DataType="spp:GameAccountPageViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ms="https://steampp.net/settings"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
Title="{Binding Name, Source={x:Static s:Plugin.Instance}, Mode=OneWay}"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="spp:GameAccountPageViewModel"
Description="{Binding Description, Source={x:Static s:Plugin.Instance}, Mode=OneWay}"
Subtitle="{Binding Author, Source={x:Static s:Plugin.Instance}, Mode=OneWay, Converter={StaticResource StringFormatConverter}, ConverterParameter=Plugin_Author}"
mc:Ignorable="d">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<spp:PageBase.PreviewImage>
<ui:ImageIconSource Source="{Binding Icon, Source={x:Static s:Plugin.Instance}, Mode=OneWay, Converter={StaticResource BitmapAssetValueConverter}}" />
</spp:PageBase.PreviewImage>
@@ -34,97 +34,97 @@
<spp:PageBase.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="2">
<Button
Padding="8,4"
Command="{Binding LoginNewCommand}"
DockPanel.Dock="Right"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Add" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Path=Res.UserChange_LoginNewAccount, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Margin="28,4,0,4"
Text="{Binding Path=Res.UserChange_LoginNewAccount, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<Button
Padding="8,4"
Command="{Binding SaveCurrentUserCommand}"
DockPanel.Dock="Right"
IsVisible="{Binding !IsSelectedSteam}"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Save" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Path=Res.GameAccount_SaveCurrentAccount, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Margin="28,4,0,4"
Text="{Binding Path=Res.GameAccount_SaveCurrentAccount, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<!-- <Button -->
<!-- Command="{Binding ShareManageCommand}" -->
<!-- DockPanel.Dock="Right" -->
<!-- IsVisible="{Binding IsSelectedSteam}" -->
<!-- Padding="8,4" -->
<!-- Theme="{StaticResource TransparentButton}"> -->
<!-- <Panel> -->
<!-- <Viewbox -->
<!-- Height="16" -->
<!-- HorizontalAlignment="Left" -->
<!-- Width="16"> -->
<!-- <ui:SymbolIcon Symbol="ShareAndroid" /> -->
<!-- </Viewbox> -->
<!-- <TextBlock -->
<!-- HorizontalAlignment="Left" -->
<!-- Margin="28,4,0,4" -->
<!-- Text="{Binding Path=Res.AccountChange_Title, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" -->
<!-- VerticalAlignment="Center" /> -->
<!-- </Panel> -->
<!-- </Button> -->
<Button
Padding="8,4"
Command="{Binding ShareManageCommand}"
DockPanel.Dock="Right"
IsVisible="{Binding IsSelectedSteam}"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
<ui:SymbolIcon Symbol="ShareAndroid" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Path=Res.AccountChange_Title, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</Panel>
</Button>
<Button
Padding="8,4"
Command="{Binding RefreshCommand}"
DockPanel.Dock="Right"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Refresh" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding Path=Res.Refresh, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Margin="28,4,0,4"
Text="{Binding Path=Res.Refresh, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<DropDownButton
Padding="8"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{StaticResource More}"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="20"
Theme="{StaticResource TransparentButton}">
HorizontalContentAlignment="Center"
Padding="8"
Theme="{StaticResource TransparentButton}"
VerticalContentAlignment="Center">
<DropDownButton.Flyout>
<ui:FAMenuFlyout Placement="BottomEdgeAlignedRight">
<ui:MenuFlyoutItem
x:Name="PlatformSettingButton"
IsVisible="{Binding !IsSelectedSteam}"
Text="平台设置" />
Text="平台设置"
x:Name="PlatformSettingButton" />
<!--<ui:MenuFlyoutItem x:Name="PluginSettingButton" Text="{Binding Path=Res.Settings_Plugin, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />-->
<ui:ToggleMenuFlyoutItem
IsChecked="{Binding Source={x:Static ms:GameAccountSettings.IsShowAccountName}, Path=Value, Mode=TwoWay}"
@@ -154,23 +154,23 @@
</StackPanel>
</spp:PageBase.ActionContent>
<ui:TabView
Padding="0"
VerticalAlignment="Stretch"
Background="Transparent"
CloseButtonOverlayMode="OnPointerOver"
IsAddTabButtonVisible="False"
Padding="0"
SelectedItem="{Binding SelectedPlatform}"
SelectionChanged="TabView_SelectedItemChanged"
TabCloseRequested="TabView_TabCloseRequested"
TabItems="{Binding GamePlatforms}"
TabWidthMode="Equal">
TabWidthMode="Equal"
VerticalAlignment="Stretch">
<ui:TabView.TabStripFooter>
<Button
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="&#xE710;"
FontFamily="{StaticResource SymbolThemeFontFamily}"
Theme="{StaticResource TabViewButtonStyle}">
HorizontalAlignment="Left"
Theme="{StaticResource TabViewButtonStyle}"
VerticalAlignment="Center">
<Button.Flyout>
<MenuFlyout Placement="BottomEdgeAlignedLeft">
<MenuItem
@@ -178,7 +178,7 @@
IsVisible="{Binding !!AddGamePlatforms.Count}"
ItemsSource="{Binding AddGamePlatforms}">
<MenuItem.Styles>
<Style x:DataType="spp:PlatformAccount" Selector="MenuItem">
<Style Selector="MenuItem" x:DataType="spp:PlatformAccount">
<Setter Property="Header" Value="{Binding FullName}" />
<Setter Property="Icon">
<Setter.Value>
@@ -239,7 +239,7 @@
</Button>
</ui:TabView.TabStripFooter>
<ui:TabView.Styles>
<Style x:DataType="spp:PlatformAccount" Selector="ui|TabViewItem">
<Style Selector="ui|TabViewItem" x:DataType="spp:PlatformAccount">
<!--<Setter Property="IconSource">
<ui:FontIconSource Glyph="{Binding Icon}" />
</Setter>-->
@@ -255,14 +255,14 @@
<DataTemplate DataType="spp:PlatformAccount">
<DockPanel>
<PathIcon
Width="16"
Data="{Binding Icon, Converter={StaticResource ResourceKeyValueConverter}}"
DockPanel.Dock="Left"
Height="16"
Margin="0,0,8,0"
Data="{Binding Icon, Converter={StaticResource ResourceKeyValueConverter}}"
DockPanel.Dock="Left" />
Width="16" />
<TextBlock DockPanel.Dock="Right" Text="{Binding FullName}" />
</DockPanel>
</DataTemplate>
</ui:TabView.TabItemTemplate>
</ui:TabView>
</spp:PageBase>
</spp:PageBase>
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -122,7 +122,7 @@ public sealed class EditAppInfoPageViewModel : WindowViewModel
#region 自定义图片保存
//var mostRecentUser = ISteamService.Instance.GetRememberUserList().Where(s => s.MostRecent).FirstOrDefault();
var mostRecentUser = SteamConnectService.Current.SteamUsers.Items.Where(s => s.MostRecent).FirstOrDefault();
if (!(App.EditHeaderLogoStream is FileStream fs3 && fs3.Name == (await App.HeaderLogoStream)?.Name))
if (!(App.EditHeaderLogoStream is FileStream fs3 && (await App.HeaderLogoStream) is FileStream headerLogoStream && fs3.Name == headerLogoStream.Name))
{
if (!CheckCurrentSteamUserStats(mostRecentUser))
return;
@@ -135,7 +135,7 @@ public sealed class EditAppInfoPageViewModel : WindowViewModel
else
this.RaisePropertyChanged(nameof(App.HeaderLogoStream));
}
if (!(App.EditLibraryLogoStream is FileStream fs && fs.Name == (await App.LibraryLogoStream)?.Name))
if (!(App.EditLibraryLogoStream is FileStream fs && (await App.LibraryLogoStream) is FileStream libraryLogoStream && fs.Name == libraryLogoStream.Name))
{
if (!CheckCurrentSteamUserStats(mostRecentUser))
return;
@@ -148,7 +148,7 @@ public sealed class EditAppInfoPageViewModel : WindowViewModel
else
this.RaisePropertyChanged(nameof(App.LibraryLogoStream));
}
if (!(App.EditLibraryHeroStream is FileStream fs1 && fs1.Name == (await App.LibraryHeroStream)?.Name))
if (!(App.EditLibraryHeroStream is FileStream fs1 && (await App.LibraryHeroStream) is FileStream libraryHeroStream && fs1.Name == libraryHeroStream.Name))
{
if (!CheckCurrentSteamUserStats(mostRecentUser))
return;
@@ -161,7 +161,7 @@ public sealed class EditAppInfoPageViewModel : WindowViewModel
else
this.RaisePropertyChanged(nameof(App.LibraryHeroStream));
}
if (!(App.EditLibraryGridStream is FileStream fs2 && fs2.Name == (await App.LibraryGridStream)?.Name))
if (!(App.EditLibraryGridStream is FileStream fs2 && (await App.LibraryGridStream) is FileStream libraryGridStream && fs2.Name == libraryGridStream.Name))
{
if (!CheckCurrentSteamUserStats(mostRecentUser))
return;
@@ -246,16 +246,16 @@ public sealed class EditAppInfoPageViewModel : WindowViewModel
switch (type)
{
case SteamGridItemType.Header:
App.EditHeaderLogoStream = (await App.HeaderLogoStream)?.Stream;
App.EditHeaderLogoStream = (await App.HeaderLogoStream);
break;
case SteamGridItemType.Grid:
App.EditLibraryGridStream = (await App.LibraryGridStream)?.Stream;
App.EditLibraryGridStream = (await App.LibraryGridStream);
break;
case SteamGridItemType.Hero:
App.EditLibraryHeroStream = (await App.LibraryHeroStream)?.Stream;
App.EditLibraryHeroStream = (await App.LibraryHeroStream);
break;
case SteamGridItemType.Logo:
App.EditLibraryLogoStream = (await App.LibraryLogoStream)?.Stream;
App.EditLibraryLogoStream = (await App.LibraryLogoStream);
break;
}
return;
@@ -16,6 +16,9 @@ public sealed class EditAppsPageViewModel : ViewModelBase
public bool IsSteamEditedAppsEmpty => !SteamEditedApps.Any_Nullable();
[Reactive]
public bool IsExportingBackup { get; set; }
public ICommand EditAppInfoClickCommand { get; }
public EditAppsPageViewModel()
@@ -56,6 +59,114 @@ public sealed class EditAppsPageViewModel : ViewModelBase
}
}
public async Task ExportSteamEditedAppsBackup()
{
if (IsExportingBackup)
{
return;
}
if (!SteamEditedApps.Any())
{
Toast.Show(ToastIcon.Warning, "没有可导出的已修改游戏数据。");
return;
}
var result = await FilePicker2.SaveAsync(new PickOptions
{
PickerTitle = "导出编辑游戏数据备份",
InitialFileName = $"steam-edited-apps-{DateTime.Now:yyyyMMddHHmmss}.stmbak",
});
if (result == null)
{
return;
}
try
{
IsExportingBackup = true;
var exportData = await Task.Run(async () =>
{
var stmService = ISteamService.Instance;
var applist = await stmService.GetAppInfos(true);
var editApps = SteamConnectService.Current.SteamApps.Items
.Where(s => s.IsEdited)
.ToDictionary(s => s.AppId, s => s);
var modifiedApps = new List<ModifiedApp>();
foreach (var app in applist)
{
if (editApps.TryGetValue(app.AppId, out var editApp))
{
app.SetEditProperty(editApp);
modifiedApps.Add(new ModifiedApp(app));
}
}
return (ModifiedApps: modifiedApps, Bytes: Serializable.SMP(modifiedApps));
});
if (!exportData.ModifiedApps.Any())
{
Toast.Show(ToastIcon.Error, "导出失败:没有可序列化的修改数据。");
return;
}
using var stream = result.OpenWrite();
await stream.WriteAsync(exportData.Bytes, 0, exportData.Bytes.Length);
await stream.FlushAsync();
Toast.Show(ToastIcon.Success, $"导出成功,共 {exportData.ModifiedApps.Count} 条修改数据。");
}
catch
{
Toast.Show(ToastIcon.Error, "导出失败,请检查文件权限后重试。");
}
finally
{
IsExportingBackup = false;
}
}
public async Task ImportSteamEditedAppsBackup()
{
var file = await FilePicker2.PickAsync(new PickOptions
{
PickerTitle = "导入编辑游戏数据备份",
});
if (file == null)
{
return;
}
try
{
await using var stream = await file.OpenReadAsync();
var modifiedApps = Serializable.DMP<List<ModifiedApp>>(stream);
if (!modifiedApps.Any_Nullable())
{
Toast.Show(ToastIcon.Warning, "导入文件中没有可还原的数据。");
return;
}
var applyCount = SteamConnectService.Current.ApplyModifiedApps(modifiedApps);
if (applyCount <= 0)
{
Toast.Show(ToastIcon.Warning, "导入完成,但未匹配到可还原的游戏。\n请确认账号或游戏库与备份来源一致。");
return;
}
this.RaisePropertyChanged(nameof(IsSteamEditedAppsEmpty));
Toast.Show(ToastIcon.Success, $"导入成功,已还原 {applyCount} 个游戏的修改数据。");
}
catch
{
Toast.Show(ToastIcon.Error, "导入失败,文件格式可能不正确。");
}
}
//public async Task ClearSteamEditedApps()
//{
// if (await MessageBox.ShowAsync("确定要重置所有的已修改数据吗?(该操作不可还原)", AssemblyInfo.Trademark, MessageBox.Button.OKCancel) == MessageBox.Result.OK)
@@ -200,10 +200,32 @@ public sealed class AchievementAppPageViewModel : WindowViewModel
continue;
}
var rawType = stat["type_int"].Valid
? stat["type_int"].AsInteger(0)
: stat["type"].AsInteger(0);
var type = (UserStatType)rawType;
UserStatType type;
// schema in the new format
var typeNode = stat["type"];
if (typeNode.Valid == true && typeNode.Type == KeyValueType.String)
{
if (Enum.TryParse((string)typeNode.Value, true, out type) == false)
{
type = UserStatType.Invalid;
}
}
else
{
type = UserStatType.Invalid;
}
// schema in the old format
if (type == UserStatType.Invalid)
{
var typeIntNode = stat["type_int"];
var rawType = typeIntNode.Valid == true
? typeIntNode.AsInteger(0)
: typeNode.AsInteger(0);
type = (UserStatType)rawType;
}
switch (type)
{
case UserStatType.Invalid:
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -221,6 +221,7 @@
FileStream="{Binding App.EditHeaderLogoStream, Mode=TwoWay}">
<spp:Image2
DecodeHeight="260"
KeepSourceStreamOpen="True"
Source="{Binding App.EditHeaderLogoStream}"
Stretch="Uniform" />
</spp:CustomFilePicker>
@@ -275,6 +276,7 @@
FileStream="{Binding App.EditLibraryGridStream, Mode=TwoWay}">
<spp:Image2
DecodeHeight="260"
KeepSourceStreamOpen="True"
Source="{Binding App.EditLibraryGridStream}"
Stretch="Uniform" />
</spp:CustomFilePicker>
@@ -329,6 +331,7 @@
FileStream="{Binding App.EditLibraryHeroStream, Mode=TwoWay}">
<spp:Image2
DecodeHeight="260"
KeepSourceStreamOpen="True"
Source="{Binding App.EditLibraryHeroStream}"
Stretch="Uniform" />
</spp:CustomFilePicker>
@@ -381,6 +384,7 @@
FileStream="{Binding App.EditLibraryLogoStream, Mode=TwoWay}">
<spp:Image2
DecodeWidth="220"
KeepSourceStreamOpen="True"
Source="{Binding App.EditLibraryLogoStream}"
Stretch="Uniform" />
</spp:CustomFilePicker>
@@ -1,6 +1,6 @@
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using Avalonia.VisualTree;
using BD.SteamClient.Enums.SteamGridDB;
using BD.SteamClient.Models.SteamGridDB;
@@ -67,6 +67,18 @@
Theme="{StaticResource TransparentButton}">
<DropDownButton.Flyout>
<ui:FAMenuFlyout Placement="BottomEdgeAlignedRight">
<ui:MenuFlyoutItem
Command="{Binding ExportSteamEditedAppsBackup}"
IsEnabled="{Binding !IsExportingBackup}"
Text="{Binding Path=Res.Export,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem
Command="{Binding ImportSteamEditedAppsBackup}"
Text="{Binding Path=Res.Import,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutSeparator />
<!--<ui:MenuFlyoutItem
Command="{Binding DeleteAllButton_Click}"
IconSource="Delete"
@@ -100,88 +112,76 @@
IsLoading="false"
IsShowNoResultText="{Binding !!!SteamEditedApps.Count, Mode=OneWay}"
NoResultMessage="{Binding Path=Res.SaveEditedAppInfo_AppsEmpty, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ItemsControl ItemsSource="{Binding SteamEditedApps}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<ui:ItemsRepeater ItemsSource="{Binding SteamEditedApps}">
<ui:ItemsRepeater.Layout>
<ui:UniformGridLayout
ItemsJustification="Start"
ItemsStretch="Uniform"
MinColumnSpacing="10"
MinItemHeight="310"
MinItemWidth="150"
MinRowSpacing="10" />
</ui:ItemsRepeater.Layout>
<ui:ItemsRepeater.ItemTemplate>
<DataTemplate DataType="spp:SteamApp">
<Border Margin="5" spp:Animations.EnableAnimations="True">
<spp:AppItem
Title="{Binding DisplayName}"
Height="270"
MaxWidth="120"
Classes="Vertical"
ClickCommand="{Binding $parent[spp:PageBase].((spp:EditAppsPageViewModel)DataContext).EditAppInfoClickCommand}"
ClickCommandParameter="{Binding}"
Cursor="Hand">
<spp:AppItem.Status>
<Border Classes="Status">
<TextBlock Text="{Binding Path=Res.Edit, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<spp:AppItem
Title="{Binding DisplayName}"
Classes="Vertical"
ClickCommand="{Binding $parent[spp:PageBase].((spp:EditAppsPageViewModel)DataContext).EditAppInfoClickCommand}"
ClickCommandParameter="{Binding}"
Cursor="Hand">
<spp:AppItem.Status>
<Border Classes="Status">
<TextBlock Text="{Binding Path=Res.Edit, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</Border>
</spp:AppItem.Status>
<spp:AppItem.Image>
<Panel Width="{Binding $parent[spp:AppItem].Bounds.Width}">
<spp:Image2
Name="AppImage"
DecodeWidth="120"
FallbackSource="avares://BD.WTTS.Client.Plugins.GameList/UI/Assets/defaultappimage.png"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="{Binding LibraryGridStream^}"
Stretch="UniformToFill" />
<TextBlock
Margin="8,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
IsVisible="{Binding #AppImage.IsFailed}"
Text="{Binding DisplayName}"
TextAlignment="Center"
TextWrapping="WrapWithOverflow"
Theme="{StaticResource BodyStrongTextBlockStyle}" />
<Border
Margin="10,0,10,-3"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Background="#3D4450"
CornerRadius="3"
IsVisible="{Binding IsInstalled}">
<DockPanel Margin="10,3" HorizontalAlignment="Center">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
FontSize="11"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
IsVisible="{Binding InstalledDrive, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}"
Text="{Binding InstalledDrive}" />
<TextBlock
VerticalAlignment="Center"
FontSize="11"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Text="{Binding SizeOnDisk, Converter={StaticResource StringFormatConverter}, ConverterParameter=size}"
TextWrapping="Wrap" />
</DockPanel>
</Border>
</spp:AppItem.Status>
<!--<spp:AppItem.ActionButton>
<Button
Command="{Binding $parent[spp:PageBase].((spp:EditAppsPageViewModel)DataContext).DeleteButtonCommand}"
CommandParameter="{Binding}"
Cursor="Hand"
ToolTip.Tip="{Binding Path=Res.GameList_RemoveItemBtn, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Viewbox>
<ui:SymbolIcon Symbol="Delete" />
</Viewbox>
</Button>
</spp:AppItem.ActionButton>-->
<spp:AppItem.Image>
<Panel MinWidth="{Binding $parent[spp:AppItem].MinWidth}" MaxWidth="{Binding $parent[spp:AppItem].MaxWidth}">
<spp:Image2
Name="AppImage"
DecodeWidth="120"
FallbackSource="avares://BD.WTTS.Client.Plugins.GameList/UI/Assets/defaultappimage.png"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="{Binding LibraryGridStream^}"
Stretch="UniformToFill" />
<TextBlock
Margin="8,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
IsVisible="{Binding #AppImage.IsFailed}"
Text="{Binding DisplayName}"
TextAlignment="Center"
TextWrapping="WrapWithOverflow"
Theme="{StaticResource BodyStrongTextBlockStyle}" />
<Border
Margin="10,0,10,-3"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Background="#3D4450"
CornerRadius="3"
IsVisible="{Binding IsInstalled}">
<DockPanel Margin="10,3" HorizontalAlignment="Center">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
FontSize="11"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
IsVisible="{Binding InstalledDrive, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}"
Text="{Binding InstalledDrive}" />
<TextBlock
VerticalAlignment="Center"
FontSize="11"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Text="{Binding SizeOnDisk, Converter={StaticResource StringFormatConverter}, ConverterParameter=size}"
TextWrapping="Wrap" />
</DockPanel>
</Border>
</Panel>
</spp:AppItem.Image>
</spp:AppItem>
</Border>
</Panel>
</spp:AppItem.Image>
</spp:AppItem>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ui:ItemsRepeater.ItemTemplate>
</ui:ItemsRepeater>
</spp:ContentLoader>
</spp:PageBase>
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -139,7 +139,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="spp:SteamApp">
<Border Margin="5" spp:Animations.EnableAnimations="True">
<Border Margin="5" spp:Animations.EnableAnimations="False">
<spp:AppItem
Title="{Binding DisplayName}"
Height="270"
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Windows;
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Windows;
@@ -100,7 +100,7 @@
</ControlTheme>
</ScrollViewer.Resources>
<WrapPanel>
<Border spp:Animations.EnableAnimations="True">
<Border spp:Animations.EnableAnimations="False">
<Button
Click="GameToolsPage_Click"
IsEnabled="{spp:OnPlatform Windows}"
@@ -130,7 +130,7 @@
</Button>
</Border>
<Border spp:Animations.EnableAnimations="True">
<Border spp:Animations.EnableAnimations="False">
<Button
Click="GameToolsPage_Click"
IsEnabled="{spp:OnPlatform Windows}"
@@ -160,7 +160,7 @@
</Button>
</Border>
<Border spp:Animations.EnableAnimations="True">
<Border spp:Animations.EnableAnimations="False">
<Button
Click="GameToolsPage_Click"
IsEnabled="{spp:OnPlatform Windows}"
@@ -5,6 +5,9 @@ namespace BD.WTTS.Models;
public class IdleApp : ReactiveObject
{
private bool isBlacklisted;
private bool isPrivateGame;
public SteamApp App { get; }
public Badge Badge { get; }
@@ -45,6 +48,50 @@ public class IdleApp : ReactiveObject
}
}
public bool IsBlacklisted
{
get => isBlacklisted;
set
{
if (isBlacklisted != value)
{
this.RaiseAndSetIfChanged(ref isBlacklisted, value);
this.RaisePropertyChanged(nameof(IsExcludedFromIdle));
this.RaisePropertyChanged(nameof(ExcludedReasonText));
}
}
}
public bool IsPrivateGame
{
get => isPrivateGame;
set
{
if (isPrivateGame != value)
{
this.RaiseAndSetIfChanged(ref isPrivateGame, value);
this.RaisePropertyChanged(nameof(IsExcludedFromIdle));
this.RaisePropertyChanged(nameof(ExcludedReasonText));
}
}
}
public bool IsExcludedFromIdle => IsBlacklisted || IsPrivateGame;
public string ExcludedReasonText
{
get
{
if (IsPrivateGame && IsBlacklisted)
return "私密游戏(不掉卡) + 已拉黑";
if (IsPrivateGame)
return "私密游戏(不掉卡)";
if (IsBlacklisted)
return "已拉黑";
return string.Empty;
}
}
public IdleApp(Badge badge)
{
Badge = badge;
@@ -55,6 +55,11 @@ public partial interface ISteamIdleSettings
/// </summary>
double RefreshBadgesTime { get; set; }
/// <summary>
/// 挂卡黑名单游戏列表
/// </summary>
Dictionary<uint, string?>? BlacklistAppList { get; set; }
/// <summary>
/// 挂卡状态更新时间的默认值
/// </summary>
@@ -90,4 +95,9 @@ public partial interface ISteamIdleSettings
/// </summary>
static readonly double DefaultRefreshBadgesTime = 6;
/// <summary>
/// 挂卡黑名单游戏列表的默认值
/// </summary>
static readonly Dictionary<uint, string?> DefaultBlacklistAppList = [];
}
@@ -85,6 +85,12 @@ public sealed partial class SteamIdleSettings_ : ISteamIdleSettings, ISettings,
[MPKey(6), MP2Key(6), JsonPropertyOrder(6)]
public double RefreshBadgesTime { get; set; } = ISteamIdleSettings.DefaultRefreshBadgesTime;
/// <summary>
/// 挂卡黑名单游戏列表
/// </summary>
[MPKey(7), MP2Key(7), JsonPropertyOrder(7)]
public Dictionary<uint, string?>? BlacklistAppList { get; set; } = ISteamIdleSettings.DefaultBlacklistAppList;
}
public static partial class SteamIdleSettings
@@ -131,4 +137,10 @@ public static partial class SteamIdleSettings
public static SettingsStructProperty<double, SteamIdleSettings_> RefreshBadgesTime { get; }
= new(DefaultRefreshBadgesTime);
/// <summary>
/// 挂卡黑名单游戏列表
/// </summary>
public static SettingsProperty<uint, string?, Dictionary<uint, string?>, SteamIdleSettings_> BlacklistAppList { get; }
= new(DefaultBlacklistAppList);
}
@@ -30,6 +30,7 @@ public sealed partial class IdleCardPageViewModel
});
this.PriorityRunIdle = ReactiveCommand.CreateFromTask<IdleApp>(PriorityRunIdleGame);
this.ToggleBlacklistIdle = ReactiveCommand.CreateFromTask<IdleApp>(ToggleBlacklistIdleGame);
this.IdleRunStartOrStop = ReactiveCommand.Create(IdleRunStartOrStop_Click);
this.IdleManualRunNext = ReactiveCommand.CreateFromTask(ManualRunNext);
this.LoginSteamCommand = ReactiveCommand.Create(async () =>
@@ -175,16 +176,52 @@ public sealed partial class IdleCardPageViewModel
/// <returns></returns>
public async Task PriorityRunIdleGame(IdleApp idleApp)
{
if (idleApp.IsExcludedFromIdle)
{
Toast.Show(ToastIcon.Warning, "该游戏已被排除,不参与挂卡。请先取消拉黑或移除私密限制。");
return;
}
using (await asyncLock.LockAsync())
{
StopIdle();
PauseAutoNext(true);
StartSoloIdle(idleApp);
CurrentIdleIndex = IdleGameList.IndexOf(idleApp);
CurrentIdleIndex = GetRunnableIdleGames().IndexOf(idleApp);
ChangeRunTxt();
}
}
public async Task ToggleBlacklistIdleGame(IdleApp idleApp)
{
using (await asyncLock.LockAsync())
{
var blackList = SteamIdleSettings.BlacklistAppList.Value ?? [];
if (blackList.ContainsKey(idleApp.AppId))
blackList.Remove(idleApp.AppId);
else
blackList[idleApp.AppId] = idleApp.AppName;
SteamIdleSettings.BlacklistAppList.Value = blackList;
var wasRun = RunState;
if (wasRun)
{
StopIdle();
PauseAutoNext(true);
ResetCurrentIdle();
}
SteamAppsSort();
if (wasRun)
{
StartIdle();
ChangeRunTxt();
}
}
}
#region PrivateFields
/// <summary>
@@ -212,6 +249,8 @@ public sealed partial class IdleCardPageViewModel
/// </summary>
private bool IsReloaded;
private HashSet<uint> PrivateGameAppIds = [];
#endregion
#region Private Method
@@ -375,6 +414,7 @@ public sealed partial class IdleCardPageViewModel
HandleBadges:
Badges.Clear();
Badges.Add(badges!);
//await RefreshPrivateGameAppIds(steam_id);
TotalCardsRemaining = 0;
TotalCardsAvgPrice = 0;
@@ -382,6 +422,9 @@ public sealed partial class IdleCardPageViewModel
foreach (var badge in badges)
{
if (IsExcludedApp(badge.AppId))
continue;
TotalCardsAvgPrice += badge.RegularAvgPrice * badge.CardsRemaining;
TotalCardsRemaining += badge.CardsRemaining;
}
@@ -403,7 +446,21 @@ public sealed partial class IdleCardPageViewModel
IdleSequentital.Mostcards => badges.OrderByDescending(o => o.CardsRemaining).Select(s => new IdleApp(s)),
IdleSequentital.Mostvalue => badges.OrderByDescending(o => o.RegularAvgPrice).Select(s => new IdleApp(s)),
_ => badges.Select(s => new IdleApp(s)),
}).ToImmutableList();
}).ToList();
foreach (var app in apps)
{
app.IsPrivateGame = PrivateGameAppIds.Contains(app.AppId);
app.IsBlacklisted = IsBlacklistedApp(app.AppId);
}
ExcludedPrivateGameCount = apps.Count(x => x.IsPrivateGame);
ExcludedBlacklistGameCount = apps.Count(x => x.IsBlacklisted);
HasPrivateGameExcluded = ExcludedPrivateGameCount > 0;
PrivateGameExcludeTip = HasPrivateGameExcluded
? $"检测到 {ExcludedPrivateGameCount} 个私密游戏,这些游戏将自动排除,不参与挂卡。"
: string.Empty;
Dispatcher.UIThread.Invoke(() =>
{
IdleGameList.Clear();
@@ -418,6 +475,48 @@ public sealed partial class IdleCardPageViewModel
}
}
private bool IsBlacklistedApp(uint appId)
{
var blackList = SteamIdleSettings.BlacklistAppList.Value;
return blackList != null && blackList.ContainsKey(appId);
}
private bool IsExcludedApp(uint appId)
{
return PrivateGameAppIds.Contains(appId) || IsBlacklistedApp(appId);
}
private async Task RefreshPrivateGameAppIds(string steamId)
{
try
{
var (appIds, status) = await IdleCard.GetPrivateGameAppIdsAsync(steamId);
if (status == HttpStatusCode.OK)
{
PrivateGameAppIds = appIds.Count > 0 ? appIds.ToHashSet() : [];
}
else
{
PrivateGameAppIds.Clear();
}
}
catch (Exception ex)
{
ex.LogAndShowT();
PrivateGameAppIds.Clear();
}
}
private List<IdleApp> GetRunnableIdleGames()
{
return IdleGameList.Where(x => !x.IsExcludedFromIdle).ToList();
}
private int GetRunnableCardsRemaining()
{
return GetRunnableIdleGames().Sum(s => s.Badge.CardsRemaining);
}
private async Task<bool> ReadyToGoIdle(bool isFirstStart = false)
{
ResetCurrentIdle();
@@ -438,8 +537,9 @@ public sealed partial class IdleCardPageViewModel
private void StartIdle(bool isNext = false)
{
IdleApp idleApp;
var runnableGames = GetRunnableIdleGames();
if (!IdleGameList.Any())
if (!runnableGames.Any())
{
IdleComplete();
return;
@@ -447,9 +547,9 @@ public sealed partial class IdleCardPageViewModel
if (SteamIdleSettings.IdleRule.Value == IdleRule.FastMode)
{
var multi = IdleGameList.Where(z => z.Badge.HoursPlayed >= SteamIdleSettings.MinRunTime.Value).ToList();
var multi = runnableGames.Where(z => z.Badge.HoursPlayed >= SteamIdleSettings.MinRunTime.Value).ToList();
var isLastSingle = multi.Count == 1 && IdleGameList.Count == 1; // 是否只剩最后一个游戏
var isLastSingle = multi.Count == 1 && runnableGames.Count == 1; // 是否只剩最后一个游戏
if (multi.Count > 1 || isLastSingle)
{
idleApp = VerifyIsNext(multi, isNext);
@@ -469,14 +569,14 @@ public sealed partial class IdleCardPageViewModel
if (SteamIdleSettings.IdleRule.Value == IdleRule.OnlyOneGame)
{
idleApp = VerifyIsNext(IdleGameList, isNext);
idleApp = VerifyIsNext(runnableGames, isNext);
StartSoloIdle(idleApp);
}
else
{
if (SteamIdleSettings.IdleRule.Value == IdleRule.OneThenMany)
{
var multi_Idles = IdleGameList.Where(z => z.Badge.HoursPlayed >= SteamIdleSettings.MinRunTime.Value).ToList();
var multi_Idles = runnableGames.Where(z => z.Badge.HoursPlayed >= SteamIdleSettings.MinRunTime.Value).ToList();
if (multi_Idles.Count >= 1)
{
idleApp = VerifyIsNext(multi_Idles, isNext);
@@ -489,14 +589,14 @@ public sealed partial class IdleCardPageViewModel
}
else
{
var multi_AFKs = IdleGameList.Where(z => z.Badge.HoursPlayed < SteamIdleSettings.MinRunTime.Value).ToList();
var multi_AFKs = runnableGames.Where(z => z.Badge.HoursPlayed < SteamIdleSettings.MinRunTime.Value).ToList();
if (multi_AFKs.Count >= 2)
{
StartMultipleIdle();
}
else
{
idleApp = VerifyIsNext(multi_AFKs.Count <= 0 ? IdleGameList : multi_AFKs, isNext);
idleApp = VerifyIsNext(multi_AFKs.Count <= 0 ? runnableGames : multi_AFKs, isNext);
StartSoloIdle(idleApp);
}
}
@@ -533,6 +633,9 @@ public sealed partial class IdleCardPageViewModel
/// <param name="item"></param>
private void StartSoloIdle(IdleApp item)
{
if (item.IsExcludedFromIdle)
return;
CurrentIdle = item;
SteamConnectService.Current.RuningSteamApps.TryGetValue(item.AppId, out var runState);
if (runState == null)
@@ -555,17 +658,18 @@ public sealed partial class IdleCardPageViewModel
private void StartMultipleIdle()
{
foreach (var item in IdleGameList)
var runnableGames = GetRunnableIdleGames();
foreach (var item in runnableGames)
{
if (item.Badge.HoursPlayed >= SteamIdleSettings.MinRunTime.Value)
StopSoloIdle(item.App);
if (item.Badge.HoursPlayed < SteamIdleSettings.MinRunTime.Value && IdleGameList.Count(x => x.App.Process != null) < SteamIdleSettings.MaxIdleCount)
if (item.Badge.HoursPlayed < SteamIdleSettings.MinRunTime.Value && runnableGames.Count(x => x.App.Process != null) < SteamIdleSettings.MaxIdleCount)
StartSoloIdle(item);
}
ResetCurrentIdle();
if (!IdleGameList.Any(x => x.App.Process != null))
if (!runnableGames.Any(x => x.App.Process != null))
StartIdle();
}
@@ -682,7 +786,7 @@ public sealed partial class IdleCardPageViewModel
{
return;
}
if (IdleGameList.Sum(s => s.Badge.CardsRemaining) == 0) // 如果挂卡列表可挂卡数量为0,重新获取徽章数据挂卡
if (GetRunnableCardsRemaining() == 0) // 如果挂卡列表可挂卡数量为0,重新获取徽章数据挂卡
{
if (IsReloaded == false)
{
@@ -753,8 +857,12 @@ public sealed partial class IdleCardPageViewModel
uint? nextIdleAppId = null;
if (CurrentIdle != null)
{
var runnableBeforeRefresh = GetRunnableIdleGames();
currentIdleAppId = CurrentIdle.AppId;
nextIdleAppId = (IdleGameList.Count - 1) >= (++CurrentIdleIndex) ? IdleGameList[CurrentIdleIndex].AppId : null;
var currentIdleIndex = runnableBeforeRefresh.FindIndex(x => x.AppId == currentIdleAppId.Value);
nextIdleAppId = (currentIdleIndex >= 0 && (runnableBeforeRefresh.Count - 1) >= (currentIdleIndex + 1))
? runnableBeforeRefresh[currentIdleIndex + 1].AppId
: null;
}
StopIdle();
@@ -763,24 +871,25 @@ public sealed partial class IdleCardPageViewModel
ResetCurrentIdle();
IdleApp? idleApp = null;
var runnableGames = GetRunnableIdleGames();
if (currentIdleAppId.HasValue)
{
if (!Badges.Any(x => x.AppId == currentIdleAppId && x.CardsRemaining > 0)) // 当前游戏挂卡完成
{
if (nextIdleAppId.HasValue) // 挂卡下一个游戏
idleApp = IdleGameList.Where(x => x.AppId == nextIdleAppId).FirstOrDefault();
idleApp = runnableGames.Where(x => x.AppId == nextIdleAppId).FirstOrDefault();
}
else // 继续挂卡当前游戏
idleApp = IdleGameList.Where(x => x.AppId == currentIdleAppId).First();
idleApp = runnableGames.Where(x => x.AppId == currentIdleAppId).FirstOrDefault();
}
var isMultipleIdle = IdleGameList.Count(x => x.App.Process != null) > 1;
var isMultipleIdle = runnableGames.Count(x => x.App.Process != null) > 1;
if (isMultipleIdle || idleApp == null) // 重头开始挂卡
StartIdle();
else
{
CurrentIdleIndex = IdleGameList.IndexOf(idleApp);
CurrentIdleIndex = runnableGames.IndexOf(idleApp);
StartSoloIdle(idleApp);
}
ChangeRunTxt();
@@ -13,6 +13,8 @@ public sealed partial class IdleCardPageViewModel : TabItemViewModel
/// </summary>
public ICommand PriorityRunIdle { get; }
public ICommand ToggleBlacklistIdle { get; }
public ICommand LoginSteamCommand { get; }
public ICommand IdleRunStartOrStop { get; }
@@ -81,6 +83,18 @@ public sealed partial class IdleCardPageViewModel : TabItemViewModel
[Reactive]
public decimal TotalCardsAvgPrice { get; set; }
[Reactive]
public bool HasPrivateGameExcluded { get; set; }
[Reactive]
public int ExcludedPrivateGameCount { get; set; }
[Reactive]
public int ExcludedBlacklistGameCount { get; set; }
[Reactive]
public string PrivateGameExcludeTip { get; set; } = string.Empty;
/// <summary>
/// 当前挂卡游戏
/// </summary>
@@ -28,7 +28,20 @@
Command="{Binding $parent[spp:PageBase].((spp:IdleCardPageViewModel)DataContext).PriorityRunIdle}"
CommandParameter="{Binding}"
IconSource="Play"
IsEnabled="{Binding !IsExcludedFromIdle}"
Text="优先运行此游戏" />
<ui:MenuFlyoutItem
Command="{Binding $parent[spp:PageBase].((spp:IdleCardPageViewModel)DataContext).ToggleBlacklistIdle}"
CommandParameter="{Binding}"
IconSource="Hide"
IsVisible="{Binding !IsBlacklisted}"
Text="移入挂卡黑名单" />
<ui:MenuFlyoutItem
Command="{Binding $parent[spp:PageBase].((spp:IdleCardPageViewModel)DataContext).ToggleBlacklistIdle}"
CommandParameter="{Binding}"
IconSource="Hide"
IsVisible="{Binding IsBlacklisted}"
Text="移出挂卡黑名单" />
<ui:MenuFlyoutSeparator />
<ui:MenuFlyoutItem
Command="{Binding $parent[spp:PageBase].((spp:IdleCardPageViewModel)DataContext).NavAppToSteamViewCommand}"
@@ -553,28 +566,41 @@
<spp:AppItem.Status>
<Border Classes="Status">
<Panel>
<WrapPanel IsVisible="{Binding App.Process, Converter={StaticResource IsNullConverter}, ConverterParameter=invert, Mode=OneWay}">
<WrapPanel IsVisible="{Binding IsExcludedFromIdle}">
<Ellipse
Width="6"
Height="6"
Margin="0,0,5,0"
Fill="#47A42B" />
Fill="#FAAD14" />
<TextBlock
VerticalAlignment="Center"
FontSize="12"
Text="{Binding Path=Res.GameList_RunState, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</WrapPanel>
<WrapPanel IsVisible="{Binding App.Process, Converter={StaticResource IsNullConverter}, Mode=OneWay}">
<Ellipse
Width="6"
Height="6"
Margin="0,0,5,0"
Fill="#FF4F58" />
<TextBlock
VerticalAlignment="Center"
FontSize="12"
Text="{Binding Path=Res.GameList_StopState, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
Text="{Binding ExcludedReasonText}" />
</WrapPanel>
<Panel IsVisible="{Binding !IsExcludedFromIdle}">
<WrapPanel IsVisible="{Binding App.Process, Converter={StaticResource IsNullConverter}, ConverterParameter=invert, Mode=OneWay}">
<Ellipse
Width="6"
Height="6"
Margin="0,0,5,0"
Fill="#47A42B" />
<TextBlock
VerticalAlignment="Center"
FontSize="12"
Text="{Binding Path=Res.GameList_RunState, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</WrapPanel>
<WrapPanel IsVisible="{Binding App.Process, Converter={StaticResource IsNullConverter}, Mode=OneWay}">
<Ellipse
Width="6"
Height="6"
Margin="0,0,5,0"
Fill="#FF4F58" />
<TextBlock
VerticalAlignment="Center"
FontSize="12"
Text="{Binding Path=Res.GameList_StopState, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</WrapPanel>
</Panel>
</Panel>
</Border>
</spp:AppItem.Status>
@@ -703,6 +729,12 @@
</DataTemplate>
</ui:ItemsRepeater.ItemTemplate>
</ui:ItemsRepeater>
<TextBlock
Margin="0,0,0,10"
HorizontalAlignment="Left"
Foreground="#FAAD14"
IsVisible="{Binding HasPrivateGameExcluded}"
Text="{Binding PrivateGameExcludeTip}" />
</Panel>
</spp:OptionsDisplayItem.Content>
</spp:OptionsDisplayItem>
@@ -1,5 +1,5 @@
using Avalonia.Controls;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
namespace BD.WTTS.UI.Views.Pages;
@@ -1,6 +1,6 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.ReactiveUI;
using ReactiveUI.Avalonia;
using BD.SteamClient.Models;
namespace BD.WTTS.UI.Views.Pages;
@@ -35,7 +35,8 @@
<ItemGroup>
<!-- PackageReference -->
<PackageReference Include="BD.Common" />
<!--<PackageReference Include="BD.Common" />-->
<ProjectReference Include="..\..\ref\Common\src\BD.Common\BD.Common.csproj" />
</ItemGroup>
<Import Project="..\TFM_NETX.props" />
@@ -117,7 +117,8 @@
<ItemGroup>
<!-- PackageReference -->
<PackageReference Include="BD.Common" />
<!--<PackageReference Include="BD.Common" />-->
<ProjectReference Include="..\..\ref\Common\src\BD.Common\BD.Common.csproj" />
<PackageReference Include="System.CommandLine" />
<PackageReference Include="Squid-Box.SevenZipSharp.Lite" />
<PackageReference Include="SharpZipLib" />
@@ -7,6 +7,6 @@ public interface ICommand
static void AddCommand<TCommand>(RootCommand rootCommand) where TCommand : ICommand
{
var command = TCommand.GetCommand();
rootCommand.AddCommand(command);
rootCommand.Subcommands.Add(command);
}
}
@@ -0,0 +1,49 @@
namespace BD.WTTS.Client.Tools.Publish.Commands;
static partial class CommandCompat
{
public static Option<T> GetOption<T>(string name, string? desc = null)
{
var o = new Option<T>(name)
{
Description = desc,
};
return o;
}
public static Option<T> GetOption<T>(string name, Func<T> defaultValueFactory, string? desc = null)
{
var o = new Option<T>(name)
{
Description = desc,
DefaultValueFactory = _ => defaultValueFactory(),
};
return o;
}
public static void SetHandler(this Command command, Delegate @delegate, params Option[] options)
{
command.SetAction(parseResult =>
{
var values = options.Select(opt =>
{
var typeOpt = opt.GetType();
var typeArg = typeOpt.GetGenericArguments()[0];
var methodsGetValue = typeof(ParseResult).GetMethods(BindingFlags.Instance | BindingFlags.Public).Where(x =>
x.Name == nameof(ParseResult.GetValue)
&& x.GetParameters().FirstOrDefault()?.ParameterType.ToString() == typeof(Option<>).ToString())
.ToArray();
ArgumentNullException.ThrowIfNull(methodsGetValue);
var methodGetValue = methodsGetValue.Single().MakeGenericMethod(typeArg);
var arg = methodGetValue.Invoke(parseResult, [opt]);
return arg;
}).ToArray();
var result = @delegate.DynamicInvoke(values);
if (result is int code)
{
return code;
}
return 0;
});
}
}
@@ -17,11 +17,11 @@ interface ICompressedPackageCommand : ICommand
static Command ICommand.GetCommand()
{
var sevenzip = new Option<bool>("--7z", "Create 7z compressed");
var zip = new Option<bool>("--zip", "Create Zip compressed");
var tgz = new Option<bool>("--gz", "Create tgz compressed");
var zstd = new Option<bool>("--zstd", "Create tar.zst compressed");
var rids = new Option<string[]>("--rids", "RID is short for runtime identifier");
var sevenzip = CommandCompat.GetOption<bool>("--7z", "Create 7z compressed");
var zip = CommandCompat.GetOption<bool>("--zip", "Create Zip compressed");
var tgz = CommandCompat.GetOption<bool>("--gz", "Create tgz compressed");
var zstd = CommandCompat.GetOption<bool>("--zstd", "Create tar.zst compressed");
var rids = CommandCompat.GetOption<string[]>("--rids", "RID is short for runtime identifier");
var command = new Command(commandName, "Create compressed package")
{
sevenzip, zip, tgz, zstd, rids,
@@ -40,13 +40,13 @@ interface IDotNetPublishCommand : ICommand
static Command ICommand.GetCommand()
{
var debug = new Option<bool>("--debug", "Defines the build configuration");
var rids = new Option<string[]>("--rids", "RID is short for runtime identifier");
var force_sign = new Option<bool>("--force-sign", GetDefForceSign, "Mandatory verification must be digitally signed");
var hsm_sign = new Option<bool>("--hsm-sign", "");
var sha256 = new Option<bool>("--sha256", () => true, "Calculate file hash value");
var sha384 = new Option<bool>("--sha384", () => true, "Calculate file hash value");
var stm_upload = new Option<bool>("--stm-upload", "Steam upload zip file");
var debug = CommandCompat.GetOption<bool>("--debug", "Defines the build configuration");
var rids = CommandCompat.GetOption<string[]>("--rids", "RID is short for runtime identifier");
var force_sign = CommandCompat.GetOption<bool>("--force-sign", GetDefForceSign, "Mandatory verification must be digitally signed");
var hsm_sign = CommandCompat.GetOption<bool>("--hsm-sign", "");
var sha256 = CommandCompat.GetOption<bool>("--sha256", () => true, "Calculate file hash value");
var sha384 = CommandCompat.GetOption<bool>("--sha384", () => true, "Calculate file hash value");
var stm_upload = CommandCompat.GetOption<bool>("--stm-upload", "Steam upload zip file");
var command = new Command(commandName, "DotNet publish app")
{
debug, rids, force_sign, sha256, sha384, stm_upload, hsm_sign,
@@ -758,6 +758,11 @@ $"""
{
var libFileName = GetLibraryFileName(libraryName, platform);
MoveNativeLibrary(libFileName);
if (libFileName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
{
var pdbFileName = $"{libFileName[..^4]}.pdb";
MoveNativeLibrary(pdbFileName);
}
}
switch (platform)
{
@@ -1229,6 +1234,7 @@ publish -c {0} -p:OutputType={1} -p:PublishDir=bin\{0}\Publish\win-any -p:Publis
arg.IsDebug = isDebug;
bool isWindows = false;
bool isMacOS = false;
switch (platform)
{
case Platform.Windows:
@@ -1236,6 +1242,9 @@ publish -c {0} -p:OutputType={1} -p:PublishDir=bin\{0}\Publish\win-any -p:Publis
case Platform.WinUI:
isWindows = true;
break;
case Platform.Apple:
isMacOS = true;
break;
}
arg.Framework = $"net{Environment.Version.Major}.{Environment.Version.Minor}";
@@ -1243,7 +1252,14 @@ publish -c {0} -p:OutputType={1} -p:PublishDir=bin\{0}\Publish\win-any -p:Publis
arg.SingleFile = true;
arg.ReadyToRun = false;
arg.Trimmed = false;
arg.SelfContained = false;
if (isMacOS)
{
arg.SelfContained = true;
}
else
{
arg.SelfContained = false;
}
if (isWindows)
{
//arg.Framework = $"net{Environment.Version.Major}.{Environment.Version.Minor}-windows{windowssdkver}";
@@ -11,8 +11,8 @@ interface IGenerateBridgeContentXml : ICommand
static Command ICommand.GetCommand()
{
var debug = new Option<bool>("--debug", "Defines the build configuration");
var rids = new Option<string[]>("--rids", "RID is short for runtime identifier");
var debug = CommandCompat.GetOption<bool>("--debug", "Defines the build configuration");
var rids = CommandCompat.GetOption<string[]>("--rids", "RID is short for runtime identifier");
var command = new Command(commandName, "Bridge csproj xml generate")
{
debug, rids,
@@ -17,15 +17,15 @@ interface IGenerateBsPatch : ICommand
static Command ICommand.GetCommand()
{
var type = new Option<int>("--type", "type 0:Create 1:Apply 2:UploadFile 3:传入版本号生成补丁");
var type = CommandCompat.GetOption<int>("--type", "type 0:Create 1:Apply 2:UploadFile 3:传入版本号生成补丁");
//旧文件
var oldFile = new Option<string>("--old", "old file");
var oldFile = CommandCompat.GetOption<string>("--old", "old file");
//新文件
var newFile = new Option<string>("--new", "new file");
var newFile = CommandCompat.GetOption<string>("--new", "new file");
//保存路径
var patchFile = new Option<string>("--path", "new file");
var patchFile = CommandCompat.GetOption<string>("--path", "new file");
//程序版本号
var clientPlatform = new Option<ClientPlatform>("--platform", "ClientPlatform");
var clientPlatform = CommandCompat.GetOption<ClientPlatform>("--platform", "ClientPlatform");
var command = new Command(commandName, "Bridge csproj xml generate")
{
@@ -11,12 +11,12 @@ interface IGenerateCaCertCommand : ICommand
static Command ICommand.GetCommand()
{
var type = new Option<int>("--type",
var type = CommandCompat.GetOption<int>("--type",
"Generate certificate type(1 code, 2 store-code)");
var path = new Option<string>("--path",
var path = CommandCompat.GetOption<string>("--path",
"Directory where certificate files need to be saved");
var cn = new Option<string>("--cn", "X500DistinguishedNameValue");
var password = new Option<string>("--pwd");
var cn = CommandCompat.GetOption<string>("--cn", "X500DistinguishedNameValue");
var password = CommandCompat.GetOption<string>("--pwd");
var command = new Command(commandName, "Generate certificate")
{
type, path, cn, password,

Some files were not shown because too many files have changed in this diff Show More