update AppUpdate to support linux updates
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Pilz.Extensions;
|
using Pilz.Extensions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace ModpackUpdater.Apps.Client;
|
namespace ModpackUpdater.Apps.Client;
|
||||||
|
|
||||||
@@ -12,9 +13,10 @@ public class AppUpdater
|
|||||||
[JsonConverter(typeof(VersionConverter))]
|
[JsonConverter(typeof(VersionConverter))]
|
||||||
public Version Version { get; set; }
|
public Version Version { get; set; }
|
||||||
public string DownloadUrl { get; set; }
|
public string DownloadUrl { get; set; }
|
||||||
|
public string DownloadUrlLinux { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string UPDATE_URL = "https://git.pilzinsel64.de/gaming/minecraft/minecraft-modpack-updater/-/snippets/3/raw/main/updates.json";
|
private const string UPDATE_URL = "https://git.pilzinsel64.de/pilzinsel64/minecraft-modpack-updater/-/snippets/3/raw/main/updates.json";
|
||||||
private readonly HttpClient httpClient = new();
|
private readonly HttpClient httpClient = new();
|
||||||
private UpdateInfo info;
|
private UpdateInfo info;
|
||||||
|
|
||||||
@@ -60,7 +62,8 @@ public class AppUpdater
|
|||||||
Stream downloadStream = null;
|
Stream downloadStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
downloadStream = await client.GetStreamAsync(info.DownloadUrl);
|
var url = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? info.DownloadUrlLinux : info.DownloadUrl;
|
||||||
|
downloadStream = await client.GetStreamAsync(url);
|
||||||
await downloadStream.CopyToAsync(tempFileStream);
|
await downloadStream.CopyToAsync(tempFileStream);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
Reference in New Issue
Block a user