Updated dependencies

Replaced deprecated DotNetZip with System.IO.Compression.
Changed target framework to net 9.0.
Removed DotNetZip package reference.
Updated Microsoft.Web.WebView2 to 1.0.2903.40.
Updated WindowsAPICodePack to 8.0.6.
This commit is contained in:
Junior 2024-11-27 00:28:46 -03:00
parent 3648b49bb3
commit 7849b2001a
8 changed files with 91 additions and 80 deletions

View file

@ -6,19 +6,24 @@ on:
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: '7.0.x' dotnet-version: '9.0.x'
- name: Build
run: dotnet publish --configuration Release --self-contained false --runtime win-x64 /p:PublishSingleFile=true # Build with --self-contained false
- name: Zip output file - name: Build Rusty Hearts Launcher (No Self-Contained)
run: Compress-Archive -Path ./bin/Release/net7.0-windows7.0/win-x64/publish/Launcher.exe -DestinationPath Launcher.zip 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 - name: Upload Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Launcher name: Launcher
path: Launcher.zip path: RustyHearts-Launcher.zip

View file

@ -3,42 +3,50 @@ on:
workflow_dispatch: workflow_dispatch:
release: release:
types: [created] types: [created]
jobs: jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: '7.0.x' dotnet-version: '9.0.x'
- name: Get version from .csproj file
id: version
# 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: | run: |
echo "::set-output name=version::$(grep -m1 -o '<FileVersion>[^<]*' RHLauncher.csproj | sed 's/<FileVersion>//')" $version = (Get-Command "./publish/RustyHearts-Launcher_framework-dependent/Launcher.dll").FileVersionInfo.FileVersion
- name: Build echo "::set-output name=version::$version"
run: dotnet publish --configuration Release --self-contained false --runtime win-x64 /p:PublishSingleFile=true
- name: Zip output file # Create Release and Upload Assets using softprops/action-gh-release
run: Compress-Archive -Path ./bin/Release/net7.0-windows7.0/win-x64/publish/Launcher.exe -DestinationPath Launcher.zip - name: Create GitHub Release and Upload Assets
- name: Create Release uses: softprops/action-gh-release@v2
id: create_release
uses: actions/create-release@v1
with: with:
tag_name: ${{ steps.version.outputs.version }} tag_name: v${{ steps.version.outputs.version }}
release_name: v${{ steps.version.outputs.version }} body: Automated pre-release created by GitHub Actions.
body: Automated release created by GitHub Actions. draft: true
draft: false prerelease: true
prerelease: false files: |
env: ./RustyHearts-Launcher-Framework-Dependent.zip
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ./RustyHearts-Launcher-SelfContained.zip
- 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
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -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) * [Prerequisites for Building Locally/Development](#prerequisites-for-building-locallydevelopment)
* [System Requirements for Ready-to-use build](#system-requirements-for-ready-to-use-build) * [System Requirements for Ready-to-use build](#system-requirements-for-ready-to-use-build)
* [License](#license) * [License](#license)
* [Contributing](#contributing) * [Building](#building)
* [FAQ](#faq)
* [Credits](#credits) * [Credits](#credits)
* [Support](#support)
## Features ## Features
* Game Download: The launcher can download and install the client. * 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.<language>.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 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 ## Prerequisites for 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.12 or later)
* Visual Studio 2022 (Any Edition - 17.4 or later) * Windows 10 SDK or Windows 11 SDK via Visual Studio Installer
* Windows 10 SDK (10.0.19043.0) or Windows 11 SDK (10.0.22000.0) via Visual Studio Installer * .NET Core 9 SDK (9.0.100 or later)
* .NET: [.NET Core 7 SDK (7.0.100 or later)](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
## System Requirements for Ready-to-use build ## Building
* OS: Windows 10 1809 Update (build 17763) or later / Windows 11 (Any builds)
* Architecture: x64/AMD64 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 ## License
This project is licensed under the terms found in [`LICENSE-0BSD`](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 ## Credits
The following third-party libraries, tools, and resources are used in this project: 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) * [Microsoft.Web.WebView2](https://www.nuget.org/packages/Microsoft.Web.WebView2)
* [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json) * [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json)
* [WindowsAPICodePack](https://www.nuget.org/packages/WindowsAPICodePack) * [WindowsAPICodePack](https://www.nuget.org/packages/WindowsAPICodePack)
## Support
If you need help with the launcher, please submit an issue on GitHub.

View file

@ -81,7 +81,7 @@ namespace RHLauncher
{ {
if (languageChanged) if (languageChanged)
{ {
string? selectedLanguage = cbLauncherLanguage.SelectedItem.ToString(); string? selectedLanguage = cbLauncherLanguage.SelectedItem?.ToString();
string languageCode = GetLanguageCode(selectedLanguage); string languageCode = GetLanguageCode(selectedLanguage);
if (languageCode != null) if (languageCode != null)

View file

@ -1,9 +1,11 @@
using RHLauncher.RHLauncher.i8n; using RHLauncher.RHLauncher.i8n;
using System.ComponentModel;
namespace RHLauncher namespace RHLauncher
{ {
public partial class MsgBoxForm : Form public partial class MsgBoxForm : Form
{ {
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new DialogResult DialogResult { get; private set; } public new DialogResult DialogResult { get; private set; }
public MsgBoxForm() public MsgBoxForm()

View file

@ -1,4 +1,4 @@
using Ionic.Zip; using System.IO.Compression;
using RHLauncher.RHLauncher.Helper; using RHLauncher.RHLauncher.Helper;
using RHLauncher.RHLauncher.i8n; using RHLauncher.RHLauncher.i8n;
using System.Diagnostics; using System.Diagnostics;
@ -51,10 +51,10 @@ namespace RHLauncher.RHLauncher.Http
Directory.CreateDirectory(downloadDir); Directory.CreateDirectory(downloadDir);
} }
List<string> filesToBeDownloaded = new(); List<string> filesToBeDownloaded = [];
long totalBytesToDownload = 0L; long totalBytesToDownload = 0L;
List<string> lines = filelistText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList(); List<string> lines = [.. filelistText.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries)];
int totalLines = lines.Count; int totalLines = lines.Count;
int checkedFiles = 0; int checkedFiles = 0;
@ -146,14 +146,14 @@ namespace RHLauncher.RHLauncher.Http
private static async Task<string> UnzipFilesAsync(string sourceDirectory, string destinationDirectory, IProgress<ProgressReport> progress, CancellationToken cancellationToken) private static async Task<string> UnzipFilesAsync(string sourceDirectory, string destinationDirectory, IProgress<ProgressReport> progress, CancellationToken cancellationToken)
{ {
string[] fileEntries = Directory.GetFiles(sourceDirectory, "*.zip.*").OrderBy(f => f).ToArray(); string[] fileEntries = [.. Directory.GetFiles(sourceDirectory, "*.zip.*").OrderBy(f => f)];
string rhExeDirectoryPath = ""; string rhExeDirectoryPath = "";
// Calculate total uncompressed size of all files in all zip archives // Calculate total uncompressed size of all files in all zip archives
long totalUncompressedSize = fileEntries.Sum(file => long totalUncompressedSize = fileEntries.Sum(file =>
{ {
using ZipFile zip = ZipFile.Read(file); using ZipArchive zip = ZipFile.OpenRead(file);
return zip.Entries.Sum(entry => entry.UncompressedSize); return zip.Entries.Sum(entry => entry.Length);
}); });
long totalExtracted = 0; long totalExtracted = 0;
@ -163,26 +163,26 @@ namespace RHLauncher.RHLauncher.Http
{ {
await Task.Run(() => await Task.Run(() =>
{ {
using ZipFile zip = ZipFile.Read(file); using ZipArchive zip = ZipFile.OpenRead(file);
foreach (var entry in zip) foreach (var entry in zip.Entries)
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
string destinationPath = Path.Combine(destinationDirectory, entry.FileName); string destinationPath = Path.Combine(destinationDirectory, entry.FullName);
string? directoryPath = Path.GetDirectoryName(destinationPath); string? directoryPath = Path.GetDirectoryName(destinationPath);
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath)) if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
{ {
Directory.CreateDirectory(directoryPath); Directory.CreateDirectory(directoryPath);
} }
entry.Extract(destinationDirectory, ExtractExistingFileAction.OverwriteSilently); entry.ExtractToFile(destinationPath, true);
totalExtracted += entry.UncompressedSize; totalExtracted += entry.Length;
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
ProgressReporter.ReportUnzipProgress(progress, totalExtracted, totalUncompressedSize, cancellationToken); ProgressReporter.ReportUnzipProgress(progress, totalExtracted, totalUncompressedSize, cancellationToken);
// Check if the current entry is "rustyhearts.exe" and store its directory path // 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) ?? ""; rhExeDirectoryPath = Path.GetDirectoryName(destinationPath) ?? "";
} }
@ -217,7 +217,5 @@ namespace RHLauncher.RHLauncher.Http
throw new FileNotFoundException($"{LocalizedStrings.ClientFolderExeErrorMessage}"); throw new FileNotFoundException($"{LocalizedStrings.ClientFolderExeErrorMessage}");
} }
} }
} }
} }

View file

@ -1,4 +1,4 @@
using Ionic.Zlib; using System.IO.Compression;
using RHLauncher.RHLauncher.Helper; using RHLauncher.RHLauncher.Helper;
using System.Text; using System.Text;
@ -35,7 +35,7 @@ namespace RHLauncher.RHLauncher.PCK
try try
{ {
using MemoryStream compressedStream = new(compressedBytes); using MemoryStream compressedStream = new(compressedBytes);
using ZlibStream deflateStream = new(compressedStream, CompressionMode.Decompress); using ZLibStream deflateStream = new(compressedStream, CompressionMode.Decompress);
using MemoryStream decompressedStream = new(); using MemoryStream decompressedStream = new();
deflateStream.CopyTo(decompressedStream); deflateStream.CopyTo(decompressedStream);
decompressedStream.Seek(0, SeekOrigin.Begin); decompressedStream.Seek(0, SeekOrigin.Begin);

View file

@ -6,7 +6,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows7.0</TargetFramework> <TargetFramework>net9.0-windows</TargetFramework>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
@ -19,8 +19,8 @@
<AssemblyName>Launcher</AssemblyName> <AssemblyName>Launcher</AssemblyName>
<Description>Rusty Hearts Launcher</Description> <Description>Rusty Hearts Launcher</Description>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<AssemblyVersion>1.2.0</AssemblyVersion> <AssemblyVersion>1.3.0</AssemblyVersion>
<FileVersion>1.2.0</FileVersion> <FileVersion>1.3.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -36,10 +36,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DotNetZip" Version="1.16.0" /> <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2535.41" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="WindowsAPICodePack" Version="8.0.4" /> <PackageReference Include="WindowsAPICodePack" Version="8.0.6" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>