mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
[skip ci] Newly add certain architecture releases and enable compression.
This commit is contained in:
parent
3735cab9dd
commit
4f608687ee
3 changed files with 199 additions and 64 deletions
148
.github/workflows/build-and-release.yml
vendored
148
.github/workflows/build-and-release.yml
vendored
|
|
@ -9,12 +9,12 @@ on:
|
||||||
env:
|
env:
|
||||||
PROJECT: "MinecraftClient"
|
PROJECT: "MinecraftClient"
|
||||||
target-version: "net7.0"
|
target-version: "net7.0"
|
||||||
compile-flags: "--self-contained=true -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None"
|
compile-flags: "--self-contained=true -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true -p:DebugType=None"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
Build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ !contains(github.event.head_commit.message, 'SKIP_BUILD') }}
|
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -48,11 +48,15 @@ jobs:
|
||||||
|
|
||||||
- name: Setup Output Paths
|
- name: Setup Output Paths
|
||||||
run: |
|
run: |
|
||||||
echo win-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x64/publish/ >> $GITHUB_ENV
|
|
||||||
echo win-x86-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x86/publish/ >> $GITHUB_ENV
|
echo win-x86-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x86/publish/ >> $GITHUB_ENV
|
||||||
echo linux-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-x64/publish/ >> $GITHUB_ENV
|
echo win-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-x64/publish/ >> $GITHUB_ENV
|
||||||
echo osx-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/osx-x64/publish/ >> $GITHUB_ENV
|
echo win-arm32-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-arm/publish/ >> $GITHUB_ENV
|
||||||
|
echo win-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/win-arm64/publish/ >> $GITHUB_ENV
|
||||||
|
echo linux-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-x64/publish/ >> $GITHUB_ENV
|
||||||
|
echo linux-arm32-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-arm/publish/ >> $GITHUB_ENV
|
||||||
echo linux-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-arm64/publish/ >> $GITHUB_ENV
|
echo linux-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/linux-arm64/publish/ >> $GITHUB_ENV
|
||||||
|
echo osx-x64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/osx-x64/publish/ >> $GITHUB_ENV
|
||||||
|
echo osx-arm64-out-path=${{ env.project-path }}/bin/Release/${{ env.target-version }}/osx-arm64/publish/ >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup .NET SDK
|
- name: Setup .NET SDK
|
||||||
uses: actions/setup-dotnet@v2.1.0
|
uses: actions/setup-dotnet@v2.1.0
|
||||||
|
|
@ -68,15 +72,9 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
COMMIT=$(echo ${{ github.sha }} | cut -c 1-7)
|
COMMIT=$(echo ${{ github.sha }} | cut -c 1-7)
|
||||||
echo '' >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
|
echo '' >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
|
||||||
|
echo build-version-info=${{ steps.date-version.outputs.time }}-${{ github.run_number }} >> $GITHUB_ENV
|
||||||
echo "[assembly: AssemblyConfiguration(\"GitHub build ${{ github.run_number }}, built on ${{ steps.date-version.outputs.time }} from commit $COMMIT\")]" >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
|
echo "[assembly: AssemblyConfiguration(\"GitHub build ${{ github.run_number }}, built on ${{ steps.date-version.outputs.time }} from commit $COMMIT\")]" >> ${{ env.project-path }}/Properties/AssemblyInfo.cs
|
||||||
|
|
||||||
- name: Build for Windows x64
|
|
||||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x64 ${{ env.compile-flags }}
|
|
||||||
|
|
||||||
- name: Zip Windows x64 Build
|
|
||||||
run: zip -qq -r windows-x64.zip *
|
|
||||||
working-directory: ${{ env.win-x64-out-path }}
|
|
||||||
|
|
||||||
- name: Build for Windows x86
|
- name: Build for Windows x86
|
||||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x86 ${{ env.compile-flags }}
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x86 ${{ env.compile-flags }}
|
||||||
|
|
||||||
|
|
@ -84,26 +82,45 @@ jobs:
|
||||||
run: zip -qq -r windows-x86.zip *
|
run: zip -qq -r windows-x86.zip *
|
||||||
working-directory: ${{ env.win-x86-out-path }}
|
working-directory: ${{ env.win-x86-out-path }}
|
||||||
|
|
||||||
- name: Build for Linux
|
- name: Build for Windows x64
|
||||||
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-x64 ${{ env.compile-flags }}
|
||||||
|
|
||||||
|
- name: Zip Windows x64 Build
|
||||||
|
run: zip -qq -r windows-x64.zip *
|
||||||
|
working-directory: ${{ env.win-x64-out-path }}
|
||||||
|
|
||||||
|
- name: Build for Windows ARM32
|
||||||
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-arm ${{ env.compile-flags }}
|
||||||
|
|
||||||
|
- name: Build for Windows ARM64
|
||||||
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r win-arm64 ${{ env.compile-flags }}
|
||||||
|
|
||||||
|
- name: Build for Linux X64
|
||||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-x64 ${{ env.compile-flags }}
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-x64 ${{ env.compile-flags }}
|
||||||
|
|
||||||
- name: Zip Linux Build
|
- name: Zip Linux X64 Build
|
||||||
run: zip -qq -r linux.zip *
|
run: zip -qq -r linux.zip *
|
||||||
working-directory: ${{ env.linux-out-path }}
|
working-directory: ${{ env.linux-x64-out-path }}
|
||||||
|
|
||||||
- name: Build for ARM64 Linux
|
- name: Build for Linux ARM32
|
||||||
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-arm ${{ env.compile-flags }}
|
||||||
|
|
||||||
|
- name: Build for Linux ARM64
|
||||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-arm64 ${{ env.compile-flags }}
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r linux-arm64 ${{ env.compile-flags }}
|
||||||
|
|
||||||
- name: Zip ARM64 Linux Build
|
- name: Zip ARM64 Linux Build
|
||||||
run: zip -qq -r linux-arm64.zip *
|
run: zip -qq -r linux-arm64.zip *
|
||||||
working-directory: ${{ env.linux-arm64-out-path }}
|
working-directory: ${{ env.linux-arm64-out-path }}
|
||||||
|
|
||||||
- name: Build for OSX
|
- name: Build for OSX X64
|
||||||
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r osx-x64 ${{ env.compile-flags }}
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r osx-x64 ${{ env.compile-flags }}
|
||||||
|
|
||||||
- name: Zip OSX Build
|
- name: Zip OSX Build
|
||||||
run: zip -qq -r osx.zip *
|
run: zip -qq -r osx.zip *
|
||||||
working-directory: ${{ env.osx-out-path }}
|
working-directory: ${{ env.osx-x64-out-path }}
|
||||||
|
|
||||||
|
- name: Build for OSX ARM64
|
||||||
|
run: dotnet publish ${{ env.project-path }}.sln -f ${{ env.target-version }} -r osx-arm64 ${{ env.compile-flags }}
|
||||||
|
|
||||||
- name: Get Release DateTime
|
- name: Get Release DateTime
|
||||||
id: date-release
|
id: date-release
|
||||||
|
|
@ -112,7 +129,88 @@ jobs:
|
||||||
timeZone: 0
|
timeZone: 0
|
||||||
format: 'YYYYMMDD'
|
format: 'YYYYMMDD'
|
||||||
|
|
||||||
- name: Windows x64 Release
|
- name: Windows X86 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.win-x86-out-path }}${{ env.PROJECT }}.exe
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-X86.exe
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: Windows X64 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.win-x64-out-path }}${{ env.PROJECT }}.exe
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-X64.exe
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: Windows ARM32 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.win-arm32-out-path }}${{ env.PROJECT }}.exe
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-Arm32.exe
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: Windows ARM64 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.win-arm64-out-path }}${{ env.PROJECT }}.exe
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-Windows-Arm64.exe
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: Linux X64 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.linux-x64-out-path }}${{ env.PROJECT }}
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-Linux-X64
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: Linux ARM32 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.linux-arm32-out-path }}${{ env.PROJECT }}
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-Linux-Arm32
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: Linux ARM64 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.linux-arm64-out-path }}${{ env.PROJECT }}
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-Linux-Arm64
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: OSX X64 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.osx-x64-out-path }}${{ env.PROJECT }}
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-OSX-X64
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: OSX ARM64 Release
|
||||||
|
uses: tix-factory/release-manager@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
mode: uploadReleaseAsset
|
||||||
|
filePath: ${{ env.win-x64-out-path }}windows-x64.zip
|
||||||
|
assetName: ${{ env.PROJECT }}-${{ env.build-version-info }}-OSX-Arm64
|
||||||
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
- name: Windows X64 Release (transition version)
|
||||||
uses: tix-factory/release-manager@v1
|
uses: tix-factory/release-manager@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -121,7 +219,7 @@ jobs:
|
||||||
assetName: ${{ env.PROJECT }}-windows-x64.zip
|
assetName: ${{ env.PROJECT }}-windows-x64.zip
|
||||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
- name: Windows x86 Release
|
- name: Windows X86 Release (transition version)
|
||||||
uses: tix-factory/release-manager@v1
|
uses: tix-factory/release-manager@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -130,16 +228,16 @@ jobs:
|
||||||
assetName: ${{ env.PROJECT }}-windows-x86.zip
|
assetName: ${{ env.PROJECT }}-windows-x86.zip
|
||||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
- name: Linux Release
|
- name: Linux X64 Release (transition version)
|
||||||
uses: tix-factory/release-manager@v1
|
uses: tix-factory/release-manager@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
mode: uploadReleaseAsset
|
mode: uploadReleaseAsset
|
||||||
filePath: ${{ env.linux-out-path }}linux.zip
|
filePath: ${{ env.linux-x64-out-path }}linux.zip
|
||||||
assetName: ${{ env.PROJECT }}-linux.zip
|
assetName: ${{ env.PROJECT }}-linux.zip
|
||||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
- name: Linux ARM64 Release
|
- name: Linux ARM64 Release (transition version)
|
||||||
uses: tix-factory/release-manager@v1
|
uses: tix-factory/release-manager@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -148,12 +246,12 @@ jobs:
|
||||||
assetName: ${{ env.PROJECT }}-linux-arm64.zip
|
assetName: ${{ env.PROJECT }}-linux-arm64.zip
|
||||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
- name: OSX Release
|
- name: OSX X64 Release (transition version)
|
||||||
uses: tix-factory/release-manager@v1
|
uses: tix-factory/release-manager@v1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
mode: uploadReleaseAsset
|
mode: uploadReleaseAsset
|
||||||
filePath: ${{ env.osx-out-path }}osx.zip
|
filePath: ${{ env.osx-x64-out-path }}osx.zip
|
||||||
assetName: ${{ env.PROJECT }}-osx.zip
|
assetName: ${{ env.PROJECT }}-osx.zip
|
||||||
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
tag: ${{ format('{0}-{1}', steps.date-release.outputs.time, github.run_number) }}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2157,7 +2157,9 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
if (windowId != 0)
|
if (windowId != 0)
|
||||||
inventories.Remove(windowId);
|
inventories.Remove(windowId);
|
||||||
return handler.SendCloseWindow(windowId);
|
bool result = handler.SendCloseWindow(windowId);
|
||||||
|
DispatchBotEvent(bot => bot.OnInventoryClose(windowId));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,31 +125,45 @@ namespace MinecraftClient
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string downloadUrl = $"{GithubReleaseUrl}/download/{latestVersion}/MinecraftClient-{OSInfo}.zip";
|
string downloadUrl = $"{GithubReleaseUrl}/download/{latestVersion}/";
|
||||||
|
string fileNameWithoutExtension = $"MinecraftClient-{latestVersion}-{OSInfo}";
|
||||||
|
string fileName = fileNameWithoutExtension + GetExecutableFileExtension();
|
||||||
downloadStartTime = DateTime.Now;
|
downloadStartTime = DateTime.Now;
|
||||||
lastNotifyTime = DateTime.MinValue;
|
lastNotifyTime = DateTime.MinValue;
|
||||||
lastBytesTransferred = 0;
|
lastBytesTransferred = 0;
|
||||||
using HttpResponseMessage response = await httpClient.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
|
|
||||||
using Stream zipFileStream = await response.Content.ReadAsStreamAsync(cancellationToken);
|
|
||||||
|
|
||||||
if (!cancellationToken.IsCancellationRequested)
|
bool hasFile = true;
|
||||||
|
HttpResponseMessage response = await httpClient.GetAsync(downloadUrl + fileName, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
using ZipArchive zipArchive = new(zipFileStream, ZipArchiveMode.Read);
|
fileName = fileNameWithoutExtension + ".zip";
|
||||||
ConsoleIO.WriteLine(Translations.mcc_update_download_complete);
|
response = await httpClient.GetAsync(downloadUrl + fileName, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
|
||||||
foreach (var archiveEntry in zipArchive.Entries)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
if (archiveEntry.Name.StartsWith("MinecraftClient"))
|
hasFile = false;
|
||||||
|
ConsoleIO.WriteLine($"{Translations.mcc_update_download_fail} File {fileNameWithoutExtension}{GetExecutableFileExtension()} not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasFile)
|
||||||
{
|
{
|
||||||
string fileName = $"MinecraftClient-{latestVersion}{Path.GetExtension(archiveEntry.Name)}";
|
using (FileStream fileStream = File.Create(fileName))
|
||||||
archiveEntry.ExtractToFile(fileName, true);
|
{
|
||||||
|
await response.Content.CopyToAsync(fileStream);
|
||||||
|
}
|
||||||
|
|
||||||
ConsoleIO.WriteLineFormatted("§e" + string.Format(Translations.mcc_update_save_as, fileName), true);
|
ConsoleIO.WriteLineFormatted("§e" + string.Format(Translations.mcc_update_save_as, fileName), true);
|
||||||
break;
|
|
||||||
}
|
if (!OperatingSystem.IsWindows())
|
||||||
}
|
File.SetUnixFileMode(fileName, UnixFileMode.UserRead
|
||||||
zipArchive.Dispose();
|
| UnixFileMode.UserWrite
|
||||||
|
| UnixFileMode.UserExecute
|
||||||
|
| UnixFileMode.GroupRead
|
||||||
|
| UnixFileMode.GroupExecute
|
||||||
|
| UnixFileMode.OtherRead
|
||||||
|
| UnixFileMode.OtherExecute);
|
||||||
}
|
}
|
||||||
|
|
||||||
zipFileStream.Dispose();
|
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
}
|
}
|
||||||
catch (TaskCanceledException) { }
|
catch (TaskCanceledException) { }
|
||||||
|
|
@ -225,25 +239,46 @@ namespace MinecraftClient
|
||||||
|
|
||||||
private static string GetOSIdentifier()
|
private static string GetOSIdentifier()
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
string OSPlatformName;
|
||||||
{
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
OSPlatformName = "Windows";
|
||||||
return "linux-arm64";
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
else if (RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
OSPlatformName = "Linux";
|
||||||
return "linux";
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
|
OSPlatformName = "OSX";
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
|
||||||
|
OSPlatformName = "FreeBSD";
|
||||||
|
else
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
string architecture = RuntimeInformation.ProcessArchitecture switch
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
Architecture.X86 => "X86",
|
||||||
return "osx";
|
Architecture.X64 => "X64",
|
||||||
|
Architecture.Arm => "Arm32",
|
||||||
|
Architecture.Arm64 => "Arm64",
|
||||||
|
Architecture.Wasm => "Wasm",
|
||||||
|
Architecture.S390x => "S390x",
|
||||||
|
Architecture.LoongArch64 => "LoongArch64",
|
||||||
|
Architecture.Armv6 => "Armv6",
|
||||||
|
Architecture.Ppc64le => "Ppc64le",
|
||||||
|
_ => RuntimeInformation.ProcessArchitecture.ToString(),
|
||||||
|
};
|
||||||
|
|
||||||
|
return OSPlatformName + '-' + architecture;
|
||||||
}
|
}
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
|
private static string GetExecutableFileExtension()
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
return "windows-x64";
|
return ".exe";
|
||||||
else if (RuntimeInformation.ProcessArchitecture == Architecture.X86)
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
return "windows-x86";
|
return string.Empty;
|
||||||
}
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
|
return string.Empty;
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
|
||||||
|
return string.Empty;
|
||||||
|
else
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue