From 77c13fcd8f55dc8579f62c4ca70439b6d44a8c22 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 9 Sep 2022 16:57:26 -0700 Subject: [PATCH 1/3] Removed async code from GetRepoImages and fixed the stupid check if a file exists remotely --- UWUVCI AIO WPF/Models/MainViewModel.cs | 31 ++++++++++++-------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index 965ceca..d9338f0 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -1429,17 +1429,14 @@ namespace UWUVCI_AIO_WPF } } //I hate everything about this function - private async Task RemoteFileExists(string url) + private bool RemoteFileExists(string url) { try { HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "HEAD"; - - HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse; - var statusCode = response.StatusCode; - response.Close(); - return (statusCode == HttpStatusCode.OK); + using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) + return (response.StatusCode == HttpStatusCode.OK); } catch { @@ -2386,7 +2383,7 @@ namespace UWUVCI_AIO_WPF repoids.Add(SystemType + repoid.Substring(0, 3) + "P"); repoids.Add(SystemType + repoid.Substring(0, 3) + "J"); - await GetRepoImages(SystemType, repoid); + GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.GBA, repoids); } @@ -2402,7 +2399,7 @@ namespace UWUVCI_AIO_WPF if (await CheckForInternetConnectionWOWarningAsync()) { - await GetRepoImages(SystemType, repoid); + GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.SNES, repoids); } } @@ -2417,7 +2414,7 @@ namespace UWUVCI_AIO_WPF if (await CheckForInternetConnectionWOWarningAsync()) { - await GetRepoImages(SystemType, repoid); + GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.MSX, repoids); } } @@ -2431,7 +2428,7 @@ namespace UWUVCI_AIO_WPF }; if (await CheckForInternetConnectionWOWarningAsync()) { - await GetRepoImages(SystemType, repoid); + GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.TG16, repoids); } } @@ -2539,7 +2536,7 @@ namespace UWUVCI_AIO_WPF if (await CheckForInternetConnectionWOWarningAsync()) { - await GetRepoImages(SystemType, repoid); + GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.NES, repoids); } } @@ -2668,7 +2665,7 @@ namespace UWUVCI_AIO_WPF repoids.Add(SystemType + repoid.Substring(0, 3) + "E"); repoids.Add(SystemType + repoid.Substring(0, 3) + "P"); repoids.Add(SystemType + repoid.Substring(0, 3) + "J"); - await GetRepoImages(SystemType, repoid); + GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.NDS, repoids); } } @@ -2693,7 +2690,7 @@ namespace UWUVCI_AIO_WPF repoids.Add(SystemType + repoid); repoids.Add(SystemType + new string(new char[] { repoid[0], repoid[2], repoid[1], repoid[3] })); - await GetRepoImages(SystemType, repoid); + GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.N64, repoids); } } @@ -2832,7 +2829,7 @@ namespace UWUVCI_AIO_WPF { foreach (string repoid in repoids) { - if (await RemoteFileExists(linkbase + repoid + "/game.ini")) + if (RemoteFileExists(linkbase + repoid + "/game.ini")) { ini = true; inip = linkbase + repoid + "/game.ini"; @@ -2845,7 +2842,7 @@ namespace UWUVCI_AIO_WPF { foreach (string repoid in repoids) { - if (await RemoteFileExists(linkbase + repoid + "/BootSound." + e)) + if (RemoteFileExists(linkbase + repoid + "/BootSound." + e)) { btsnd = true; string btsndp = linkbase + repoid + "/BootSound." + e; @@ -3025,7 +3022,7 @@ namespace UWUVCI_AIO_WPF /// /// /// - private async Task GetRepoImages(string SystemType, string repoid, List repoids = null) + private void GetRepoImages(string SystemType, string repoid, List repoids = null) { string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; IMG_Message img = null; @@ -3053,7 +3050,7 @@ namespace UWUVCI_AIO_WPF foreach (var id in repoids) { var remoteFile = linkbase + id + $"/iconTex.{e}"; - if (await RemoteFileExists(remoteFile) == true) + if (RemoteFileExists(remoteFile) == true) { if (e.Contains("tga")) From 08d75a483d6b3a9cce9fe3a31805f81d254e4cbf Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 9 Sep 2022 16:57:43 -0700 Subject: [PATCH 2/3] Found another stupid check that needs to be fixed --- UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs b/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs index bbdbdc0..52e7e3d 100644 --- a/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs @@ -479,9 +479,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows { HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "HEAD"; - HttpWebResponse response = request.GetResponse() as HttpWebResponse; - response.Close(); - return (response.StatusCode == HttpStatusCode.OK); + using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) + return (response.StatusCode == HttpStatusCode.OK); } catch { From e79cdbe01415b23efe5532e063f25eb28fff126a Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 9 Sep 2022 16:57:51 -0700 Subject: [PATCH 3/3] Upping version number --- UWUVCI AIO WPF/Properties/AssemblyInfo.cs | 4 ++-- UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml | 2 +- UWUVCI AIO WPF/UI/Frames/StartFrame.xaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UWUVCI AIO WPF/Properties/AssemblyInfo.cs b/UWUVCI AIO WPF/Properties/AssemblyInfo.cs index 5b08e2a..11307d8 100644 --- a/UWUVCI AIO WPF/Properties/AssemblyInfo.cs +++ b/UWUVCI AIO WPF/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Windows; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.99.1.0")] -[assembly: AssemblyFileVersion("3.99.1.0")] +[assembly: AssemblyVersion("3.99.2.0")] +[assembly: AssemblyFileVersion("3.99.2.0")] diff --git a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml index 97ef27e..9a36abb 100644 --- a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml +++ b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml @@ -46,7 +46,7 @@ -