mirror of
https://github.com/WinDurango/WinDurango.UI.git
synced 2026-01-31 00:55:24 +01:00
Merge branch 'main' into qolPatch
This commit is contained in:
@@ -5,6 +5,7 @@ using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using WinDurango.UI.Dialogs;
|
||||
using WinDurango.UI.Pages;
|
||||
using WinDurango.UI.Settings;
|
||||
@@ -96,9 +97,27 @@ namespace WinDurango.UI
|
||||
|
||||
private async void appTitleBar_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// have to do it here otherwise instance error
|
||||
Dictionary<string, string> missing = [];
|
||||
|
||||
if (String.IsNullOrEmpty(FSHelper.FindFileOnPath("vcruntime140d.dll")))
|
||||
missing.Add("Microsoft Visual C++ Redistributable", null);
|
||||
|
||||
var devNotice = new NoticeDialog($"This UI is very early in development, and mainly developed by a C# learner... There WILL be bugs, and some things will NOT work...\n\nDevelopers, check Readme.md in the repo for the todolist.", "Important");
|
||||
await devNotice.ShowAsync();
|
||||
|
||||
if (missing.Count != 0)
|
||||
{
|
||||
// todo: properly provide download link
|
||||
string notice = $"You are missing the following dependencies, which may be required to run some packages.\n";
|
||||
foreach (KeyValuePair<string, string> ms in missing)
|
||||
{
|
||||
notice += $"\n - {ms.Key}";
|
||||
}
|
||||
|
||||
var missingNotice = new NoticeDialog(notice, "Missing dependencies");
|
||||
await missingNotice.ShowAsync();
|
||||
}
|
||||
|
||||
if (ExtendsContentIntoTitleBar)
|
||||
{
|
||||
SetupTitleBar();
|
||||
|
||||
@@ -43,5 +43,13 @@ namespace WinDurango.UI.Utils
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(folder) { UseShellExecute = true });
|
||||
}
|
||||
|
||||
public static string FindFileOnPath(string file)
|
||||
{
|
||||
return Environment
|
||||
.GetEnvironmentVariable("PATH")
|
||||
.Split(Path.PathSeparator)
|
||||
.FirstOrDefault(p => File.Exists(Path.Combine(p, file)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,10 +53,7 @@ namespace WinDurango.UI.Utils
|
||||
public static async Task<bool> PatchPackage(installedPackage package, bool forceRedownload,
|
||||
ProgressController controller)
|
||||
{
|
||||
// Artifact dll package link
|
||||
const string dllLink =
|
||||
"https://nightly.link/WinDurango/WinDurango/workflows/msbuild/main/WinDurango-DEBUG.zip";
|
||||
|
||||
string patchesPath = Path.Combine(App.DataDir, "WinDurangoCore");
|
||||
controller?.Update($"Patching {package.FamilyName}", 0);
|
||||
string curDate = DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss");
|
||||
string installPath = package.InstallPath;
|
||||
@@ -64,24 +61,18 @@ namespace WinDurango.UI.Utils
|
||||
controller?.Update("Getting latest release", 10);
|
||||
await GetOrReuseRelease(); // don't use the return value since wdRelease is set regardless
|
||||
|
||||
// This should be further improved...
|
||||
bool isDownloadSourceArtifact = App.Settings.Settings.DownloadSource == UiConfigData.PatchSource.Artifact;
|
||||
string dlLink = wdRelease.DownloadLink;
|
||||
string relName = wdRelease.Name;
|
||||
string dlPath = $"WinDurangoCore.zip";
|
||||
|
||||
string dlLink = isDownloadSourceArtifact
|
||||
? dllLink
|
||||
: wdRelease.DownloadLink;
|
||||
|
||||
string relName = isDownloadSourceArtifact
|
||||
? "latest GitHub Actions artifact"
|
||||
: wdRelease.Name;
|
||||
|
||||
string dlPath = isDownloadSourceArtifact
|
||||
? "WinDurangoCore-ARTIFACT.zip"
|
||||
: "WinDurangoCore.zip";
|
||||
|
||||
string patchesPath = isDownloadSourceArtifact
|
||||
? Path.Combine(App.DataDir, "WinDurangoCore-ARTIFACT")
|
||||
: Path.Combine(App.DataDir, "WinDurangoCore");
|
||||
// see this is quite messy but just needed to get it to work
|
||||
if (App.Settings.Settings.DownloadSource == UiConfigData.PatchSource.Artifact)
|
||||
{
|
||||
dlLink = "https://nightly.link/WinDurango/WinDurango/workflows/msbuild/main/WinDurango-Release.zip";
|
||||
dlPath = $"WinDurangoCore-ARTIFACT.zip";
|
||||
patchesPath = Path.Combine(App.DataDir, "WinDurangoCore-ARTIFACT");
|
||||
relName = $"latest GitHub Actions artifact";
|
||||
}
|
||||
|
||||
if (!Path.Exists(patchesPath) || forceRedownload)
|
||||
{
|
||||
@@ -285,12 +276,17 @@ namespace WinDurango.UI.Utils
|
||||
|
||||
JsonElement.ArrayEnumerator assets = newestRelease.GetProperty("assets").EnumerateArray();
|
||||
|
||||
if (!assets.MoveNext())
|
||||
throw new Exception("Couldn't find any assets?????");
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
if (!asset.GetProperty("name").GetString().EndsWith(".zip"))
|
||||
continue;
|
||||
|
||||
string download = assets.Current.GetProperty("browser_download_url").GetString();
|
||||
string download = asset.GetProperty("browser_download_url").GetString();
|
||||
release.DownloadLink = download;
|
||||
}
|
||||
|
||||
release.DownloadLink = download;
|
||||
if (String.IsNullOrEmpty(release.DownloadLink))
|
||||
throw new Exception("Couldn't find release with zip file");
|
||||
|
||||
wdRelease = release;
|
||||
return release;
|
||||
|
||||
Reference in New Issue
Block a user