fix downloads + shitty dependency detection

This commit is contained in:
Dexrn ZacAttack
2025-02-28 18:06:21 -08:00
parent c0822f7735
commit 7223a6af3d
3 changed files with 38 additions and 6 deletions

View File

@@ -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();

View File

@@ -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)));
}
}
}

View File

@@ -66,7 +66,7 @@ namespace WinDurango.UI.Utils
// 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-DEBUG.zip";
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";
@@ -273,12 +273,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;