diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1616923..d458f0a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,19 +6,24 @@ on: jobs: build: runs-on: windows-latest + steps: - name: Checkout code uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' - - name: Build - run: dotnet publish --configuration Release --self-contained false --runtime win-x64 /p:PublishSingleFile=true - - name: Zip output file - run: Compress-Archive -Path ./bin/Release/net7.0-windows7.0/win-x64/publish/Launcher.exe -DestinationPath Launcher.zip + dotnet-version: '9.0.x' + + # Build with --self-contained false + - name: Build Rusty Hearts Launcher (No Self-Contained) + run: dotnet publish ./RHLauncher.sln --configuration Release --self-contained false --runtime win-x64 /p:PublishSingleFile=true /p:PublishDir=./publish/RustyHearts-Launcher_framework-dependent + + - name: Zip output files (No Self-Contained) + run: Compress-Archive -Path "./publish/RustyHearts-Launcher_framework-dependent" -DestinationPath RustyHearts-Launcher.zip - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: Launcher - path: Launcher.zip + path: RustyHearts-Launcher.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1b6036..2a8a2ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,42 +3,50 @@ on: workflow_dispatch: release: types: [created] + jobs: build: runs-on: windows-latest + steps: - name: Checkout code uses: actions/checkout@v4 + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: '7.0.x' - - name: Get version from .csproj file - id: version + dotnet-version: '9.0.x' + # Build with --self-contained false + - name: Build Rusty Hearts Launcher (No Self-Contained) + run: dotnet publish ./RHLauncher.sln --configuration Release --self-contained false --runtime win-x64 /p:PublishSingleFile=true /p:PublishDir=./publish/RustyHearts-Launcher_framework-dependent + + - name: Zip output files (No Self-Contained) + run: Compress-Archive -Path "./publish/RustyHearts-Launcher_framework-dependent" -DestinationPath RustyHearts-Launcher-Framework-Dependent.zip + + # Build with --self-contained true + - name: Build Rusty Hearts Launcher (Self-Contained) + run: dotnet publish ./RHLauncher.sln --configuration Release --self-contained true --runtime win-x64 /p:PublishSingleFile=false /p:PublishDir=./publish/RustyHearts-Launcher_self-contained + + - name: Zip output files (Self-Contained) + run: Compress-Archive -Path "./publish/RustyHearts-Launcher_self-contained" -DestinationPath RustyHearts-Launcher-SelfContained.zip + + - name: Get version from compiled assembly + id: version run: | - echo "::set-output name=version::$(grep -m1 -o '[^<]*' RHLauncher.csproj | sed 's///')" - - name: Build - run: dotnet publish --configuration Release --self-contained false --runtime win-x64 /p:PublishSingleFile=true - - name: Zip output file - run: Compress-Archive -Path ./bin/Release/net7.0-windows7.0/win-x64/publish/Launcher.exe -DestinationPath Launcher.zip - - name: Create Release - id: create_release - uses: actions/create-release@v1 + $version = (Get-Command "./publish/RustyHearts-Launcher_framework-dependent/Launcher.dll").FileVersionInfo.FileVersion + echo "::set-output name=version::$version" + + # Create Release and Upload Assets using softprops/action-gh-release + - name: Create GitHub Release and Upload Assets + uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.version.outputs.version }} - release_name: v${{ steps.version.outputs.version }} - body: Automated release created by GitHub Actions. - draft: false - prerelease: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./Launcher.zip - asset_name: Launcher.zip - asset_content_type: application/zip + tag_name: v${{ steps.version.outputs.version }} + body: Automated pre-release created by GitHub Actions. + draft: true + prerelease: true + files: | + ./RustyHearts-Launcher-Framework-Dependent.zip + ./RustyHearts-Launcher-SelfContained.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 6337c1f..7cb6a80 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,8 @@ Rusty Hearts Launcher is a custom launcher for the Rusty Hearts game client. It * [Prerequisites for Building Locally/Development](#prerequisites-for-building-locallydevelopment) * [System Requirements for Ready-to-use build](#system-requirements-for-ready-to-use-build) * [License](#license) -* [Contributing](#contributing) -* [FAQ](#faq) +* [Building](#building) * [Credits](#credits) -* [Support](#support) ## Features * Game Download: The launcher can download and install the client. @@ -73,36 +71,37 @@ If you want to add a new language create a LocalizedStrings..resx with If you want to change the text on the buttons/images used in the launcher you can use the Photoshop .psd files included in the PSD Resources.rar -## Prerequisites for Building Locally/Development -The launcher is built in .NET 7 and as such, the packages listed below are required to create a local and development build of the launcher. Furthermore, it uses many submodules and packages outside of this, which will automatically be loaded when the user sets up a local environment of the application. -* Visual Studio 2022 (Any Edition - 17.4 or later) -* Windows 10 SDK (10.0.19043.0) or Windows 11 SDK (10.0.22000.0) via Visual Studio Installer -* .NET: [.NET Core 7 SDK (7.0.100 or later)](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) +## Prerequisites for Development +* Visual Studio 2022 (Any Edition - 17.12 or later) +* Windows 10 SDK or Windows 11 SDK via Visual Studio Installer +* .NET Core 9 SDK (9.0.100 or later) -## System Requirements for Ready-to-use build -* OS: Windows 10 1809 Update (build 17763) or later / Windows 11 (Any builds) -* Architecture: x64/AMD64 +## Building + +If you wish to build the project yourself, follow these steps: + +### Step 1 + +Install the [.NET 9.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/9.0). +Make sure your SDK version is higher or equal to the required version specified. + +### Step 2 + +Either use `git clone https://github.com/JuniorDark/RustyHearts-Launcher` on the command line to clone the repository or use Code --> Download zip button to get the files. + +### Step 3 + +To build Rusty Hearts Launcher, open a command prompt inside the project directory. +You can quickly access it on Windows by holding shift in File Explorer, then right clicking and selecting `Open command window here`. +Then type the following command: `dotnet build -c Release`. + +The built files will be found in the newly created `bin` build directory. ## License This project is licensed under the terms found in [`LICENSE-0BSD`](LICENSE). -## Contributing -Contributions from the community are welcome! If you encounter a bug or have a feature request, please submit an issue on GitHub. If you would like to contribute code, please fork the repository and submit a pull request. - -## FAQ -* Q: How do I report a bug? - * A: Please submit an issue on GitHub with a detailed description of the bug and steps to reproduce it. -* Q: How do I request a new feature? - * A: Please submit an issue on GitHub with a detailed description of the feature and why it would be useful. -* Q: How do I contribute code? - * A: Please fork the repository, make your changes, and submit a pull request. - ## Credits The following third-party libraries, tools, and resources are used in this project: -* [DotNetZip](https://www.nuget.org/packages/DotNetZip) * [Microsoft.Web.WebView2](https://www.nuget.org/packages/Microsoft.Web.WebView2) * [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json) * [WindowsAPICodePack](https://www.nuget.org/packages/WindowsAPICodePack) - -## Support -If you need help with the launcher, please submit an issue on GitHub. diff --git a/RHLauncher.Forms/ConfigForm.cs b/RHLauncher.Forms/ConfigForm.cs index 3d0c048..23e501d 100644 --- a/RHLauncher.Forms/ConfigForm.cs +++ b/RHLauncher.Forms/ConfigForm.cs @@ -81,7 +81,7 @@ namespace RHLauncher { if (languageChanged) { - string? selectedLanguage = cbLauncherLanguage.SelectedItem.ToString(); + string? selectedLanguage = cbLauncherLanguage.SelectedItem?.ToString(); string languageCode = GetLanguageCode(selectedLanguage); if (languageCode != null) diff --git a/RHLauncher.Forms/MsgBoxForm.cs b/RHLauncher.Forms/MsgBoxForm.cs index 0aa00fd..c6e5698 100644 --- a/RHLauncher.Forms/MsgBoxForm.cs +++ b/RHLauncher.Forms/MsgBoxForm.cs @@ -1,9 +1,11 @@ using RHLauncher.RHLauncher.i8n; +using System.ComponentModel; namespace RHLauncher { public partial class MsgBoxForm : Form { + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public new DialogResult DialogResult { get; private set; } public MsgBoxForm() diff --git a/RHLauncher.Http/ClientDownloader.cs b/RHLauncher.Http/ClientDownloader.cs index 695f00d..3919988 100644 --- a/RHLauncher.Http/ClientDownloader.cs +++ b/RHLauncher.Http/ClientDownloader.cs @@ -1,4 +1,4 @@ -using Ionic.Zip; +using System.IO.Compression; using RHLauncher.RHLauncher.Helper; using RHLauncher.RHLauncher.i8n; using System.Diagnostics; @@ -51,10 +51,10 @@ namespace RHLauncher.RHLauncher.Http Directory.CreateDirectory(downloadDir); } - List filesToBeDownloaded = new(); + List filesToBeDownloaded = []; long totalBytesToDownload = 0L; - List lines = filelistText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList(); + List lines = [.. filelistText.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries)]; int totalLines = lines.Count; int checkedFiles = 0; @@ -146,14 +146,14 @@ namespace RHLauncher.RHLauncher.Http private static async Task UnzipFilesAsync(string sourceDirectory, string destinationDirectory, IProgress progress, CancellationToken cancellationToken) { - string[] fileEntries = Directory.GetFiles(sourceDirectory, "*.zip.*").OrderBy(f => f).ToArray(); + string[] fileEntries = [.. Directory.GetFiles(sourceDirectory, "*.zip.*").OrderBy(f => f)]; string rhExeDirectoryPath = ""; // Calculate total uncompressed size of all files in all zip archives long totalUncompressedSize = fileEntries.Sum(file => { - using ZipFile zip = ZipFile.Read(file); - return zip.Entries.Sum(entry => entry.UncompressedSize); + using ZipArchive zip = ZipFile.OpenRead(file); + return zip.Entries.Sum(entry => entry.Length); }); long totalExtracted = 0; @@ -163,26 +163,26 @@ namespace RHLauncher.RHLauncher.Http { await Task.Run(() => { - using ZipFile zip = ZipFile.Read(file); - foreach (var entry in zip) + using ZipArchive zip = ZipFile.OpenRead(file); + foreach (var entry in zip.Entries) { cancellationToken.ThrowIfCancellationRequested(); - string destinationPath = Path.Combine(destinationDirectory, entry.FileName); + string destinationPath = Path.Combine(destinationDirectory, entry.FullName); string? directoryPath = Path.GetDirectoryName(destinationPath); if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } - entry.Extract(destinationDirectory, ExtractExistingFileAction.OverwriteSilently); - totalExtracted += entry.UncompressedSize; + entry.ExtractToFile(destinationPath, true); + totalExtracted += entry.Length; cancellationToken.ThrowIfCancellationRequested(); ProgressReporter.ReportUnzipProgress(progress, totalExtracted, totalUncompressedSize, cancellationToken); // Check if the current entry is "rustyhearts.exe" and store its directory path - if (entry.FileName.EndsWith("rustyhearts.exe", StringComparison.OrdinalIgnoreCase)) + if (entry.FullName.EndsWith("rustyhearts.exe", StringComparison.OrdinalIgnoreCase)) { rhExeDirectoryPath = Path.GetDirectoryName(destinationPath) ?? ""; } @@ -217,7 +217,5 @@ namespace RHLauncher.RHLauncher.Http throw new FileNotFoundException($"{LocalizedStrings.ClientFolderExeErrorMessage}"); } } - - } } diff --git a/RHLauncher.PCK/PCKReader.cs b/RHLauncher.PCK/PCKReader.cs index 5927cb2..3f3c6d9 100644 --- a/RHLauncher.PCK/PCKReader.cs +++ b/RHLauncher.PCK/PCKReader.cs @@ -1,4 +1,4 @@ -using Ionic.Zlib; +using System.IO.Compression; using RHLauncher.RHLauncher.Helper; using System.Text; @@ -35,7 +35,7 @@ namespace RHLauncher.RHLauncher.PCK try { using MemoryStream compressedStream = new(compressedBytes); - using ZlibStream deflateStream = new(compressedStream, CompressionMode.Decompress); + using ZLibStream deflateStream = new(compressedStream, CompressionMode.Decompress); using MemoryStream decompressedStream = new(); deflateStream.CopyTo(decompressedStream); decompressedStream.Seek(0, SeekOrigin.Begin); diff --git a/RHLauncher.csproj b/RHLauncher.csproj index 5133091..26d1d52 100644 --- a/RHLauncher.csproj +++ b/RHLauncher.csproj @@ -6,7 +6,7 @@ WinExe - net7.0-windows7.0 + net9.0-windows en enable true @@ -19,8 +19,8 @@ Launcher Rusty Hearts Launcher x64 - 1.2.0 - 1.2.0 + 1.3.0 + 1.3.0 @@ -36,10 +36,9 @@ - - + - +