diff --git a/EZPPClient Installer/MD5File.cs b/EZPPClient Installer/Objects/MD5File.cs similarity index 100% rename from EZPPClient Installer/MD5File.cs rename to EZPPClient Installer/Objects/MD5File.cs diff --git a/EZPPClient Installer/Shortcut.cs b/EZPPClient Installer/Objects/Shortcut.cs similarity index 100% rename from EZPPClient Installer/Shortcut.cs rename to EZPPClient Installer/Objects/Shortcut.cs diff --git a/EZPPClient Installer/UpdateState.cs b/EZPPClient Installer/Objects/UpdateState.cs similarity index 100% rename from EZPPClient Installer/UpdateState.cs rename to EZPPClient Installer/Objects/UpdateState.cs diff --git a/EZPPClient Installer/DownloadUtil.cs b/EZPPClient Installer/Utils/DownloadUtil.cs similarity index 88% rename from EZPPClient Installer/DownloadUtil.cs rename to EZPPClient Installer/Utils/DownloadUtil.cs index 8c13eb5..d3b94d4 100644 --- a/EZPPClient Installer/DownloadUtil.cs +++ b/EZPPClient Installer/Utils/DownloadUtil.cs @@ -12,7 +12,7 @@ namespace EZPPClient_Installer public class DownloadUtil { - public static List FilesToDownload(string pathToEZPP, bool reinstall) + public static async Task> FilesToDownload(string pathToEZPP, bool reinstall) { bool directoryExists = Directory.Exists(pathToEZPP); @@ -21,17 +21,16 @@ namespace EZPPClient_Installer try { - using (WebClient wc = new WebClient()) { wc.Headers.Add("user-agent", "EZPPClientInstaller"); - var data = wc.DownloadString("https://new.ez-pp.farm/ezppclient?list"); + var data = await wc.DownloadStringTaskAsync("https://new.ez-pp.farm/ezppclient?list&release=" + MainWindow.RELEASESTREAM.ToLower()); string[] dataList = data.Split('\n'); foreach (string datastring in dataList) { - if (string.IsNullOrWhiteSpace(datastring)) + if (string.IsNullOrWhiteSpace(datastring) || !datastring.Contains("#")) continue; - + string[] se = datastring.Split('#'); string md5 = StripHTML(se[0]); string name = StripHTML(se[1]); @@ -41,7 +40,7 @@ namespace EZPPClient_Installer } catch (WebException error) { - new ContentDialog() + _ = new ContentDialog() { Title = "Oops...", Content = "A error occurred while trying to fetch all needed Files.\n" + error.Message, @@ -72,7 +71,7 @@ namespace EZPPClient_Installer string onlineHash = md5file.MD5; string pcHash = MD5Util.CalculateMD5(file); #if DEBUG - MessageBox.Show("Filename: " + md5file.getName() + "\nOnline-Hash: " + onlineHash + "\n PC-Hash: " + pcHash); + MessageBox.Show("Filename: " + md5file.Name + "\nOnline-Hash: " + onlineHash + "\n PC-Hash: " + pcHash); #endif if (!string.Equals(onlineHash, pcHash)) { @@ -151,7 +150,7 @@ namespace EZPPClient_Installer MainWindow.updateProgress(filename + " - " + value.ProgressPercentage + "% - " + Math.Round((averageTransferRate / 1024000D) * 1.8, 2) + "MBit/s", value.ProgressPercentage); }; - await wc.DownloadFileTaskAsync(@"https://new.ez-pp.farm/ezppclient?file=" + filename, path + @"\" + filename); + await wc.DownloadFileTaskAsync(@"https://new.ez-pp.farm/ezppclient?file=" + filename + "&release=" + MainWindow.RELEASESTREAM.ToLower(), path + @"\" + filename); ; } } catch (WebException) diff --git a/EZPPClient Installer/MD5Util.cs b/EZPPClient Installer/Utils/MD5Util.cs similarity index 100% rename from EZPPClient Installer/MD5Util.cs rename to EZPPClient Installer/Utils/MD5Util.cs diff --git a/EZPPClient Installer/OsuUtil.cs b/EZPPClient Installer/Utils/OsuUtil.cs similarity index 100% rename from EZPPClient Installer/OsuUtil.cs rename to EZPPClient Installer/Utils/OsuUtil.cs diff --git a/EZPPClient Installer/ProcessUtil.cs b/EZPPClient Installer/Utils/ProcessUtil.cs similarity index 100% rename from EZPPClient Installer/ProcessUtil.cs rename to EZPPClient Installer/Utils/ProcessUtil.cs