diff --git a/Virtual Display Driver Control/Common/Settings.cs b/Virtual Display Driver Control/Common/Settings.cs index f63c96a3..1934eb69 100644 --- a/Virtual Display Driver Control/Common/Settings.cs +++ b/Virtual Display Driver Control/Common/Settings.cs @@ -21,7 +21,7 @@ public enum Material { public static class SettingsProvider { public static IAppSettings Initialize() { - var jsonPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "VirtualDisplayDriver", "appsettings.json"); + var jsonPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "VirtualDisplayDriver", "settings.json"); return new ConfigurationBuilder() .UseJsonFile(jsonPath) diff --git a/Virtual Display Driver Control/Views/SettingsView.xaml.cs b/Virtual Display Driver Control/Views/SettingsView.xaml.cs index 28b22e1f..8e49638d 100644 --- a/Virtual Display Driver Control/Views/SettingsView.xaml.cs +++ b/Virtual Display Driver Control/Views/SettingsView.xaml.cs @@ -3,7 +3,6 @@ using Microsoft.UI.Xaml.Controls; using System; using System.ComponentModel; -using System.Net.Http; using Virtual_Display_Driver_Control.Common; using Virtual_Display_Driver_Control.Helpers; using Windows.System; @@ -154,11 +153,12 @@ string UpdateCheck { bool needsUpdate = false; bool checkedUpdate = false; - private static readonly HttpClient client = new HttpClient(); + string releaseUrl = ""; + private static readonly Octokit.GitHubClient client = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("VirtualDisplayDriverControl")); private async void updates_Click(object sender, RoutedEventArgs e) { // update check was already done and succeeded, so launch uri if (needsUpdate) { - await Launcher.LaunchUriAsync(new Uri("https://github.com/MolotovCherry/virtual-display-rs/releases/latest")); + await Launcher.LaunchUriAsync(new Uri(releaseUrl)); return; } @@ -169,20 +169,23 @@ private async void updates_Click(object sender, RoutedEventArgs e) { // otherwise, do the update check instead try { - string reply = await client.GetStringAsync("https://raw.githubusercontent.com/MolotovCherry/virtual-display-rs/master/version"); + var release = await client.Repository.Release.GetLatest("MolotovCherry", "virtual-display-rs"); - Version data = Version.Parse(reply); + var tag = release.TagName[1..6]; + releaseUrl = release.HtmlUrl; + + Version data = Version.Parse(tag); var major = uint.Parse(GitVersionInformation.Major); var minor = uint.Parse(GitVersionInformation.Minor); var patch = uint.Parse(GitVersionInformation.Patch); if (data.Major > major || data.Minor > minor || data.Build > patch) { - UpdateCheck = $"Update is available: v{reply}"; + UpdateCheck = $"Update is available: v{tag}"; needsUpdate = true; checkedUpdate = true; } else { - UpdateCheck = $"No update is available; latest version is: v{reply}"; + UpdateCheck = $"No update is available"; needsUpdate = false; checkedUpdate = true; } diff --git a/Virtual Display Driver Control/Virtual Display Driver Control.csproj b/Virtual Display Driver Control/Virtual Display Driver Control.csproj index 6e374b7c..6a499169 100644 --- a/Virtual Display Driver Control/Virtual Display Driver Control.csproj +++ b/Virtual Display Driver Control/Virtual Display Driver Control.csproj @@ -46,6 +46,7 @@ + all diff --git a/version b/version deleted file mode 100644 index a2268e2d..00000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -0.3.1 \ No newline at end of file