├── .gitignore ├── LICENSE ├── Preview ├── 1.jpg ├── 2.jpg └── 3.jpg ├── README.md ├── WaveTools.sln └── WaveTools ├── App.xaml ├── App.xaml.cs ├── Assets ├── BadgeLogo.scale-100.png ├── BadgeLogo.scale-125.png ├── BadgeLogo.scale-150.png ├── BadgeLogo.scale-200.png ├── BadgeLogo.scale-400.png ├── LargeTile.scale-100.png ├── LargeTile.scale-125.png ├── LargeTile.scale-150.png ├── LargeTile.scale-200.png ├── LargeTile.scale-400.png ├── LockScreenLogo.scale-200.png ├── Logo.ico ├── SmallTile.scale-100.png ├── SmallTile.scale-125.png ├── SmallTile.scale-150.png ├── SmallTile.scale-200.png ├── SmallTile.scale-400.png ├── SplashScreen.scale-100.png ├── SplashScreen.scale-125.png ├── SplashScreen.scale-150.png ├── SplashScreen.scale-200.png ├── SplashScreen.scale-400.png ├── Square150x150Logo.scale-100.png ├── Square150x150Logo.scale-125.png ├── Square150x150Logo.scale-150.png ├── Square150x150Logo.scale-200.png ├── Square150x150Logo.scale-400.png ├── Square44x44Logo.altform-lightunplated_targetsize-16.png ├── Square44x44Logo.altform-lightunplated_targetsize-24.png ├── Square44x44Logo.altform-lightunplated_targetsize-256.png ├── Square44x44Logo.altform-lightunplated_targetsize-32.png ├── Square44x44Logo.altform-lightunplated_targetsize-48.png ├── Square44x44Logo.altform-unplated_targetsize-16.png ├── Square44x44Logo.altform-unplated_targetsize-256.png ├── Square44x44Logo.altform-unplated_targetsize-32.png ├── Square44x44Logo.altform-unplated_targetsize-48.png ├── Square44x44Logo.scale-100.png ├── Square44x44Logo.scale-125.png ├── Square44x44Logo.scale-150.png ├── Square44x44Logo.scale-200.png ├── Square44x44Logo.scale-400.png ├── Square44x44Logo.targetsize-16.png ├── Square44x44Logo.targetsize-24.png ├── Square44x44Logo.targetsize-24_altform-unplated.png ├── Square44x44Logo.targetsize-256.png ├── Square44x44Logo.targetsize-32.png ├── Square44x44Logo.targetsize-48.png ├── StoreLogo.scale-100.png ├── StoreLogo.scale-125.png ├── StoreLogo.scale-150.png ├── StoreLogo.scale-200.png ├── StoreLogo.scale-400.png ├── Wide310x150Logo.scale-100.png ├── Wide310x150Logo.scale-125.png ├── Wide310x150Logo.scale-150.png ├── Wide310x150Logo.scale-200.png └── Wide310x150Logo.scale-400.png ├── Depend ├── AppDataController.cs ├── CommonHelpers.cs ├── ExceptionSave.cs ├── GachaCommon.cs ├── GachaModel.cs ├── GameStartUtil.cs ├── GetGithubLatest.cs ├── GetJSGLatest.cs ├── GetNetData.cs ├── GetNotify.cs ├── GetUpdate.cs ├── InstallFont.cs ├── InstallerHelper.cs ├── Logging.cs ├── MainFrameController.cs ├── NativeMethods.cs ├── ProcessRun.cs ├── TerminalMode.cs ├── UIHelper.cs └── WindowHelper.cs ├── Imgs ├── Don_Alipay.png ├── Don_Hand.gif ├── Don_Hand.png ├── Don_Icon.gif ├── Don_Wechat.png ├── FirstRun_Day.png ├── FirstRun_DayNight.png ├── FirstRun_Download.png ├── FirstRun_Next.png ├── FirstRun_Night.png ├── FirstRun_Question.png ├── FirstRun_Recover.png ├── FirstRun_Windows.png ├── JSG_Logo.png ├── Logo.png ├── Logo_2.jpg ├── Logo_Background.png ├── Logo_Gitee.jpg ├── Logo_Github.png └── Logo_JSG-R.png ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Package.appxmanifest ├── Properties └── launchSettings.json ├── Views ├── AboutView.xaml ├── AboutView.xaml.cs ├── DonationView.xaml ├── DonationView.xaml.cs ├── FirstRunViews │ ├── FirstRunAnimation.xaml │ ├── FirstRunAnimation.xaml.cs │ ├── FirstRunExtra.xaml │ ├── FirstRunExtra.xaml.cs │ ├── FirstRunFinish.xaml │ ├── FirstRunFinish.xaml.cs │ ├── FirstRunGetDepend.xaml │ ├── FirstRunGetDepend.xaml.cs │ ├── FirstRunInit.xaml │ ├── FirstRunInit.xaml.cs │ ├── FirstRunSourceSelect.xaml │ ├── FirstRunSourceSelect.xaml.cs │ ├── FirstRunTheme.xaml │ ├── FirstRunTheme.xaml.cs │ └── order.md ├── GachaViews │ ├── TempGachaView.xaml │ └── TempGachaView.xaml.cs ├── MainView.xaml ├── MainView.xaml.cs ├── NotifyViews │ ├── NotifyAnnounceView.xaml │ ├── NotifyAnnounceView.xaml.cs │ ├── NotifyMessageView.xaml │ ├── NotifyMessageView.xaml.cs │ ├── NotifyNotificationView.xaml │ └── NotifyNotificationView.xaml.cs ├── SGViews │ ├── AccountView.xaml │ ├── AccountView.xaml.cs │ ├── GraphicSettingView.xaml │ └── GraphicSettingView.xaml.cs ├── StartGameView.xaml ├── StartGameView.xaml.cs └── ToolViews │ ├── AdvancedGraphicSettingsView.xaml │ ├── AdvancedGraphicSettingsView.xaml.cs │ ├── GachaView.xaml │ └── GachaView.xaml.cs ├── WaveTools.csproj └── app.manifest /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | *.sbr 86 | *.tlb 87 | *.tli 88 | *.tlh 89 | *.tmp 90 | *.tmp_proj 91 | *_wpftmp.csproj 92 | *.log 93 | *.tlog 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 298 | *.vbp 299 | 300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 301 | *.dsw 302 | *.dsp 303 | 304 | # Visual Studio 6 technical files 305 | *.ncb 306 | *.aps 307 | 308 | # Visual Studio LightSwitch build output 309 | **/*.HTMLClient/GeneratedArtifacts 310 | **/*.DesktopClient/GeneratedArtifacts 311 | **/*.DesktopClient/ModelManifest.xml 312 | **/*.Server/GeneratedArtifacts 313 | **/*.Server/ModelManifest.xml 314 | _Pvt_Extensions 315 | 316 | # Paket dependency manager 317 | .paket/paket.exe 318 | paket-files/ 319 | 320 | # FAKE - F# Make 321 | .fake/ 322 | 323 | # CodeRush personal settings 324 | .cr/personal 325 | 326 | # Python Tools for Visual Studio (PTVS) 327 | __pycache__/ 328 | *.pyc 329 | 330 | # Cake - Uncomment if you are using it 331 | # tools/** 332 | # !tools/packages.config 333 | 334 | # Tabs Studio 335 | *.tss 336 | 337 | # Telerik's JustMock configuration file 338 | *.jmconfig 339 | 340 | # BizTalk build output 341 | *.btp.cs 342 | *.btm.cs 343 | *.odx.cs 344 | *.xsd.cs 345 | 346 | # OpenCover UI analysis results 347 | OpenCover/ 348 | 349 | # Azure Stream Analytics local run output 350 | ASALocalRun/ 351 | 352 | # MSBuild Binary and Structured Log 353 | *.binlog 354 | 355 | # NVidia Nsight GPU debugger configuration file 356 | *.nvuser 357 | 358 | # MFractors (Xamarin productivity tool) working folder 359 | .mfractor/ 360 | 361 | # Local History for Visual Studio 362 | .localhistory/ 363 | 364 | # Visual Studio History (VSHistory) files 365 | .vshistory/ 366 | 367 | # BeatPulse healthcheck temp database 368 | healthchecksdb 369 | 370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 371 | MigrationBackup/ 372 | 373 | # Ionide (cross platform F# VS Code tools) working folder 374 | .ionide/ 375 | 376 | # Fody - auto-generated XML schema 377 | FodyWeavers.xsd 378 | 379 | # VS Code files for those working on multiple tools 380 | .vscode/* 381 | !.vscode/settings.json 382 | !.vscode/tasks.json 383 | !.vscode/launch.json 384 | !.vscode/extensions.json 385 | *.code-workspace 386 | 387 | # Local History for Visual Studio Code 388 | .history/ 389 | 390 | # Windows Installer files from build outputs 391 | *.cab 392 | *.msi 393 | *.msix 394 | *.msm 395 | *.msp 396 | 397 | # JetBrains Rider 398 | *.sln.iml 399 | -------------------------------------------------------------------------------- /Preview/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/Preview/1.jpg -------------------------------------------------------------------------------- /Preview/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/Preview/2.jpg -------------------------------------------------------------------------------- /Preview/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/Preview/3.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](./Preview/1.jpg) 2 | # 🔨鸣潮工具箱 3 | 🔨鸣潮工具箱是一个用于修改鸣潮画质帧率和查看抽卡分析的工具箱 4 | 5 | ⚠️仅支持 x64、arm64 架构的 Windows 10 1809 及以上版本的系统 6 | # 功能 7 | ### 当前版本的工具箱包括以下功能: 8 | 🔓帧率解锁 9 | 10 | ⚙️画质修改 11 | 12 | 🗃️抽卡分析 13 | 14 | 🔑账号切换 15 | 16 | # 安装方法 17 | 打开Powershell 18 | 19 | 输入``irm wavetools.jamsg.cn/get | iex`` 20 | 21 | 回车后将自动安装并启动WaveTools 22 | 23 | # 注意事项 24 | 本工具箱仅适用于PC版鸣潮。 25 | 26 | # Star 27 | [![Star History Chart](https://api.star-history.com/svg?repos=JamXi233/WaveTools&type=Date)](https://star-history.com/#JamXi233/WaveTools&Date) 28 | -------------------------------------------------------------------------------- /WaveTools.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.33627.172 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WaveTools", "WaveTools\WaveTools.csproj", "{6FBCC4C5-CFEC-4806-8DF5-5326B741A9FB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {6FBCC4C5-CFEC-4806-8DF5-5326B741A9FB}.Debug|x64.ActiveCfg = Debug|x64 15 | {6FBCC4C5-CFEC-4806-8DF5-5326B741A9FB}.Debug|x64.Build.0 = Debug|x64 16 | {6FBCC4C5-CFEC-4806-8DF5-5326B741A9FB}.Debug|x64.Deploy.0 = Debug|x64 17 | {6FBCC4C5-CFEC-4806-8DF5-5326B741A9FB}.Release|x64.ActiveCfg = Release|x64 18 | {6FBCC4C5-CFEC-4806-8DF5-5326B741A9FB}.Release|x64.Build.0 = Release|x64 19 | {6FBCC4C5-CFEC-4806-8DF5-5326B741A9FB}.Release|x64.Deploy.0 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(SolutionProperties) = preSolution 22 | HideSolutionNode = FALSE 23 | EndGlobalSection 24 | GlobalSection(ExtensibilityGlobals) = postSolution 25 | SolutionGuid = {CA3A927A-5AB3-456D-B0AF-E3B048088EB4} 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /WaveTools/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WaveTools/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using Microsoft.UI.Xaml; 22 | using Microsoft.UI.Xaml.Controls; 23 | using WaveTools.Depend; 24 | using System; 25 | using System.Runtime.InteropServices; 26 | using System.Text; 27 | using System.Threading.Tasks; 28 | using Windows.Storage; 29 | using WaveTools.Views; 30 | using WaveTools.Depend; 31 | 32 | 33 | namespace WaveTools 34 | { 35 | public partial class App : Application 36 | { 37 | public static MainWindow MainWindow { get; private set; } 38 | public static ApplicationTheme CurrentTheme { get; private set; } 39 | public static bool GDebugMode { get; set; } 40 | public static bool SDebugMode { get; set; } 41 | // 导入 AllocConsole 和 FreeConsole 函数 42 | [DllImport("kernel32.dll", SetLastError = true)] 43 | [return: MarshalAs(UnmanagedType.Bool)] 44 | private static extern bool AllocConsole(); 45 | [DllImport("kernel32.dll", SetLastError = true)] 46 | private static extern bool FreeConsole(); 47 | // 导入 GetAsyncKeyState 函数 48 | [DllImport("User32.dll")] 49 | public static extern short GetAsyncKeyState(int vKey); 50 | GetNotify getNotify = new GetNotify(); 51 | private Window m_window; 52 | 53 | // 私有构造函数以确保单例 54 | public App() 55 | { 56 | InitializeComponent(); 57 | Init(); 58 | InitAppData(); 59 | SetupTheme(); 60 | InitAdminMode(); 61 | } 62 | 63 | public static bool IsRequireReboot { get; set; } = false; 64 | public static bool IsWaveToolsRequireUpdate { get; set; } = false; 65 | public static bool IsWaveToolsHelperRequireUpdate { get; set; } = false; 66 | 67 | 68 | protected override async void OnLaunched(LaunchActivatedEventArgs args) 69 | { 70 | if (AppDataController.GetTerminalMode() == -1 || AppDataController.GetTerminalMode() == 0) 71 | { 72 | m_window = new MainWindow(); 73 | m_window.Activate(); 74 | // 处理窗口的 Closed 事件 75 | m_window.Closed += OnWindowClosed; 76 | } 77 | else await InitTerminalModeAsync(AppDataController.GetTerminalMode()); 78 | } 79 | 80 | private void InitAppData() 81 | { 82 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 83 | if (localSettings.Values["Config_FirstRun"] == null) 84 | { 85 | AppDataController appDataController = new AppDataController(); 86 | appDataController.FirstRunInit(); 87 | } 88 | } 89 | 90 | private void InitAdminMode() 91 | { 92 | if (AppDataController.GetAdminMode() == 1) 93 | { 94 | if (!ProcessRun.IsRunAsAdmin()) ProcessRun.RequestAdminAndRestart(); 95 | } 96 | } 97 | 98 | private void SetupTheme() 99 | { 100 | var dayNight = AppDataController.GetDayNight(); 101 | try 102 | { 103 | if (dayNight == 1) 104 | { 105 | this.RequestedTheme = ApplicationTheme.Light; 106 | } 107 | else if (dayNight == 2) 108 | { 109 | this.RequestedTheme = ApplicationTheme.Dark; 110 | } 111 | } 112 | catch (Exception ex) 113 | { 114 | Logging.Write(ex.StackTrace); 115 | NotificationManager.RaiseNotification("主题切换失败", ex.Message, InfoBarSeverity.Error); 116 | } 117 | 118 | } 119 | 120 | public async Task InitTerminalModeAsync(int Mode) 121 | { 122 | TerminalMode.ShowConsole(); 123 | TerminalMode terminalMode = new TerminalMode(); 124 | bool response = await terminalMode.Init(Mode); 125 | if (response) 126 | { 127 | m_window = new MainWindow(); 128 | m_window.Activate(); 129 | } 130 | } 131 | 132 | public void Init() 133 | { 134 | AllocConsole(); 135 | Console.OutputEncoding = Encoding.UTF8; 136 | Console.InputEncoding = Encoding.UTF8; 137 | Console.SetWindowSize(60, 25); 138 | Console.SetBufferSize(60, 25); 139 | TerminalMode.HideConsole(); 140 | bool isDebug = false; 141 | GDebugMode = false; 142 | #if DEBUG 143 | isDebug = true; 144 | GDebugMode = true; 145 | #else 146 | #endif 147 | 148 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 149 | if (localSettings.Values["Config_FirstRun"] != null) { 150 | switch (AppDataController.GetConsoleMode()) 151 | { 152 | case 0: 153 | TerminalMode.HideConsole(); 154 | break; 155 | case 1: 156 | TerminalMode.ShowConsole(); 157 | break; 158 | default: 159 | TerminalMode.HideConsole(); 160 | break; 161 | } 162 | } 163 | 164 | 165 | if (AppDataController.GetTerminalMode() != -1) 166 | { 167 | int Mode = (int)localSettings.Values["Config_TerminalMode"]; 168 | TerminalMode terminalMode = new TerminalMode(); 169 | } 170 | 171 | } 172 | 173 | private void OnWindowClosed(object sender, WindowEventArgs e) 174 | { 175 | // 关闭应用程序 176 | Windows.ApplicationModel.Core.CoreApplication.Exit(); 177 | } 178 | 179 | public static class NotificationManager 180 | { 181 | public delegate void NotificationEventHandler(string title, string message, InfoBarSeverity severity, bool isClosable = true, int TimerSec = 0, Action action = null, string actionButtonText = null); 182 | public static event NotificationEventHandler OnNotificationRequested; 183 | 184 | public static void RaiseNotification(string title, string message, InfoBarSeverity severity, bool isClosable = true, int TimerSec = 0, Action action = null, string actionButtonText = null) 185 | { 186 | OnNotificationRequested?.Invoke(title, message, severity, isClosable, TimerSec, action, actionButtonText); 187 | } 188 | } 189 | 190 | public static class WaitOverlayManager 191 | { 192 | public delegate void WaitOverlayEventHandler(bool status, string title = null, string subtitle = null, bool isProgress = false, int progress = 0, bool isBtnEnabled = false, string btnContent = "", Action btnAction = null); 193 | public static event WaitOverlayEventHandler OnWaitOverlayRequested; 194 | 195 | public static void RaiseWaitOverlay(bool status, string title = null, string subtitle = null, bool isProgress = false, int progress = 0, bool isBtnEnabled = false, string btnContent = "", Action btnAction = null) 196 | { 197 | OnWaitOverlayRequested?.Invoke(status, title, subtitle, isProgress, progress, isBtnEnabled, btnContent, btnAction); 198 | } 199 | } 200 | 201 | public static class DialogManager 202 | { 203 | public delegate void DialogEventHandler(XamlRoot xamlRoot, string title = null, object content = null, bool isPrimaryButtonEnabled = false, string primaryButtonContent = "", Action primaryButtonAction = null, bool isSecondaryButtonEnabled = false, string secondaryButtonContent = "", Action secondaryButtonAction = null); 204 | public static event DialogEventHandler OnDialogRequested; 205 | 206 | public static void RaiseDialog(XamlRoot xamlRoot, string title = null, object content = null, bool isPrimaryButtonEnabled = false, string primaryButtonContent = "", Action primaryButtonAction = null, bool isSecondaryButtonEnabled = false, string secondaryButtonContent = "", Action secondaryButtonAction = null) 207 | { 208 | // 如果content是string类型,则创建一个TextBlock来包装它 209 | if (content is string textContent) 210 | { 211 | content = new TextBlock { Text = textContent }; 212 | } 213 | 214 | OnDialogRequested?.Invoke(xamlRoot, title, content, isPrimaryButtonEnabled, primaryButtonContent, primaryButtonAction, isSecondaryButtonEnabled, secondaryButtonContent, secondaryButtonAction); 215 | } 216 | } 217 | 218 | 219 | 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /WaveTools/Assets/BadgeLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/BadgeLogo.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/BadgeLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/BadgeLogo.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/BadgeLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/BadgeLogo.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/BadgeLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/BadgeLogo.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/BadgeLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/BadgeLogo.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Assets/LargeTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/LargeTile.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/LargeTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/LargeTile.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/LargeTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/LargeTile.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/LargeTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/LargeTile.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/LargeTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/LargeTile.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/Logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Logo.ico -------------------------------------------------------------------------------- /WaveTools/Assets/SmallTile.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SmallTile.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/SmallTile.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SmallTile.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/SmallTile.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SmallTile.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/SmallTile.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SmallTile.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/SmallTile.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SmallTile.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/SplashScreen.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SplashScreen.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/SplashScreen.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SplashScreen.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/SplashScreen.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/SplashScreen.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square150x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square150x150Logo.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square150x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square150x150Logo.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square150x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square150x150Logo.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square150x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square150x150Logo.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-16.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-256.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-32.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.altform-unplated_targetsize-48.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.targetsize-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.targetsize-16.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.targetsize-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.targetsize-24.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.targetsize-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.targetsize-256.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.targetsize-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.targetsize-32.png -------------------------------------------------------------------------------- /WaveTools/Assets/Square44x44Logo.targetsize-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Square44x44Logo.targetsize-48.png -------------------------------------------------------------------------------- /WaveTools/Assets/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/StoreLogo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/StoreLogo.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/StoreLogo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/StoreLogo.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/StoreLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/StoreLogo.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/StoreLogo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/StoreLogo.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Assets/Wide310x150Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Wide310x150Logo.scale-100.png -------------------------------------------------------------------------------- /WaveTools/Assets/Wide310x150Logo.scale-125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Wide310x150Logo.scale-125.png -------------------------------------------------------------------------------- /WaveTools/Assets/Wide310x150Logo.scale-150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Wide310x150Logo.scale-150.png -------------------------------------------------------------------------------- /WaveTools/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /WaveTools/Assets/Wide310x150Logo.scale-400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Assets/Wide310x150Logo.scale-400.png -------------------------------------------------------------------------------- /WaveTools/Depend/AppDataController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using WaveTools.Depend; 23 | using Windows.Storage; 24 | 25 | namespace WaveTools.Depend 26 | { 27 | class AppDataController 28 | { 29 | private const string KeyPath = "WaveTools"; 30 | private const string FirstRun = "Config_FirstRun"; 31 | 32 | public void FirstRunInit() 33 | { 34 | SetDefaultIfNull("Config_AutoCheckUpdate", 0); 35 | SetDefaultIfNull("Config_DayNight", 2); 36 | SetDefaultIfNull("Config_GamePath", "Null"); 37 | SetDefaultIfNull("Config_UpdateService", 2); 38 | SetDefaultIfNull("Config_FirstRun", 1); 39 | SetDefaultIfNull("Config_FirstRunStatus", 0); 40 | SetDefaultIfNull("Config_ConsoleMode", 0); 41 | SetDefaultIfNull("Config_TerminalMode", 0); 42 | SetDefaultIfNull("Config_AdminMode", 0); 43 | } 44 | 45 | public int CheckOldData() 46 | { 47 | var keyContainer = GetOrCreateContainer(KeyPath); 48 | Logging.WriteCustom("AppDataController", "Checking OldData..."); 49 | if (keyContainer.Values.ContainsKey(FirstRun) && keyContainer.Values[FirstRun].ToString() == "0") 50 | { 51 | Logging.WriteCustom("AppDataController", "OldData Found"); 52 | return 1; 53 | } 54 | Logging.WriteCustom("AppDataController", "OldData Not Found"); 55 | return 0; 56 | } 57 | 58 | private ApplicationDataContainer GetOrCreateContainer(string keyPath) 59 | { 60 | var localSettings = ApplicationData.Current.LocalSettings; 61 | if (!localSettings.Containers.ContainsKey(keyPath)) 62 | { 63 | return localSettings.CreateContainer(keyPath, ApplicationDataCreateDisposition.Always); 64 | } 65 | return localSettings.Containers[keyPath]; 66 | } 67 | 68 | private void SetDefaultIfNull(string key, object defaultValue) 69 | { 70 | var localSettings = ApplicationData.Current.LocalSettings; 71 | if (localSettings.Values[key] == null) 72 | { 73 | localSettings.Values[key] = defaultValue; 74 | Logging.WriteCustom("AppDataController", $"Init {key}"); 75 | } 76 | } 77 | 78 | private static T GetValue(string key, T defaultValue = default) 79 | { 80 | var localSettings = ApplicationData.Current.LocalSettings; 81 | return localSettings.Values.ContainsKey(key) ? (T)localSettings.Values[key] : defaultValue; 82 | } 83 | 84 | private static void SetValue(string key, T value) 85 | { 86 | var localSettings = ApplicationData.Current.LocalSettings; 87 | localSettings.Values[key] = value; 88 | Logging.WriteCustom("AppDataController", $"Set {key}"); 89 | } 90 | 91 | private static void RemoveValue(string key) 92 | { 93 | var localSettings = ApplicationData.Current.LocalSettings; 94 | localSettings.Values.Remove(key); 95 | Logging.WriteCustom("AppDataController", $"Remove {key}"); 96 | } 97 | 98 | // 通用设置 99 | public static int GetAutoCheckUpdate() => GetValue("Config_AutoCheckUpdate", -1); 100 | public static int GetFirstRun() => GetValue("Config_FirstRun", -1); 101 | public static int GetFirstRunStatus() => GetValue("Config_FirstRunStatus", -1); 102 | public static string GetGamePath() => GetValue("Config_GamePath", "Null"); 103 | public static string GetGamePathWithoutGameName() => GetGamePath().Replace("Wuthering Waves.exe", ""); 104 | public static string GetGamePathForHelper() => "\"" + (string)ApplicationData.Current.LocalSettings.Values["Config_GamePath"] + "\""; 105 | public static int GetUpdateService() => GetValue("Config_UpdateService", -1); 106 | public static int GetDayNight() => GetValue("Config_DayNight", -1); 107 | public static int GetConsoleMode() => GetValue("Config_ConsoleMode", -1); 108 | public static int GetTerminalMode() => GetValue("Config_TerminalMode", -1); 109 | public static int GetAccountChangeMode() => GetValue("Config_AccountChange", -1); 110 | public static int GetAdminMode() => GetValue("Config_AdminMode", -1); 111 | public static string GetGameParameter() => GetValue("Config_GameParameter", ""); 112 | public static int GetDX11Enable() => GetValue("Config_DX11Enable", -1); 113 | 114 | public static void SetAutoCheckUpdate(int autocheckupdate) => SetValue("Config_AutoCheckUpdate", autocheckupdate); 115 | public static void SetFirstRunStatus(int firstRunStatus) => SetValue("Config_FirstRunStatus", firstRunStatus); 116 | public static void SetFirstRun(int firstRun) => SetValue("Config_FirstRun", firstRun); 117 | public static void SetGamePath(string gamePath) => SetValue("Config_GamePath", gamePath); 118 | public static void SetUpdateService(int updateService) => SetValue("Config_UpdateService", updateService); 119 | public static void SetDayNight(int dayNight) => SetValue("Config_DayNight", dayNight); 120 | public static void SetConsoleMode(int consoleMode) => SetValue("Config_ConsoleMode", consoleMode); 121 | public static void SetTerminalMode(int terminalMode) => SetValue("Config_TerminalMode", terminalMode); 122 | public static void SetAccountChangeMode(int accountChangeMode) => SetValue("Config_AccountChange", accountChangeMode); 123 | public static void SetAdminMode(int adminMode) => SetValue("Config_AdminMode", adminMode); 124 | public static void SetGameParameter(string gamePath) => SetValue("Config_GameParameter", gamePath); 125 | public static void SetDX11Enable(int dx11Enable) => SetValue("Config_DX11Enable", dx11Enable); 126 | 127 | public static void RMAutoCheckUpdate() => RemoveValue("Config_AutoCheckUpdate"); 128 | public static void RMFirstRunStatus() => RemoveValue("Config_FirstRunStatus"); 129 | public static void RMFirstRun() => RemoveValue("Config_FirstRun"); 130 | public static void RMGamePath() => RemoveValue("Config_GamePath"); 131 | public static void RMUpdateService() => RemoveValue("Config_UpdateService"); 132 | public static void RMDayNight() => RemoveValue("Config_DayNight"); 133 | public static void RMConsoleMode() => RemoveValue("Config_ConsoleMode"); 134 | public static void RMTerminalMode() => RemoveValue("Config_TerminalMode"); 135 | public static void RMAccountChangeMode() => RemoveValue("Config_AccountChange"); 136 | public static void RMAdminMode() => RemoveValue("Config_AdminMode"); 137 | public static void RMGameParameter() => RemoveValue("Config_GameParameter"); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /WaveTools/Depend/ExceptionSave.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.IO; 24 | using System.Linq; 25 | using System.Text; 26 | using System.Threading.Tasks; 27 | using Windows.Storage; 28 | 29 | namespace WaveTools.Depend 30 | { 31 | public class ExceptionSave 32 | { 33 | public static async Task Write(string message, int severity, string fileName) 34 | { 35 | // 获取用户文档目录下的JSG-LLC\Panic目录 36 | string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "JSG-LLC", "Panic"); 37 | 38 | // 确保目录存在 39 | Directory.CreateDirectory(folderPath); 40 | 41 | // 创建文件路径 42 | string filePath = Path.Combine(folderPath, fileName); 43 | 44 | // 使用StreamWriter异步写入数据 45 | using (StreamWriter writer = new StreamWriter(filePath, false)) // false表示覆盖文件 46 | { 47 | await writer.WriteLineAsync($"{DateTime.Now} [{severity}] {message}"); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /WaveTools/Depend/GachaModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace WaveTools.Depend 9 | { 10 | public class GachaModel 11 | { 12 | public class GroupedRecord 13 | { 14 | public string Name { get; set; } 15 | public int Count { get; set; } 16 | } 17 | 18 | public class GachaData 19 | { 20 | public GachaInfo Info { get; set; } 21 | public List List { get; set; } 22 | } 23 | 24 | public class GachaInfo 25 | { 26 | public string Uid { get; set; } 27 | } 28 | 29 | public class GachaPool 30 | { 31 | public int CardPoolId { get; set; } 32 | public string CardPoolType { get; set; } 33 | public List Records { get; set; } 34 | } 35 | 36 | public class GachaRecord 37 | { 38 | public string ResourceId { get; set; } 39 | public string Name { get; set; } 40 | public int QualityLevel { get; set; } 41 | public string ResourceType { get; set; } 42 | public string Time { get; set; } 43 | public string Id { get; set; } 44 | } 45 | 46 | public class CardPool 47 | { 48 | public int CardPoolId { get; set; } 49 | public string CardPoolType { get; set; } 50 | public int? FiveStarPity { get; set; } 51 | public int? FourStarPity { get; set; } 52 | public bool? isPityEnable { get; set; } 53 | } 54 | 55 | public class CardPoolInfo 56 | { 57 | public List CardPools { get; set; } 58 | } 59 | 60 | public class GachaUrl 61 | { 62 | [JsonProperty("gachaLink")] 63 | public string GachaLink { get; set; } 64 | 65 | [JsonProperty("playerId")] 66 | public string PlayerId { get; set; } 67 | 68 | [JsonProperty("cardPoolType")] 69 | public string CardPoolType { get; set; } 70 | 71 | [JsonProperty("serverId")] 72 | public string ServerId { get; set; } 73 | 74 | [JsonProperty("languageCode")] 75 | public string LanguageCode { get; set; } 76 | 77 | [JsonProperty("recordId")] 78 | public string RecordId { get; set; } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /WaveTools/Depend/GameStartUtil.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using System.Diagnostics; 23 | using System.IO; 24 | using Windows.Storage; 25 | 26 | namespace WaveTools.Depend 27 | { 28 | internal class GameStartUtil 29 | { 30 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 31 | public async void StartGame() 32 | { 33 | string Parameter = ""; 34 | Parameter = AppDataController.GetGameParameter(); 35 | // For WW 36 | if (AppDataController.GetDX11Enable() == 1) Parameter += " -dx11"; 37 | 38 | string userDocumentsFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 39 | string gamePath = localSettings.Values["Config_GamePath"] as string; 40 | 41 | // 获取游戏的执行路径(目录) 42 | string gameDirectory = Path.GetDirectoryName(gamePath); 43 | 44 | var processInfo = new ProcessStartInfo(gamePath) 45 | { 46 | Arguments = Parameter, 47 | UseShellExecute = true, 48 | Verb = "runas", 49 | WorkingDirectory = gameDirectory // 设置当前路径为执行路径 50 | }; 51 | 52 | // 启动程序 53 | Process.Start(processInfo); 54 | } 55 | 56 | public void StartLauncher() 57 | { 58 | string gamePath = localSettings.Values["Config_GamePath"] as string; 59 | var processInfo = new ProcessStartInfo(gamePath.Replace("Wuthering Waves.exe", "..\\launcher.exe")); 60 | 61 | // 启动程序 62 | processInfo.UseShellExecute = true; 63 | processInfo.Verb = "runas"; 64 | Process.Start(processInfo); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /WaveTools/Depend/GetGithubLatest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | using System.Threading.Tasks; 4 | using Newtonsoft.Json.Linq; 5 | using WaveTools.Depend; 6 | 7 | namespace WaveTools.Depend 8 | { 9 | internal class GetGithubLatest 10 | { 11 | private static readonly HttpClient httpClient = new HttpClient(); 12 | 13 | public async Task<(string Name, string Version, string DownloadUrl, string Changelog)> GetLatestReleaseInfoAsync(string owner, string repo) 14 | { 15 | string apiUrl = $"https://api.github.com/repos/{owner}/{repo}/releases/latest"; 16 | httpClient.DefaultRequestHeaders.Add("User-Agent", "WaveTools-Update-Client"); 17 | 18 | try 19 | { 20 | var response = await httpClient.GetAsync(apiUrl); 21 | response.EnsureSuccessStatusCode(); 22 | 23 | var content = await response.Content.ReadAsStringAsync(); 24 | JObject jsonObj = JObject.Parse(content); 25 | 26 | var name = jsonObj["name"].ToString(); 27 | var version = jsonObj["tag_name"].ToString(); 28 | var changelog = jsonObj["body"].ToString(); 29 | var downloadUrl = jsonObj["assets"][0]["browser_download_url"].ToString(); 30 | if (version.Contains("WaveTools")) 31 | { 32 | version = version.Split("WaveTools_")[1]; 33 | } 34 | 35 | Logging.Write($"Fetched latest release info: Name={name}, Version={version}, DownloadUrl={downloadUrl}"); 36 | return (name, version, downloadUrl, changelog); 37 | } 38 | catch (Exception ex) 39 | { 40 | Logging.Write($"Error fetching latest release info: {ex.Message}",2); 41 | throw; 42 | } 43 | } 44 | 45 | public async Task<(string Name, string Version, string DownloadUrl, string Changelog)> GetLatestDependReleaseInfoAsync(string owner, string repo, string assetPrefix) 46 | { 47 | string apiUrl = $"https://api.github.com/repos/{owner}/{repo}/releases"; 48 | httpClient.DefaultRequestHeaders.Add("User-Agent", "WaveTools-Update-Client"); 49 | 50 | try 51 | { 52 | var response = await httpClient.GetAsync(apiUrl); 53 | response.EnsureSuccessStatusCode(); 54 | 55 | var content = await response.Content.ReadAsStringAsync(); 56 | JArray jsonArray = JArray.Parse(content); 57 | 58 | foreach (var release in jsonArray) 59 | { 60 | foreach (var asset in release["assets"]) 61 | { 62 | if (asset["name"].ToString().StartsWith(assetPrefix)) 63 | { 64 | var version = release["tag_name"].ToString(); 65 | if (version.StartsWith(assetPrefix)) 66 | { 67 | version = version.Substring(assetPrefix.Length).TrimStart('_'); 68 | } 69 | var name = assetPrefix; 70 | var changelog = release["body"].ToString(); 71 | var downloadUrl = asset["browser_download_url"].ToString(); 72 | 73 | Console.WriteLine($"Found matching asset: Name={name}, Version={version}, DownloadUrl={downloadUrl}"); 74 | return (name, version, downloadUrl, changelog); 75 | } 76 | } 77 | } 78 | 79 | throw new Exception($"No assets found with prefix {assetPrefix}"); 80 | } 81 | catch (Exception ex) 82 | { 83 | Logging.Write($"Error fetching release info for prefix {assetPrefix}: {ex.Message}",2); 84 | throw; 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /WaveTools/Depend/GetJSGLatest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | // GetJSGLatest.cs 22 | 23 | using System; 24 | using System.Net.Http; 25 | using System.Threading.Tasks; 26 | using Newtonsoft.Json.Linq; 27 | 28 | public class GetJSGLatest 29 | { 30 | private static readonly HttpClient httpClient = new HttpClient(); 31 | 32 | public async Task<(string Name, string Version, string DownloadUrl, string Changelog)> GetLatestReleaseInfoAsync(string package) 33 | { 34 | string apiUrl = $"https://api.jamsg.cn/release/getversion.php?package={package}"; 35 | httpClient.DefaultRequestHeaders.Add("User-Agent", "JSG-Official-Update-Client"); 36 | 37 | var response = await httpClient.GetAsync(apiUrl); 38 | response.EnsureSuccessStatusCode(); 39 | 40 | var content = await response.Content.ReadAsStringAsync(); 41 | JObject jsonObj = JObject.Parse(content); 42 | 43 | var name = jsonObj["name"].ToString(); 44 | var Changelog = jsonObj["changelog"].ToString(); 45 | var version = jsonObj["version"].ToString(); 46 | var downloadUrl = jsonObj["link"].ToString(); 47 | 48 | return (name, version, downloadUrl, Changelog); 49 | } 50 | } -------------------------------------------------------------------------------- /WaveTools/Depend/GetNetData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using System.IO; 23 | using System.Net.Http; 24 | using System.Threading.Tasks; 25 | 26 | namespace WaveTools.Depend 27 | { 28 | class GetNetData 29 | { 30 | public async Task DownloadFileWithProgressAsync(string fileUrl, string localFilePath, IProgress progress) 31 | { 32 | try 33 | { 34 | string directoryPath = Path.GetDirectoryName(localFilePath); 35 | Directory.CreateDirectory(directoryPath); 36 | using (var httpClient = new HttpClient()) 37 | { 38 | using (var response = await httpClient.GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead)) 39 | { 40 | response.EnsureSuccessStatusCode(); 41 | 42 | using (var contentStream = await response.Content.ReadAsStreamAsync()) 43 | using (var fileStream = new FileStream(localFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) 44 | { 45 | long totalBytes = response.Content.Headers.ContentLength.GetValueOrDefault(); 46 | 47 | byte[] buffer = new byte[8192]; 48 | int bytesRead; 49 | long bytesDownloaded = 0; 50 | 51 | while ((bytesRead = await contentStream.ReadAsync(buffer, 0, buffer.Length)) > 0) 52 | { 53 | await fileStream.WriteAsync(buffer, 0, bytesRead); 54 | 55 | bytesDownloaded += bytesRead; 56 | double progressPercentage = (double)bytesDownloaded / totalBytes * 100; 57 | progress.Report(progressPercentage); 58 | 59 | } 60 | } 61 | } 62 | } 63 | return true; // 下载成功 64 | } 65 | catch (Exception ex) 66 | { 67 | Console.WriteLine($"Error: {ex.Message}"); 68 | return false; // 下载失败 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /WaveTools/Depend/GetNotify.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System.Linq; 3 | using System.IO; 4 | using Windows.Storage; 5 | using System; 6 | using Newtonsoft.Json; 7 | using System.Collections.Generic; 8 | using System.Net.Http; 9 | using System.Threading.Tasks; 10 | 11 | namespace WaveTools.Depend 12 | { 13 | public class GetNotify 14 | { 15 | public string content { get; set; } 16 | public string jumpUrl { get; set; } 17 | public string time { get; set; } 18 | 19 | public async Task Get() 20 | { 21 | string apiAddress = "https://pcdownload-wangsu.aki-game.com/pcstarter/prod/starter/10003_Y8xXrXk65DqFHEDgApn3cpK5lfczpFx5/G152/guidance/zh-Hans.json"; 22 | 23 | using (HttpClient client = new HttpClient()) 24 | { 25 | try 26 | { 27 | // 使用 HttpClient 发送请求并获取响应 28 | string jsonResponse = await client.GetStringAsync(apiAddress); 29 | 30 | // 将API响应转换为JSON对象并筛选特定类型的帖子 31 | var jsonObject = JObject.Parse(jsonResponse); 32 | 33 | var activityPosts = jsonObject["guidance"]["activity"]["contents"].Children().ToList(); 34 | var newsPosts = jsonObject["guidance"]["news"]["contents"].Children().ToList(); 35 | var noticePosts = jsonObject["guidance"]["notice"]["contents"].Children().ToList(); 36 | 37 | // 获取用户文档目录下的JSG-LLC\WaveTools\Posts目录 38 | string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 39 | string waveToolsFolderPath = Path.Combine(documentsPath, "JSG-LLC", "WaveTools", "Posts"); 40 | 41 | // 确保目录存在 42 | Directory.CreateDirectory(waveToolsFolderPath); 43 | 44 | // 文件路径 45 | string activityFilePath = Path.Combine(waveToolsFolderPath, "activity.json"); 46 | string newsFilePath = Path.Combine(waveToolsFolderPath, "news.json"); 47 | string noticeFilePath = Path.Combine(waveToolsFolderPath, "notice.json"); 48 | 49 | // 将结果保存到文件中 50 | await File.WriteAllTextAsync(activityFilePath, JArray.FromObject(activityPosts).ToString()); 51 | await File.WriteAllTextAsync(newsFilePath, JArray.FromObject(newsPosts).ToString()); 52 | await File.WriteAllTextAsync(noticeFilePath, JArray.FromObject(noticePosts).ToString()); 53 | } 54 | catch (Exception ex) 55 | { 56 | // 打印错误信息 57 | Console.WriteLine("Error: " + ex.Message); 58 | } 59 | } 60 | } 61 | 62 | public List GetData(string localData) 63 | { 64 | var records = JsonConvert.DeserializeObject>(localData); 65 | return records; 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /WaveTools/Depend/GetUpdate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using System.Threading.Tasks; 23 | using Windows.ApplicationModel; 24 | using Windows.Storage; 25 | using System.IO; 26 | using System.Diagnostics; 27 | using WaveTools.Depend; 28 | 29 | namespace WaveTools.Depend 30 | { 31 | class GetUpdate 32 | { 33 | private static readonly GetGithubLatest _getGithubLatest = new GetGithubLatest(); 34 | private static readonly GetJSGLatest _getJSGLatest = new GetJSGLatest(); 35 | 36 | public static async Task GetWaveToolsUpdate() 37 | { 38 | UpdateResult result = await OnGetUpdateLatestReleaseInfo("WaveTools"); 39 | return result; 40 | } 41 | 42 | public static async Task GetDependUpdate() 43 | { 44 | UpdateResult result = await OnGetUpdateLatestReleaseInfo("WaveToolsHelper", "Depend"); 45 | return result; 46 | } 47 | 48 | private static async Task OnGetUpdateLatestReleaseInfo(string PkgName, string Mode = null) 49 | { 50 | PackageVersion packageVersion = Package.Current.Id.Version; 51 | string currentVersion = $"{packageVersion.Major}.{packageVersion.Minor}.{packageVersion.Build}.{packageVersion.Revision}"; 52 | Version currentVersionParsed = new Version(currentVersion); 53 | try 54 | { 55 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 56 | var latestReleaseInfo = await _getJSGLatest.GetLatestReleaseInfoAsync("cn.jamsg.WaveTools"); 57 | Logging.Write("Getting Update Info...", 0); 58 | 59 | switch (AppDataController.GetUpdateService()) 60 | { 61 | case 0: 62 | Logging.Write("UpdateService:Github", 0); 63 | if (Mode == "Depend") 64 | { 65 | latestReleaseInfo = await _getGithubLatest.GetLatestDependReleaseInfoAsync("JamXi233", "Releases", PkgName); 66 | } 67 | else 68 | { 69 | latestReleaseInfo = await _getGithubLatest.GetLatestReleaseInfoAsync("JamXi233", PkgName); 70 | } 71 | break; 72 | case 2: 73 | Logging.Write("UpdateService:JSG-DS", 0); 74 | latestReleaseInfo = await _getJSGLatest.GetLatestReleaseInfoAsync("cn.jamsg." + PkgName); 75 | break; 76 | default: 77 | Logging.Write($"Invalid update service value: {AppDataController.GetUpdateService()}", 0); 78 | throw new InvalidOperationException($"Invalid update service value: {AppDataController.GetUpdateService()}"); 79 | } 80 | 81 | Logging.Write("Software Name:" + latestReleaseInfo.Name, 0); 82 | Logging.Write("Newer Version:" + latestReleaseInfo.Version, 0); 83 | 84 | if (Mode == "Depend") 85 | { 86 | string userDocumentsFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 87 | string exePath = Path.Combine(userDocumentsFolderPath, "JSG-LLC", "WaveTools", "Depends", PkgName, "WaveToolsHelper.exe"); 88 | 89 | Version installedVersionParsed; 90 | if (File.Exists(exePath)) 91 | { 92 | FileVersionInfo fileInfo = FileVersionInfo.GetVersionInfo(exePath); 93 | installedVersionParsed = new Version(fileInfo.FileVersion); 94 | } 95 | else 96 | { 97 | installedVersionParsed = new Version("0.0.0.0"); 98 | } 99 | 100 | Version latestVersionParsed = new Version(latestReleaseInfo.Version); 101 | if (latestVersionParsed > installedVersionParsed) 102 | { 103 | App.IsWaveToolsHelperRequireUpdate = true; 104 | return new UpdateResult(1, latestReleaseInfo.Version, latestReleaseInfo.Changelog); 105 | } 106 | App.IsWaveToolsHelperRequireUpdate = false; 107 | return new UpdateResult(0, installedVersionParsed.ToString(), string.Empty); 108 | } 109 | 110 | else 111 | { 112 | Version latestVersionParsed = new Version(latestReleaseInfo.Version); 113 | 114 | if (latestVersionParsed > currentVersionParsed) 115 | { 116 | App.IsWaveToolsRequireUpdate = true; 117 | return new UpdateResult(1, latestReleaseInfo.Version, latestReleaseInfo.Changelog); 118 | } 119 | return new UpdateResult(0, currentVersion, string.Empty); 120 | } 121 | } 122 | catch (Exception) 123 | { 124 | App.IsWaveToolsRequireUpdate = false; 125 | return new UpdateResult(2, string.Empty, string.Empty); 126 | } 127 | } 128 | 129 | } 130 | public class UpdateResult 131 | { 132 | public int Status { get; set; } // 0: 无更新, 1: 有更新, 2: 错误 133 | public string Version { get; set; } // 版本号 134 | public string Changelog { get; set; } // 更新日志 135 | 136 | public UpdateResult(int status, string version, string changelog) 137 | { 138 | Status = status; 139 | Version = version; 140 | Changelog = changelog; 141 | 142 | } 143 | } 144 | 145 | } 146 | -------------------------------------------------------------------------------- /WaveTools/Depend/InstallFont.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using Microsoft.Win32; 22 | using System; 23 | using System.Collections.Generic; 24 | using System.ComponentModel; 25 | using System.Diagnostics; 26 | using System.IO; 27 | using System.IO.Compression; 28 | using System.Linq; 29 | using System.Runtime.InteropServices; 30 | using System.Text; 31 | using System.Threading.Tasks; 32 | using Windows.Storage; 33 | using Windows.System; 34 | 35 | namespace WaveTools.Depend 36 | { 37 | class InstallFont 38 | { 39 | 40 | public static async Task InstallSegoeFluentFontAsync(IProgress progress) 41 | { 42 | string updateFileFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "JSG-LLC", "Fonts"); 43 | string updateFileName = "SegoeFluentIcons.zip"; 44 | string localFilePath = Path.Combine(updateFileFolder, updateFileName); 45 | string fontName = "Segoe Fluent Icons.ttf"; 46 | 47 | // 确保字体文件夹存在 48 | Directory.CreateDirectory(updateFileFolder); 49 | 50 | // 下载字体文件 51 | try 52 | { 53 | var getNetData = new GetNetData(); 54 | await getNetData.DownloadFileWithProgressAsync("https://aka.ms/SegoeFluentIcons", localFilePath, progress); 55 | } 56 | catch (Exception ex) 57 | { 58 | Console.WriteLine($"下载字体时出错: {ex.Message}"); 59 | return 1; // 表示下载失败 60 | } 61 | 62 | // 解压字体文件 63 | string tempFolder = Path.Combine(updateFileFolder, "temp"); 64 | 65 | // 确保临时文件夹不存在,如果存在则删除 66 | if (Directory.Exists(tempFolder)) 67 | { 68 | Directory.Delete(tempFolder, true); 69 | } 70 | 71 | // 重新创建临时文件夹 72 | Directory.CreateDirectory(tempFolder); 73 | 74 | try 75 | { 76 | ZipFile.ExtractToDirectory(localFilePath, tempFolder); 77 | } 78 | catch (IOException ex) 79 | { 80 | Console.WriteLine($"解压时出错: {ex.Message}"); 81 | // 可以选择在这里处理错误或返回 82 | return 1; 83 | } 84 | 85 | // 获取字体文件路径 86 | string fontFilePath = Path.Combine(tempFolder, fontName); 87 | 88 | if (!File.Exists(fontFilePath)) 89 | { 90 | Console.WriteLine("字体文件不存在."); 91 | return 1; // 字体文件未找到 92 | } 93 | 94 | // 打开字体文件以供用户安装 95 | Process.Start("explorer", fontFilePath); 96 | 97 | App.WaitOverlayManager.RaiseWaitOverlay(true, "请点击安装", "安装后需要重启工具箱来生效", false, 0); 98 | 99 | return 0; // 表示字体文件已打开等待用户操作 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /WaveTools/Depend/InstallerHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using Newtonsoft.Json; 22 | using WaveTools.Depend; 23 | using System; 24 | using System.Diagnostics; 25 | using System.IO; 26 | using System.Net.Http; 27 | using System.Threading.Tasks; 28 | 29 | namespace WaveTools.Depend 30 | { 31 | public class InstallerHelper 32 | { 33 | private static readonly string BaseInstallerPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "JSG-LLC", "WaveTools", "Installer"); 34 | private static string InstallerFileName = "WaveToolsInstaller.exe"; 35 | private static string InstallerFullPath = Path.Combine(BaseInstallerPath, InstallerFileName); 36 | private static readonly string InstallerInfoUrl = "https://api.jamsg.cn/release/getversion?package=cn.jamsg.WaveToolsinstaller"; 37 | 38 | public static bool CheckInstaller() 39 | { 40 | return File.Exists(InstallerFullPath); 41 | } 42 | 43 | // 检查 Installer 是否存在 44 | public static async Task GetInstaller() 45 | { 46 | using (var httpClient = new HttpClient()) 47 | { 48 | try 49 | { 50 | // 从 API 获取安装程序信息 51 | string json = await httpClient.GetStringAsync(InstallerInfoUrl); 52 | dynamic installerInfo = JsonConvert.DeserializeObject(json); 53 | string downloadLink = installerInfo.link; 54 | 55 | // 确保安装程序目录存在 56 | if (!Directory.Exists(BaseInstallerPath)) 57 | { 58 | Directory.CreateDirectory(BaseInstallerPath); 59 | } 60 | 61 | // 下载安装程序 62 | using (var response = await httpClient.GetAsync(downloadLink)) 63 | { 64 | if (response.IsSuccessStatusCode) 65 | { 66 | using (var fs = new FileStream(InstallerFullPath, FileMode.Create)) 67 | { 68 | await response.Content.CopyToAsync(fs); 69 | } 70 | } 71 | else 72 | { 73 | throw new Exception("无法下载安装程序"); 74 | } 75 | } 76 | } 77 | catch (Exception ex) 78 | { 79 | Logging.Write($"下载安装程序时出错: {ex.Message}", 3); 80 | } 81 | } 82 | } 83 | 84 | public static int RunInstaller(string args = "") 85 | { 86 | if (!File.Exists(InstallerFullPath)) 87 | { 88 | Logging.Write("安装程序不存在,请先下载。", 1); 89 | return -1; 90 | } 91 | 92 | ProcessStartInfo startInfo = new ProcessStartInfo 93 | { 94 | FileName = InstallerFullPath, 95 | Arguments = args, 96 | UseShellExecute = true, // 使用Shell以提升权限 97 | Verb = "runas" // 请求提升权限 98 | }; 99 | 100 | try 101 | { 102 | using (Process process = Process.Start(startInfo)) 103 | { 104 | process.WaitForExit(); 105 | 106 | // 检查退出代码 107 | if (process.ExitCode != 0) 108 | { 109 | Logging.Write($"安装程序退出代码: {process.ExitCode}", 2); 110 | } 111 | 112 | return process.ExitCode; 113 | } 114 | } 115 | catch (Exception ex) 116 | { 117 | Logging.Write($"运行安装程序时出错: {ex.Message}", 2); 118 | return -2; 119 | } 120 | } 121 | 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /WaveTools/Depend/MainFrameController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | 22 | using Microsoft.UI.Xaml.Controls; 23 | using WaveTools.Views.ToolViews; 24 | using WaveTools.Views; 25 | using System; 26 | 27 | namespace WaveTools.Depend 28 | { 29 | public class MainFrameController 30 | { 31 | private Frame mainFrame; 32 | 33 | public MainFrameController(Frame frame) 34 | { 35 | this.mainFrame = frame; 36 | } 37 | 38 | public void Navigate(string tag) 39 | { 40 | switch (tag) 41 | { 42 | case "home": 43 | mainFrame.Navigate(typeof(MainView)); 44 | break; 45 | case "startgame": 46 | mainFrame.Navigate(typeof(StartGameView)); 47 | break; 48 | case "gacha": 49 | mainFrame.Navigate(typeof(GachaView)); 50 | break; 51 | case "donation": 52 | mainFrame.Navigate(typeof(DonationView)); 53 | break; 54 | case "settings": 55 | mainFrame.Navigate(typeof(AboutView)); 56 | break; 57 | default: 58 | throw new ArgumentException("Unknown navigation tag", nameof(tag)); 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /WaveTools/Depend/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using System.Runtime.InteropServices; 23 | 24 | namespace WaveTools.Depend 25 | { 26 | internal static class NativeMethods 27 | { 28 | [DllImport("user32.dll", SetLastError = true)] 29 | internal static extern int GetWindowLong(IntPtr hWnd, int nIndex); 30 | 31 | [DllImport("user32.dll", SetLastError = true)] 32 | internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); 33 | 34 | internal const int GWL_STYLE = -16; 35 | internal const int WS_SIZEBOX = 0x00040000; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /WaveTools/Depend/ProcessRun.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using System.Diagnostics; 23 | using System.IO; 24 | using System.Security.Principal; 25 | using System.Threading.Tasks; 26 | using Microsoft.UI.Xaml.Controls; 27 | using WaveTools.Depend; 28 | using static WaveTools.App; 29 | 30 | namespace WaveTools.Depend 31 | { 32 | class ProcessRun 33 | { 34 | public static async Task WaveToolsHelperAsync(string args) 35 | { 36 | return await Task.Run(() => 37 | { 38 | try 39 | { 40 | using (Process process = new Process()) 41 | { 42 | process.StartInfo.UseShellExecute = false; 43 | process.StartInfo.RedirectStandardOutput = true; 44 | process.StartInfo.RedirectStandardError = true; // 捕获标准错误输出 45 | process.StartInfo.FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"JSG-LLC\WaveTools\Depends\WaveToolsHelper\WaveToolsHelper.exe"); 46 | process.StartInfo.Arguments = args; 47 | 48 | Logging.Write($"Starting process: {process.StartInfo.FileName} with arguments: {args}", 0, "WaveToolsHelper"); 49 | 50 | process.Start(); 51 | 52 | // 同时读取标准输出和标准错误 53 | string output = process.StandardOutput.ReadToEnd(); 54 | string error = process.StandardError.ReadToEnd(); 55 | 56 | process.WaitForExit(); 57 | 58 | if (!string.IsNullOrEmpty(error)) 59 | { 60 | Logging.Write($"Error: {error}", 3, "WaveToolsHelper"); 61 | } 62 | 63 | Logging.Write(output.Trim(), 3, "WaveToolsHelper"); 64 | return output.Trim(); 65 | } 66 | } 67 | catch (Exception ex) 68 | { 69 | Logging.Write($"Exception in WaveToolsHelperAsync: {ex.Message}", 3, "WaveToolsHelper"); 70 | throw; 71 | } 72 | }); 73 | } 74 | 75 | public static void StopWaveToolsHelperProcess() 76 | { 77 | try 78 | { 79 | foreach (var process in Process.GetProcessesByName("WaveToolsHelper")) 80 | { 81 | process.Kill(); 82 | } 83 | NotificationManager.RaiseNotification("WaveToolsHelper", "已停止依赖运行", InfoBarSeverity.Warning); 84 | } 85 | catch (Exception ex) 86 | { 87 | NotificationManager.RaiseNotification("错误", "停止WaveToolsHelper失败"+ex.ToString(),InfoBarSeverity.Error); 88 | } 89 | } 90 | 91 | public static void StopWaveProcess() 92 | { 93 | foreach (var process in Process.GetProcessesByName("Client-Win64-Shipping")) 94 | { 95 | process.Kill(); 96 | } 97 | foreach (var process in Process.GetProcessesByName("KRSDKExternal")) 98 | { 99 | process.Kill(); 100 | } 101 | foreach (var process in Process.GetProcessesByName("Wuthering Waves")) 102 | { 103 | process.Kill(); 104 | } 105 | } 106 | 107 | public async static Task RestartApp() 108 | { 109 | Logging.Write("Restart WaveTools Requested",2); 110 | var processId = Process.GetCurrentProcess().Id; 111 | var fileName = Process.GetCurrentProcess().MainModule.FileName; 112 | ProcessStartInfo info = new ProcessStartInfo(fileName) 113 | { 114 | UseShellExecute = true, 115 | }; 116 | Process.Start(info); 117 | await Task.Delay(100); 118 | Process.GetProcessById(processId).Kill(); 119 | } 120 | 121 | public async static Task RequestAdminAndRestart() 122 | { 123 | Logging.Write("Restart WaveTools Requested", 2); 124 | var processId = Process.GetCurrentProcess().Id; 125 | var fileName = Process.GetCurrentProcess().MainModule.FileName; 126 | ProcessStartInfo info = new ProcessStartInfo(fileName) 127 | { 128 | UseShellExecute = true, 129 | Verb = "runas" 130 | }; 131 | Process.Start(info); 132 | Process.GetProcessById(processId).Kill(); 133 | } 134 | 135 | public static bool IsRunAsAdmin() 136 | { 137 | using (WindowsIdentity identity = WindowsIdentity.GetCurrent()) 138 | { 139 | WindowsPrincipal principal = new WindowsPrincipal(identity); 140 | return principal.IsInRole(WindowsBuiltInRole.Administrator); 141 | } 142 | } 143 | 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /WaveTools/Depend/UIHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml.Controls; 2 | using Microsoft.UI.Xaml.Media; 3 | using Microsoft.UI.Xaml; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace WaveTools.Depend 11 | { 12 | public static class UIHelper 13 | { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /WaveTools/Depend/WindowHelper.cs: -------------------------------------------------------------------------------- 1 | //********************************************************* 2 | // 3 | // Copyright (c) Microsoft. All rights reserved. 4 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 6 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 7 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 8 | // 9 | //********************************************************* 10 | 11 | using Microsoft.UI; 12 | using Microsoft.UI.Windowing; 13 | using Microsoft.UI.Xaml; 14 | using System; 15 | using System.Collections.Generic; 16 | using WinRT.Interop; 17 | 18 | namespace WaveTools.Depend 19 | { 20 | // Helper class to allow the app to find the Window that contains an 21 | // arbitrary UIElement (GetWindowForElement). To do this, we keep track 22 | // of all active Windows. The app code must call WindowHelper.CreateWindow 23 | // rather than "new Window" so we can keep track of all the relevant 24 | // windows. In the future, we would like to support this in platform APIs. 25 | public class WindowHelper 26 | { 27 | static public Window CreateWindow() 28 | { 29 | Window newWindow = new Window(); 30 | TrackWindow(newWindow); 31 | return newWindow; 32 | } 33 | 34 | static public void TrackWindow(Window window) 35 | { 36 | window.Closed += (sender, args) => { 37 | _activeWindows.Remove(window); 38 | }; 39 | _activeWindows.Add(window); 40 | } 41 | 42 | static public AppWindow GetAppWindow(Window window) 43 | { 44 | IntPtr hWnd = WindowNative.GetWindowHandle(window); 45 | WindowId wndId = Win32Interop.GetWindowIdFromWindow(hWnd); 46 | return AppWindow.GetFromWindowId(wndId); 47 | } 48 | 49 | public static IntPtr GetWindowForElement(FrameworkElement element) 50 | { 51 | if (element.XamlRoot != null) 52 | { 53 | return WindowNative.GetWindowHandle(element.XamlRoot); 54 | } 55 | return IntPtr.Zero; 56 | } 57 | 58 | static public UIElement FindElementByName(UIElement element, string name) 59 | { 60 | if (element.XamlRoot != null && element.XamlRoot.Content != null) 61 | { 62 | var ele = (element.XamlRoot.Content as FrameworkElement).FindName(name); 63 | if (ele != null) 64 | { 65 | return ele as UIElement; 66 | } 67 | } 68 | return null; 69 | } 70 | 71 | static public List ActiveWindows { get { return _activeWindows; } } 72 | 73 | static private List _activeWindows = new List(); 74 | } 75 | } -------------------------------------------------------------------------------- /WaveTools/Imgs/Don_Alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Don_Alipay.png -------------------------------------------------------------------------------- /WaveTools/Imgs/Don_Hand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Don_Hand.gif -------------------------------------------------------------------------------- /WaveTools/Imgs/Don_Hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Don_Hand.png -------------------------------------------------------------------------------- /WaveTools/Imgs/Don_Icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Don_Icon.gif -------------------------------------------------------------------------------- /WaveTools/Imgs/Don_Wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Don_Wechat.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_Day.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_Day.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_DayNight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_DayNight.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_Download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_Download.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_Next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_Next.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_Night.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_Night.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_Question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_Question.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_Recover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_Recover.png -------------------------------------------------------------------------------- /WaveTools/Imgs/FirstRun_Windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/FirstRun_Windows.png -------------------------------------------------------------------------------- /WaveTools/Imgs/JSG_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/JSG_Logo.png -------------------------------------------------------------------------------- /WaveTools/Imgs/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Logo.png -------------------------------------------------------------------------------- /WaveTools/Imgs/Logo_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Logo_2.jpg -------------------------------------------------------------------------------- /WaveTools/Imgs/Logo_Background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Logo_Background.png -------------------------------------------------------------------------------- /WaveTools/Imgs/Logo_Gitee.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Logo_Gitee.jpg -------------------------------------------------------------------------------- /WaveTools/Imgs/Logo_Github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Logo_Github.png -------------------------------------------------------------------------------- /WaveTools/Imgs/Logo_JSG-R.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Imgs/Logo_JSG-R.png -------------------------------------------------------------------------------- /WaveTools/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0,48,0,0 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 53 | 54 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/FirstRunGetDepend.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using Microsoft.UI.Xaml; 22 | using Microsoft.UI.Xaml.Controls; 23 | using WaveTools.Depend; 24 | using System.Diagnostics; 25 | using System; 26 | using Windows.Storage; 27 | using System.IO; 28 | using System.IO.Compression; 29 | using Microsoft.UI.Xaml.Media; 30 | using WaveTools.Depend; 31 | 32 | namespace WaveTools.Views.FirstRunViews 33 | { 34 | public sealed partial class FirstRunGetDepend : Page 35 | { 36 | private MainWindow mainWindow; 37 | string fileUrl; 38 | private GetNetData _getNetData; 39 | private readonly GetGithubLatest _getGithubLatest = new GetGithubLatest(); 40 | private readonly GetJSGLatest _getJSGLatest = new GetJSGLatest(); 41 | 42 | public FirstRunGetDepend() 43 | { 44 | this.InitializeComponent(); 45 | Logging.Write("Switch to FirstRunGetDepend", 0); 46 | AppDataController.SetFirstRunStatus(4); 47 | OnGetDependLatestReleaseInfo(); 48 | } 49 | 50 | //依赖下载开始 51 | 52 | private const string FileFolder = "\\JSG-LLC\\WaveTools\\Depends"; 53 | private const string ZipFileName = "WaveToolsHelper.zip"; 54 | private const string ExtractedFolder = "WaveToolsHelper"; 55 | 56 | private async void DependDownload_Click(object sender, RoutedEventArgs e) 57 | { 58 | depend_Progress_Text.Text = "正在下载..."; 59 | _getNetData = new GetNetData(); 60 | string userDocumentsFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 61 | string localFilePath = Path.Combine(userDocumentsFolderPath + FileFolder, ZipFileName); 62 | Trace.WriteLine(fileUrl); 63 | ToggleDependGridVisibility(false); 64 | depend_Download.IsEnabled = false; 65 | var progress = new Progress(DependReportProgress); 66 | bool downloadResult = false; 67 | try 68 | { 69 | downloadResult = await _getNetData.DownloadFileWithProgressAsync(fileUrl, localFilePath, progress); 70 | } 71 | catch (Exception ex) 72 | { 73 | Logging.Write($"Download error: {ex.Message}", 0); 74 | throw new Exception(ex.Message); 75 | } 76 | 77 | if (downloadResult) 78 | { 79 | string extractionPath = Path.Combine(userDocumentsFolderPath + FileFolder, ExtractedFolder); 80 | if (File.Exists(extractionPath + "\\WaveToolsHelper.exe")) 81 | { 82 | mainWindow?.KillFirstUI(); 83 | Frame parentFrame = GetParentFrame(this); 84 | if (parentFrame != null) 85 | { 86 | parentFrame.Navigate(typeof(FirstRunExtra)); 87 | } 88 | } 89 | else 90 | { 91 | Trace.WriteLine(userDocumentsFolderPath); 92 | Trace.WriteLine(extractionPath); 93 | ZipFile.ExtractToDirectory(localFilePath, extractionPath); 94 | Frame parentFrame = GetParentFrame(this); 95 | if (parentFrame != null) 96 | { 97 | parentFrame.Navigate(typeof(FirstRunExtra)); 98 | } 99 | } 100 | } 101 | else 102 | { 103 | // 使用Dispatcher在UI线程上执行ToggleUpdateGridVisibility函数 104 | ToggleDependGridVisibility(true, false); 105 | } 106 | } 107 | 108 | private void ToggleDependGridVisibility(bool updateGridVisible, bool downloadSuccess = false) 109 | { 110 | depend_Grid.Visibility = updateGridVisible ? Visibility.Visible : Visibility.Collapsed; 111 | depend_Progress_Grid.Visibility = updateGridVisible ? Visibility.Collapsed : Visibility.Visible; 112 | depend_Btn_Text.Text = downloadSuccess ? "下载完成" : "下载失败"; 113 | } 114 | 115 | private async void OnGetDependLatestReleaseInfo() 116 | { 117 | depend_Progress_Text.Text = "正在获取..."; 118 | depend_Grid.Visibility = Visibility.Collapsed; 119 | depend_Progress_Grid.Visibility = Visibility.Visible; 120 | var dispatcher = Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread(); 121 | try 122 | { 123 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 124 | var latestReleaseInfo = await _getJSGLatest.GetLatestReleaseInfoAsync("cn.jamsg.WaveToolshelper"); 125 | switch (localSettings.Values["Config_UpdateService"]) 126 | { 127 | case 0: 128 | latestReleaseInfo = await _getGithubLatest.GetLatestDependReleaseInfoAsync("JamXi233", "Releases", "WaveToolsHelper"); 129 | break; 130 | case 2: 131 | latestReleaseInfo = await _getJSGLatest.GetLatestReleaseInfoAsync("cn.jamsg.WaveToolshelper"); 132 | break; 133 | default: 134 | throw new InvalidOperationException($"Invalid update service value: {localSettings.Values["Config_UpdateService"]}"); 135 | } 136 | 137 | fileUrl = latestReleaseInfo.DownloadUrl; 138 | dispatcher.TryEnqueue(() => 139 | { 140 | depend_Latest_Name.Text = $"依赖项: {latestReleaseInfo.Name}"; 141 | depend_Latest_Version.Text = $"版本号: {latestReleaseInfo.Version}"; 142 | depend_Download.IsEnabled = true; 143 | depend_Grid.Visibility = Visibility.Visible; 144 | depend_Progress_Grid.Visibility = Visibility.Collapsed; 145 | }); 146 | } 147 | catch (Exception ex) 148 | { 149 | dispatcher.TryEnqueue(() => 150 | { 151 | depend_Grid.Visibility = Visibility.Visible; 152 | depend_Progress_Grid.Visibility = Visibility.Collapsed; 153 | depend_Btn_Text.Text = "获取失败"; 154 | depend_Latest_Version.Text = ex.Message; 155 | depend_Btn_Bar.Visibility = Visibility.Collapsed; 156 | }); 157 | Logging.Write($"Error fetching latest release info: {ex.Message}", 0); 158 | } 159 | } 160 | 161 | private void DependReportProgress(double progressPercentage) 162 | { 163 | depend_Btn_Bar.Value = progressPercentage; 164 | } 165 | 166 | private Frame GetParentFrame(FrameworkElement child) 167 | { 168 | 169 | DependencyObject parent = VisualTreeHelper.GetParent(child); 170 | 171 | while (parent != null && !(parent is Frame)) 172 | { 173 | parent = VisualTreeHelper.GetParent(parent); 174 | } 175 | 176 | return parent as Frame; 177 | } 178 | 179 | } 180 | } -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/FirstRunInit.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 52 | 53 | 54 | 55 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/FirstRunInit.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using Microsoft.UI.Xaml.Controls; 22 | using System.Threading.Tasks; 23 | using WaveTools.Depend; 24 | using Microsoft.UI.Xaml; 25 | using System; 26 | using Windows.Storage.Pickers; 27 | using System.IO; 28 | using System.IO.Compression; 29 | using Windows.Storage; 30 | using Microsoft.UI.Xaml.Media; 31 | using System.Diagnostics; 32 | using WaveTools.Depend; 33 | 34 | namespace WaveTools.Views.FirstRunViews 35 | { 36 | public sealed partial class FirstRunInit : Page 37 | { 38 | public FirstRunInit() 39 | { 40 | this.InitializeComponent(); 41 | Logging.Write("Switch to FirstRunInit", 0); 42 | AppDataController.SetFirstRunStatus(1); 43 | } 44 | 45 | private void NextPage(object sender, RoutedEventArgs e) 46 | { 47 | Frame parentFrame = GetParentFrame(this); 48 | if (parentFrame != null) 49 | { 50 | // 前往下载依赖页面 51 | parentFrame.Navigate(typeof(FirstRunTheme)); 52 | } 53 | } 54 | 55 | private async void Restore_Data(object sender, RoutedEventArgs e) 56 | { 57 | string filePath = await CommonHelpers.FileHelpers.OpenFile(".WaveToolsBackup"); 58 | 59 | if (filePath != null) 60 | { 61 | string userDocumentsFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 62 | DeleteFolder(userDocumentsFolderPath + "\\JSG-LLC\\WaveTools\\", "0"); 63 | Task.Run(() => ZipFile.ExtractToDirectory(filePath, userDocumentsFolderPath + "\\JSG-LLC\\WaveTools\\")).Wait(); 64 | Frame parentFrame = GetParentFrame(this); 65 | if (parentFrame != null) 66 | { 67 | // 前往下载依赖页面 68 | parentFrame.Navigate(typeof(FirstRunTheme)); 69 | } 70 | } 71 | } 72 | 73 | private void DeleteFolder(string folderPath, String Close) 74 | { 75 | if (Directory.Exists(folderPath)) 76 | { 77 | try { Directory.Delete(folderPath, true); } 78 | catch (IOException) { } 79 | } 80 | } 81 | 82 | private async Task DeleteFilesAndSubfoldersAsync(StorageFolder folder, String Close) 83 | { 84 | // 获取文件夹中的所有文件和子文件夹 85 | var items = await folder.GetItemsAsync(); 86 | 87 | // 遍历所有项目 88 | foreach (var item in items) 89 | { 90 | // 如果项目是文件,则删除它 91 | if (item is StorageFile file) 92 | { 93 | await file.DeleteAsync(); 94 | } 95 | // 如果项目是文件夹,则递归删除其中所有文件和子文件夹 96 | else if (item is StorageFolder subfolder) 97 | { 98 | await DeleteFilesAndSubfoldersAsync(subfolder, Close); 99 | 100 | // 删除子文件夹本身 101 | await subfolder.DeleteAsync(); 102 | } 103 | } 104 | if (Close == "1") 105 | { 106 | Application.Current.Exit(); 107 | } 108 | } 109 | 110 | private Frame GetParentFrame(FrameworkElement child) 111 | { 112 | 113 | DependencyObject parent = VisualTreeHelper.GetParent(child); 114 | 115 | while (parent != null && !(parent is Frame)) 116 | { 117 | parent = VisualTreeHelper.GetParent(parent); 118 | } 119 | 120 | return parent as Frame; 121 | } 122 | 123 | } 124 | 125 | } -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/FirstRunSourceSelect.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 48 | 49 | 50 | 51 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/FirstRunSourceSelect.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using Microsoft.UI.Xaml; 22 | using Microsoft.UI.Xaml.Controls; 23 | using Microsoft.UI.Xaml.Media; 24 | using WaveTools.Depend; 25 | using WaveTools.Depend; 26 | using Windows.Storage; 27 | 28 | namespace WaveTools.Views.FirstRunViews 29 | { 30 | public sealed partial class FirstRunSourceSelect : Page 31 | { 32 | public FirstRunSourceSelect() 33 | { 34 | this.InitializeComponent(); 35 | Logging.Write("Switch to FirstRunSourceSelect", 0); 36 | AppDataController.SetFirstRunStatus(3); 37 | } 38 | 39 | //选择下载渠道开始 40 | private void DSerivceChooseFinish() 41 | {; 42 | Frame parentFrame = GetParentFrame(this); 43 | if (parentFrame != null) 44 | { 45 | // 前往下载依赖页面 46 | parentFrame.Navigate(typeof(FirstRunGetDepend)); 47 | } 48 | } 49 | 50 | private void DService_Github_Choose(object sender, RoutedEventArgs e) 51 | { 52 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 53 | localSettings.Values["Config_UpdateService"] = 0; 54 | DSerivceChooseFinish(); 55 | } 56 | 57 | private void DService_JSG_Choose(object sender, RoutedEventArgs e) 58 | { 59 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 60 | localSettings.Values["Config_UpdateService"] = 2; 61 | DSerivceChooseFinish(); 62 | } 63 | 64 | private Frame GetParentFrame(FrameworkElement child) 65 | { 66 | 67 | DependencyObject parent = VisualTreeHelper.GetParent(child); 68 | 69 | while (parent != null && !(parent is Frame)) 70 | { 71 | parent = VisualTreeHelper.GetParent(parent); 72 | } 73 | 74 | return parent as Frame; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/FirstRunTheme.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/FirstRunTheme.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using Microsoft.UI.Xaml; 23 | using Microsoft.UI.Xaml.Controls; 24 | using System.Threading.Tasks; 25 | using WaveTools.Depend; 26 | using Windows.Storage; 27 | using System.Diagnostics; 28 | using Microsoft.UI.Xaml.Media; 29 | using WaveTools.Depend; 30 | 31 | namespace WaveTools.Views.FirstRunViews 32 | { 33 | public sealed partial class FirstRunTheme : Page 34 | { 35 | public FirstRunTheme() 36 | { 37 | this.InitializeComponent(); 38 | Logging.Write("Switch to FirstRunTheme", 0); 39 | AppDataController.SetFirstRunStatus(2); 40 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 41 | if (localSettings.Values["Config_DayNight"] != null) 42 | { 43 | //通过本地设置获取主题模式,并设置按钮状态 44 | if (localSettings.Values["Config_DayNight"].ToString() == "0") 45 | { 46 | FollowSystemButton.IsChecked = true; 47 | } 48 | if (localSettings.Values["Config_DayNight"].ToString() == "1") 49 | { 50 | DayModeButton.IsChecked = true; 51 | } 52 | if (localSettings.Values["Config_DayNight"].ToString() == "2") 53 | { 54 | NightModeButton.IsChecked = true; 55 | } 56 | } 57 | } 58 | 59 | private void FollowSystemButton_Click(object sender, RoutedEventArgs e) 60 | { 61 | SetTheme(ThemeMode.System); 62 | ChangeThemeRestartApp(); 63 | } 64 | 65 | private void DayModeButton_Click(object sender, RoutedEventArgs e) 66 | { 67 | SetTheme(ThemeMode.Light); 68 | ChangeThemeRestartApp(); 69 | } 70 | 71 | private void NightModeButton_Click(object sender, RoutedEventArgs e) 72 | { 73 | SetTheme(ThemeMode.Dark); 74 | ChangeThemeRestartApp(); 75 | } 76 | 77 | private void ThemeFinish_Click(object sender, RoutedEventArgs e) 78 | { 79 | Frame parentFrame = GetParentFrame(this); 80 | if (parentFrame != null) 81 | { 82 | // 前往下载依赖页面 83 | parentFrame.Navigate(typeof(FirstRunSourceSelect)); 84 | } 85 | } 86 | 87 | private Frame GetParentFrame(FrameworkElement child) 88 | { 89 | 90 | DependencyObject parent = VisualTreeHelper.GetParent(child); 91 | 92 | while (parent != null && !(parent is Frame)) 93 | { 94 | parent = VisualTreeHelper.GetParent(parent); 95 | } 96 | 97 | return parent as Frame; 98 | } 99 | 100 | private void SetTheme(ThemeMode mode) 101 | { 102 | ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; 103 | localSettings.Values["Config_DayNight"] = (int)mode; 104 | } 105 | 106 | private async void ChangeThemeRestartApp() 107 | { 108 | // 获取当前应用程序的进程 ID 和文件路径 109 | var processId = Process.GetCurrentProcess().Id; 110 | var fileName = Process.GetCurrentProcess().MainModule.FileName; 111 | 112 | // 启动一个新的应用程序实例 113 | ProcessStartInfo info = new ProcessStartInfo(fileName) 114 | { 115 | UseShellExecute = true, 116 | }; 117 | Process.Start(info); 118 | 119 | // 给新的实例一些时间来启动 120 | await Task.Delay(100); // 延迟时间可能需要根据应用程序的启动时间来调整 121 | 122 | // 关闭当前应用程序实例 123 | Process.GetProcessById(processId).Kill(); 124 | } 125 | } 126 | 127 | public enum ThemeMode 128 | { 129 | System = 0, 130 | Light = 1, 131 | Dark = 2 132 | } 133 | 134 | } -------------------------------------------------------------------------------- /WaveTools/Views/FirstRunViews/order.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Views/FirstRunViews/order.md -------------------------------------------------------------------------------- /WaveTools/Views/GachaViews/TempGachaView.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /WaveTools/Views/GachaViews/TempGachaView.xaml.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Views/GachaViews/TempGachaView.xaml.cs -------------------------------------------------------------------------------- /WaveTools/Views/MainView.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 50 | 51 | 52 | 53 | 54 | 55 | 61 | 67 | 68 | 69 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /WaveTools/Views/NotifyViews/NotifyAnnounceView.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /WaveTools/Views/NotifyViews/NotifyAnnounceView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using Microsoft.UI.Xaml.Controls; 23 | using WaveTools.Depend; 24 | using Windows.Storage; 25 | using System.Diagnostics; 26 | using System.Collections.Generic; 27 | using System.Threading.Tasks; 28 | using WaveTools.Depend; 29 | using System.IO; 30 | 31 | namespace WaveTools.Views.NotifyViews 32 | { 33 | public sealed partial class NotifyAnnounceView : Page 34 | { 35 | List list = new List(); 36 | public NotifyAnnounceView() 37 | { 38 | this.InitializeComponent(); 39 | Logging.Write("Switch to NotifyNewsView", 0); 40 | 41 | // 获取用户文档目录下的JSG-LLC\WaveTools\Posts目录 42 | string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 43 | string waveToolsFolderPath = Path.Combine(documentsPath, "JSG-LLC", "WaveTools", "Posts"); 44 | string settingsFilePath = Path.Combine(waveToolsFolderPath, "news.json"); 45 | 46 | // 确保目录和文件存在 47 | if (File.Exists(settingsFilePath)) 48 | { 49 | string notify = File.ReadAllText(settingsFilePath); 50 | GetNotify getNotify = new GetNotify(); 51 | var records = getNotify.GetData(notify); 52 | NotifyAnnounceView_List.ItemsSource = records; 53 | LoadData(records); 54 | } 55 | else 56 | { 57 | Logging.Write("Notice file not found", 0); 58 | } 59 | } 60 | 61 | private void LoadData(List getNotifies) 62 | { 63 | foreach (GetNotify getNotify in getNotifies) 64 | { 65 | list.Add(getNotify.jumpUrl); 66 | } 67 | } 68 | 69 | private async void List_PointerPressed(object sender, ItemClickEventArgs e) 70 | { 71 | await Task.Delay(TimeSpan.FromSeconds(0.1)); 72 | string url = list[NotifyAnnounceView_List.SelectedIndex]; // 替换为要打开的网页地址 73 | Process.Start(new ProcessStartInfo 74 | { 75 | FileName = url, 76 | UseShellExecute = true 77 | }); 78 | await Task.Delay(TimeSpan.FromSeconds(0.1)); 79 | NotifyAnnounceView_List.SelectedIndex = -1; 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /WaveTools/Views/NotifyViews/NotifyMessageView.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /WaveTools/Views/NotifyViews/NotifyMessageView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using Microsoft.UI.Xaml.Controls; 23 | using WaveTools.Depend; 24 | using Windows.Storage; 25 | using System.Collections.Generic; 26 | using System.Diagnostics; 27 | using System.Threading.Tasks; 28 | using WaveTools.Depend; 29 | using System.IO; 30 | 31 | namespace WaveTools.Views.NotifyViews 32 | { 33 | public sealed partial class NotifyMessageView : Page 34 | { 35 | List list = new List(); 36 | public NotifyMessageView() 37 | { 38 | this.InitializeComponent(); 39 | Logging.Write("Switch to NotifyPostsView", 0); 40 | 41 | // 获取用户文档目录下的JSG-LLC\WaveTools\Posts目录 42 | string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 43 | string waveToolsFolderPath = Path.Combine(documentsPath, "JSG-LLC", "WaveTools", "Posts"); 44 | string settingsFilePath = Path.Combine(waveToolsFolderPath, "notice.json"); 45 | 46 | // 确保目录和文件存在 47 | if (File.Exists(settingsFilePath)) 48 | { 49 | string notify = File.ReadAllText(settingsFilePath); 50 | GetNotify getNotify = new GetNotify(); 51 | var records = getNotify.GetData(notify); 52 | NotifyMessageView_List.ItemsSource = records; 53 | LoadData(records); 54 | } 55 | else 56 | { 57 | Logging.Write("Notice file not found", 0); 58 | } 59 | } 60 | 61 | private void LoadData(List getNotifies) 62 | { 63 | foreach (GetNotify getNotify in getNotifies) 64 | { 65 | list.Add(getNotify.jumpUrl); 66 | } 67 | } 68 | 69 | private async void List_PointerPressed(object sender, ItemClickEventArgs e) 70 | { 71 | await Task.Delay(TimeSpan.FromSeconds(0.1)); 72 | string url = list[NotifyMessageView_List.SelectedIndex]; // 替换为要打开的网页地址 73 | Process.Start(new ProcessStartInfo 74 | { 75 | FileName = url, 76 | UseShellExecute = true 77 | }); 78 | await Task.Delay(TimeSpan.FromSeconds(0.1)); 79 | NotifyMessageView_List.SelectedIndex = -1; 80 | } 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /WaveTools/Views/NotifyViews/NotifyNotificationView.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /WaveTools/Views/NotifyViews/NotifyNotificationView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using System; 22 | using Microsoft.UI.Xaml.Controls; 23 | using WaveTools.Depend; 24 | using Windows.Storage; 25 | using System.Collections.Generic; 26 | using System.Diagnostics; 27 | using System.Threading.Tasks; 28 | using WaveTools.Depend; 29 | using System.IO; 30 | 31 | namespace WaveTools.Views.NotifyViews 32 | { 33 | public sealed partial class NotifyNotificationView : Page 34 | { 35 | List list = new List(); 36 | public NotifyNotificationView() 37 | { 38 | this.InitializeComponent(); 39 | Logging.Write("Switch to NotifyActivityView", 0); 40 | 41 | // 获取用户文档目录下的JSG-LLC\WaveTools\Posts目录 42 | string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); 43 | string waveToolsFolderPath = Path.Combine(documentsPath, "JSG-LLC", "WaveTools", "Posts"); 44 | string settingsFilePath = Path.Combine(waveToolsFolderPath, "activity.json"); 45 | 46 | // 确保目录和文件存在 47 | if (File.Exists(settingsFilePath)) 48 | { 49 | string notify = File.ReadAllText(settingsFilePath); 50 | GetNotify getNotify = new GetNotify(); 51 | var records = getNotify.GetData(notify); 52 | NotifyNotificationView_List.ItemsSource = records; 53 | LoadData(records); 54 | } 55 | else 56 | { 57 | Logging.Write("Notice file not found", 0); 58 | } 59 | } 60 | 61 | private void LoadData(List getNotifies) 62 | { 63 | foreach (GetNotify getNotify in getNotifies) 64 | { 65 | list.Add(getNotify.jumpUrl); 66 | } 67 | } 68 | 69 | private async void List_PointerPressed(object sender, ItemClickEventArgs e) 70 | { 71 | await Task.Delay(TimeSpan.FromSeconds(0.1)); 72 | string url = list[NotifyNotificationView_List.SelectedIndex]; // 替换为要打开的网页地址 73 | Process.Start(new ProcessStartInfo 74 | { 75 | FileName = url, 76 | UseShellExecute = true 77 | }); 78 | await Task.Delay(TimeSpan.FromSeconds(0.1)); 79 | NotifyNotificationView_List.SelectedIndex = -1; 80 | } 81 | 82 | } 83 | } -------------------------------------------------------------------------------- /WaveTools/Views/SGViews/AccountView.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 118 | 119 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /WaveTools/Views/SGViews/AccountView.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2024, JamXi JSG-LLC. 2 | // All rights reserved. 3 | 4 | // This file is part of WaveTools. 5 | 6 | // WaveTools is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | 11 | // WaveTools is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // You should have received a copy of the GNU General Public License 17 | // along with WaveTools. If not, see . 18 | 19 | // For more information, please refer to 20 | 21 | using Microsoft.UI.Xaml; 22 | using Microsoft.UI.Xaml.Controls; 23 | using Newtonsoft.Json; 24 | using WaveTools.Depend; 25 | using System; 26 | using System.Collections.Generic; 27 | using System.Threading.Tasks; 28 | using static WaveTools.App; 29 | using System.Diagnostics; 30 | using WaveTools.Depend; 31 | 32 | namespace WaveTools.Views.SGViews 33 | { 34 | public sealed partial class AccountView : Page 35 | { 36 | 37 | public AccountView() 38 | { 39 | this.InitializeComponent(); 40 | Logging.Write("Switch to AccountView", 0); 41 | InitData(); 42 | } 43 | 44 | private async void InitData() 45 | { 46 | await LoadData(await ProcessRun.WaveToolsHelperAsync("/GetAllUser")); 47 | Account_Load.Visibility = Visibility.Collapsed; 48 | } 49 | 50 | private async Task LoadData(string jsonData) 51 | { 52 | StartGameView.SelectedUID = null; 53 | StartGameView.SelectedName = null; 54 | AccountListView.SelectionChanged -= AccountListView_SelectionChanged; 55 | loginNewAccount.IsEnabled = true; 56 | 57 | // 使用Task.Run在后台线程中执行反序列化操作 58 | List accounts = await Task.Run(() => JsonConvert.DeserializeObject>(jsonData)); 59 | 60 | AccountListView.ItemsSource = accounts; // 确保将反序列化后的数据绑定到UI 61 | 62 | AccountListView.SelectionChanged += AccountListView_SelectionChanged; 63 | refreshAccount.Visibility = Visibility.Visible; 64 | refreshAccount_Loading.Visibility = Visibility.Collapsed; 65 | } 66 | 67 | private void LoginAccount(object sender, RoutedEventArgs e) 68 | { 69 | loginAccount.IsOpen = true; 70 | } 71 | 72 | private async void LoginAccount_C(TeachingTip sender, object args) 73 | { 74 | loginAccount.IsOpen = false; 75 | GameStartUtil gameStartUtil = new GameStartUtil(); 76 | gameStartUtil.StartGame(); 77 | try 78 | { 79 | // 删除所有登录信息 80 | await ProcessRun.WaveToolsHelperAsync("/RemoveAllLogin"); 81 | // 显示等待提示,并启用按钮以强行停止进程 82 | WaitOverlayManager.RaiseWaitOverlay(true, "等待登录账号", "游戏已经启动,请登录您的账号记录下UID后退出游戏。", true, 0, true, "取消登录", ProcessRun.StopWaveToolsHelperProcess); 83 | // 等待用户登录 84 | await ProcessRun.WaveToolsHelperAsync("/WaitForLogin"); 85 | } 86 | finally 87 | { 88 | WaitOverlayManager.RaiseWaitOverlay(false); 89 | string isLogined = await ProcessRun.WaveToolsHelperAsync("/CheckUser"); 90 | if (isLogined == "用户缓存文件存在") 91 | { 92 | TextBox uidTextBox = new TextBox 93 | { 94 | PlaceholderText = "请输入UID" 95 | }; 96 | 97 | TextBox nameTextBox = new TextBox 98 | { 99 | PlaceholderText = "请输入昵称" 100 | }; 101 | 102 | StackPanel dialogStackPanel = new StackPanel(); 103 | dialogStackPanel.Children.Add(new TextBlock { Text = "UID:" }); 104 | dialogStackPanel.Children.Add(uidTextBox); 105 | dialogStackPanel.Children.Add(new TextBlock { Text = "昵称:" }); 106 | dialogStackPanel.Children.Add(nameTextBox); 107 | 108 | ContentDialog updateDialog = new ContentDialog 109 | { 110 | Title = "保存账号", 111 | Content = dialogStackPanel, 112 | CloseButtonText = "关闭", 113 | PrimaryButtonText = "保存", 114 | DefaultButton = ContentDialogButton.Primary, 115 | XamlRoot = this.Content.XamlRoot // Assuming this is in a Page or UserControl 116 | }; 117 | 118 | if (await updateDialog.ShowAsync() == ContentDialogResult.Primary) 119 | { 120 | string uid = uidTextBox.Text; 121 | string name = nameTextBox.Text; 122 | 123 | // 处理输入的UID和昵称 124 | await ProcessRun.WaveToolsHelperAsync($"/SaveUser {uid} {name}"); 125 | RefreshAccount(null, null); 126 | } 127 | } 128 | } 129 | } 130 | 131 | private void AccountListView_SelectionChanged(object sender, SelectionChangedEventArgs e) 132 | { 133 | if (AccountListView.SelectedItem != null) 134 | { 135 | renameAccount.IsEnabled = true; 136 | saveAccount.IsEnabled = true; 137 | deleteAccount.IsEnabled = true; 138 | Account selectedAccount = (Account)AccountListView.SelectedItem; 139 | StartGameView.SelectedUID = selectedAccount.uid; 140 | StartGameView.SelectedName = selectedAccount.name; 141 | } 142 | } 143 | 144 | private async void SaveAccount_Override(object sender, RoutedEventArgs e) 145 | { 146 | // 如果找到了别名,则直接使用当前 UID 和别名进行备份 147 | if (StartGameView.SelectedUID != null || StartGameView.SelectedName != null) 148 | { 149 | string backupResult = await ProcessRun.WaveToolsHelperAsync($"/SaveUser {StartGameView.SelectedUID} {StartGameView.SelectedName}"); 150 | Console.WriteLine(backupResult); // 可以根据需要处理备份结果 151 | } 152 | else 153 | { 154 | Console.WriteLine("未找到当前 UID 和别名,无法进行覆盖保存。"); 155 | // 这里可以添加逻辑,如显示错误信息或者采取其他操作 156 | } 157 | } 158 | 159 | public static async Task GetAccountNameByUID(string UID) 160 | { 161 | // 从 WaveToolsHelper 获取所有备份账户的 JSON 数据 162 | string jsonData = await ProcessRun.WaveToolsHelperAsync("/GetAllUser"); 163 | 164 | // 反序列化 JSON 数据为账户列表 165 | List accounts = JsonConvert.DeserializeObject>(jsonData); 166 | 167 | // 在账户列表中查找指定 UID 的账户 168 | Account account = accounts.Find(acc => acc.uid == UID); 169 | 170 | // 如果找到了对应的账户,则返回账户的名称;否则返回空字符串 171 | return account != null ? account.name : ""; 172 | } 173 | 174 | private async void SaveAccount_C(object sender, RoutedEventArgs e) 175 | { 176 | saveAccountName.IsOpen = false; 177 | saveAccountSuccess.Subtitle = await ProcessRun.WaveToolsHelperAsync("/SaveUser " + saveAccountNameInput.Text); 178 | saveAccountSuccess.IsOpen = true; 179 | renameAccount.IsEnabled = true; 180 | saveAccount.IsEnabled = true; 181 | saveAccountNameInput.Text = ""; 182 | RefreshAccount(null, null); 183 | } 184 | 185 | private async void RenameAccount_C(object sender, RoutedEventArgs e) 186 | { 187 | renameAccountTip.IsOpen = false; 188 | Account selectedAccount = (Account)AccountListView.SelectedItem; 189 | renameAccountSuccess.Subtitle = await ProcessRun.WaveToolsHelperAsync($"/RenameUser {selectedAccount.uid} {selectedAccount.name} {renameAccountNameInput.Text}"); 190 | renameAccountSuccess.IsOpen = true; 191 | RefreshAccount(null, null); 192 | } 193 | 194 | private async void RemoveAccount_C(TeachingTip sender, object args) 195 | { 196 | removeAccountCheck.IsOpen = false; 197 | Account selectedAccount = (Account)AccountListView.SelectedItem; 198 | removeAccountSuccess.Subtitle = await ProcessRun.WaveToolsHelperAsync($"/RemoveUser {selectedAccount.uid} {selectedAccount.name}"); 199 | removeAccountSuccess.IsOpen = true; 200 | RefreshAccount(null,null); 201 | } 202 | 203 | private void DeleteAccount(object sender, RoutedEventArgs e) 204 | { 205 | removeAccountCheck.IsOpen = true; 206 | } 207 | 208 | private void RenameAccount(object sender, RoutedEventArgs e) 209 | { 210 | renameAccountTip.IsOpen = true; 211 | } 212 | 213 | private async void RefreshAccount(object sender, RoutedEventArgs e) 214 | { 215 | saveAccount.IsEnabled = false; 216 | loginNewAccount.IsEnabled = false; 217 | deleteAccount.IsEnabled = false; 218 | renameAccount.IsEnabled = false; 219 | refreshAccount.Visibility = Visibility.Collapsed; 220 | refreshAccount_Loading.Visibility = Visibility.Visible; 221 | await LoadData(await ProcessRun.WaveToolsHelperAsync("/GetAllUser")); 222 | } 223 | 224 | 225 | } 226 | public class Account 227 | { 228 | public string uid { get; set; } 229 | public string name { get; set; } 230 | } 231 | } -------------------------------------------------------------------------------- /WaveTools/Views/ToolViews/AdvancedGraphicSettingsView.xaml.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JamXi233/WaveTools/173aae4a29faa771df15f09410274a99bcebc2ac/WaveTools/Views/ToolViews/AdvancedGraphicSettingsView.xaml.cs -------------------------------------------------------------------------------- /WaveTools/Views/ToolViews/GachaView.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 34 |