From 5935f94a7c1c1391450daeeb6a51ab0e33ab9b54 Mon Sep 17 00:00:00 2001 From: Yokimitsuro Date: Mon, 3 Aug 2026 21:30:33 +0200 Subject: [PATCH 1/5] Add user-friendly launcher and organized release layout --- .github/scripts/prepare-release.ps1 | 96 +++++++ .github/workflows/dotnet.yml | 15 +- .gitignore | 3 + OpenKh.Tools.Launcher/App.xaml | 7 + OpenKh.Tools.Launcher/App.xaml.cs | 7 + OpenKh.Tools.Launcher/MainWindow.xaml | 239 ++++++++++++++++++ OpenKh.Tools.Launcher/MainWindow.xaml.cs | 221 ++++++++++++++++ .../OpenKh.Tools.Launcher.csproj | 23 ++ .../Services/OpenkhUpdateProceederService.cs | 36 ++- OpenKh.sln | 11 + README.md | 2 + distribution/README-FIRST.txt | 22 ++ images/openKH_Old.ico | Bin 0 -> 270622 bytes images/openkh-launcher-home.png | Bin 0 -> 142342 bytes images/openkh-launcher-tools.png | Bin 0 -> 117980 bytes 15 files changed, 673 insertions(+), 9 deletions(-) create mode 100644 .github/scripts/prepare-release.ps1 create mode 100644 OpenKh.Tools.Launcher/App.xaml create mode 100644 OpenKh.Tools.Launcher/App.xaml.cs create mode 100644 OpenKh.Tools.Launcher/MainWindow.xaml create mode 100644 OpenKh.Tools.Launcher/MainWindow.xaml.cs create mode 100644 OpenKh.Tools.Launcher/OpenKh.Tools.Launcher.csproj create mode 100644 distribution/README-FIRST.txt create mode 100644 images/openKH_Old.ico create mode 100644 images/openkh-launcher-home.png create mode 100644 images/openkh-launcher-tools.png diff --git a/.github/scripts/prepare-release.ps1 b/.github/scripts/prepare-release.ps1 new file mode 100644 index 000000000..cb7f32be9 --- /dev/null +++ b/.github/scripts/prepare-release.ps1 @@ -0,0 +1,96 @@ +param ( + [string] $BuildDirectory = "bin", + [string] $ReleaseDirectory = "openkh", + [string] $Configuration = "Release" +) + +$ErrorActionPreference = "Stop" + +if (-not (Test-Path -LiteralPath $BuildDirectory -PathType Container)) { + throw "Build directory '$BuildDirectory' does not exist." +} + +if (Test-Path -LiteralPath $ReleaseDirectory) { + throw "Release directory '$ReleaseDirectory' already exists." +} + +New-Item -ItemType Directory -Path $ReleaseDirectory | Out-Null + +$applicationsDirectory = Join-Path $ReleaseDirectory "Apps" +$modManagerDirectory = Join-Path $applicationsDirectory "ModManager" +New-Item -ItemType Directory -Path $modManagerDirectory -Force | Out-Null + +dotnet publish ` + "OpenKh.Tools.Launcher/OpenKh.Tools.Launcher.csproj" ` + --configuration $Configuration ` + --runtime win-x64 ` + --self-contained false ` + --output $ReleaseDirectory ` + /p:PublishSingleFile=true ` + /p:DebugType=None ` + /p:DebugSymbols=false + +if ($LASTEXITCODE -ne 0) { + throw "Publishing OpenKH Launcher failed with exit code $LASTEXITCODE." +} + +dotnet publish ` + "OpenKh.Tools.ModsManager/OpenKh.Tools.ModsManager.csproj" ` + --configuration $Configuration ` + --output $modManagerDirectory ` + /p:DebugType=None ` + /p:DebugSymbols=false + +if ($LASTEXITCODE -ne 0) { + throw "Publishing Mods Manager failed with exit code $LASTEXITCODE." +} + +$referencedCommandArtifacts = Get-ChildItem -LiteralPath $modManagerDirectory -File | Where-Object { + $_.Name -like "OpenKh.Command.*" -and $_.Extension -ne ".dll" +} + +foreach ($referencedCommandArtifact in $referencedCommandArtifacts) { + Remove-Item -LiteralPath $referencedCommandArtifact.FullName +} + +$panaceaFiles = @( + "OpenKH.Panacea.dll", + "avcodec-vgmstream-59.dll", + "avformat-vgmstream-59.dll", + "avutil-vgmstream-57.dll", + "bass.dll", + "bass_vgmstream.dll", + "libatrac9.dll", + "libcelt-0061.dll", + "libcelt-0110.dll", + "libg719_decode.dll", + "libmpg123-0.dll", + "libspeex-1.dll", + "libvorbis.dll", + "swresample-vgmstream-4.dll" +) + +foreach ($fileName in $panaceaFiles) { + $sourcePath = Join-Path $BuildDirectory $fileName + if (-not (Test-Path -LiteralPath $sourcePath -PathType Leaf)) { + throw "Required Panacea file '$sourcePath' does not exist." + } + + Copy-Item -LiteralPath $sourcePath -Destination $modManagerDirectory +} + +Copy-Item -LiteralPath "distribution/README-FIRST.txt" -Destination $ReleaseDirectory +Copy-Item -LiteralPath "LICENSE" -Destination $ReleaseDirectory +Copy-Item -LiteralPath "NOTICE" -Destination $ReleaseDirectory + +$advancedToolsDirectory = Join-Path $ReleaseDirectory "AdvancedTools" +Move-Item -LiteralPath $BuildDirectory -Destination $advancedToolsDirectory + +$duplicateApplicationFiles = Get-ChildItem -LiteralPath $advancedToolsDirectory -File | Where-Object { + $_.Name -like "OpenKh.Launcher.*" -or + $_.Name -like "OpenKh.Tools.ModsManager.*" +} + +foreach ($duplicateFile in $duplicateApplicationFiles) { + Remove-Item -LiteralPath $duplicateFile.FullName +} diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f0afbad26..b9965ac72 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -27,7 +27,7 @@ jobs: - name: build.ps1 run: powershell -ExecutionPolicy Unrestricted ./build.ps1 shell: pwsh - + - name: setup-msbuild uses: microsoft/setup-msbuild@v1.1.3 - name: msbuild panacea @@ -35,17 +35,18 @@ jobs: msbuild OpenKh.Research.Panacea\OpenKh.Research.Panacea.vcxproj /p:Configuration=Release /p:Platform=x64 xcopy "OpenKh.Research.Panacea\Release\*.dll" bin\ xcopy "OpenKh.Research.Panacea\Dependencies\*.dll" bin\ - + + - name: Organize release for mod users + run: powershell -ExecutionPolicy Unrestricted ./.github/scripts/prepare-release.ps1 + shell: pwsh + - name: create openkh-release shell: bash env: RELEASE_TAG: "release2-${{github.run_number}}" run: | - echo $RELEASE_TAG > bin/openkh-release - - - name: bin → openkh - run: ren bin openkh - shell: pwsh + echo $RELEASE_TAG > openkh/openkh-release + - name: zip uses: TheDoctor0/zip-release@0.6.2 with: diff --git a/.gitignore b/.gitignore index 9824a46a3..288ac35b0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ # Project specific files .tests/ +/openkh/ +/openkh-clean/ +/OpenKh-*-release.zip # User-specific files *.suo diff --git a/OpenKh.Tools.Launcher/App.xaml b/OpenKh.Tools.Launcher/App.xaml new file mode 100644 index 000000000..6b41fb183 --- /dev/null +++ b/OpenKh.Tools.Launcher/App.xaml @@ -0,0 +1,7 @@ + + + + diff --git a/OpenKh.Tools.Launcher/App.xaml.cs b/OpenKh.Tools.Launcher/App.xaml.cs new file mode 100644 index 000000000..a2bf05146 --- /dev/null +++ b/OpenKh.Tools.Launcher/App.xaml.cs @@ -0,0 +1,7 @@ +using System.Windows; + +namespace OpenKh.Tools.Launcher; + +public partial class App : Application +{ +} diff --git a/OpenKh.Tools.Launcher/MainWindow.xaml b/OpenKh.Tools.Launcher/MainWindow.xaml new file mode 100644 index 000000000..296dec500 --- /dev/null +++ b/OpenKh.Tools.Launcher/MainWindow.xaml @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +