diff --git a/Forms/MainFrm.Designer.cs b/Forms/MainFrm.Designer.cs index bb6a9d6..c5d6895 100644 --- a/Forms/MainFrm.Designer.cs +++ b/Forms/MainFrm.Designer.cs @@ -32,6 +32,12 @@ private void InitializeComponent() this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainFrm)); this.TabCtrl = new System.Windows.Forms.TabControl(); + this.DashboardTab = new System.Windows.Forms.TabPage(); + this.ChangelogCtrl = new CodeRedLauncher.Controls.CRChangelog(); + this.UpdateCtrl = new CodeRedLauncher.Controls.CRUpdatePanel(); + this.ProcessCtrl = new CodeRedLauncher.Controls.CRProcessPanel(); + this.LaunchBtn = new CodeRedLauncher.Controls.CRButton(); + this.ManualInjectBtn = new CodeRedLauncher.Controls.CRButton(); this.NewsTab = new System.Windows.Forms.TabPage(); this.NewsCtrl = new CodeRedLauncher.Controls.CRNewsPanel(); this.SessionsTab = new System.Windows.Forms.TabPage(); @@ -89,12 +95,6 @@ private void InitializeComponent() this.ModuleVersionLbl = new System.Windows.Forms.Label(); this.LauncherVersionImg = new System.Windows.Forms.PictureBox(); this.LauncherVersionLbl = new System.Windows.Forms.Label(); - this.DashboardTab = new System.Windows.Forms.TabPage(); - this.ChangelogCtrl = new CodeRedLauncher.Controls.CRChangelog(); - this.UpdateCtrl = new CodeRedLauncher.Controls.CRUpdatePanel(); - this.ProcessCtrl = new CodeRedLauncher.Controls.CRProcessPanel(); - this.LaunchBtn = new CodeRedLauncher.Controls.CRButton(); - this.ManualInjectBtn = new CodeRedLauncher.Controls.CRButton(); this.BackgroundPnl = new System.Windows.Forms.Panel(); this.TabPnl = new System.Windows.Forms.Panel(); this.AboutTabBtn = new CodeRedLauncher.Controls.CRTab(); @@ -115,6 +115,7 @@ private void InitializeComponent() this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components); this.UpdateTmr = new System.Windows.Forms.Timer(this.components); this.TabCtrl.SuspendLayout(); + this.DashboardTab.SuspendLayout(); this.NewsTab.SuspendLayout(); this.SessionsTab.SuspendLayout(); this.TexturesTab.SuspendLayout(); @@ -134,7 +135,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.PsyonixVersionImg)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ModVersionImg)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.LauncherVersionImg)).BeginInit(); - this.DashboardTab.SuspendLayout(); this.BackgroundPnl.SuspendLayout(); this.TabPnl.SuspendLayout(); this.SuspendLayout(); @@ -154,6 +154,88 @@ private void InitializeComponent() this.TabCtrl.Size = new System.Drawing.Size(918, 628); this.TabCtrl.TabIndex = 3; // + // DashboardTab + // + this.DashboardTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16))))); + this.DashboardTab.Controls.Add(this.LaunchBtn); + this.DashboardTab.Controls.Add(this.ChangelogCtrl); + this.DashboardTab.Controls.Add(this.UpdateCtrl); + this.DashboardTab.Controls.Add(this.ProcessCtrl); + this.DashboardTab.Controls.Add(this.ManualInjectBtn); + this.DashboardTab.Location = new System.Drawing.Point(4, 24); + this.DashboardTab.Name = "DashboardTab"; + this.DashboardTab.Padding = new System.Windows.Forms.Padding(3); + this.DashboardTab.Size = new System.Drawing.Size(910, 600); + this.DashboardTab.TabIndex = 0; + this.DashboardTab.Text = "Dashboard"; + // + // ChangelogCtrl + // + this.ChangelogCtrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + this.ChangelogCtrl.DisplayImage = global::CodeRedLauncher.Properties.Resources.Log_White; + this.ChangelogCtrl.DisplayText = "Loading..."; + this.ChangelogCtrl.DisplayTitle = "Module Changelog"; + this.ChangelogCtrl.Location = new System.Drawing.Point(25, 180); + this.ChangelogCtrl.Name = "ChangelogCtrl"; + this.ChangelogCtrl.Size = new System.Drawing.Size(860, 315); + this.ChangelogCtrl.TabIndex = 33; + this.ChangelogCtrl.OnChangelogSwap += new System.EventHandler(this.ChangelogCtrl_OnChangelogSwap); + // + // UpdateCtrl + // + this.UpdateCtrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + this.UpdateCtrl.DescriptionImage = global::CodeRedLauncher.Properties.Resources.Info_White; + this.UpdateCtrl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.UpdateCtrl.Location = new System.Drawing.Point(535, 25); + this.UpdateCtrl.Name = "UpdateCtrl"; + this.UpdateCtrl.Size = new System.Drawing.Size(350, 130); + this.UpdateCtrl.Status = CodeRedLauncher.Controls.CRUpdatePanel.StatusTypes.TYPE_LOADING; + this.UpdateCtrl.TabIndex = 1; + this.UpdateCtrl.TitleImage = global::CodeRedLauncher.Properties.Resources.Question_White; + // + // ProcessCtrl + // + this.ProcessCtrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + this.ProcessCtrl.DescriptionImage = global::CodeRedLauncher.Properties.Resources.Comment_White; + this.ProcessCtrl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.ProcessCtrl.Location = new System.Drawing.Point(25, 25); + this.ProcessCtrl.Name = "ProcessCtrl"; + this.ProcessCtrl.Result = CodeRedLauncher.InjectionResults.RESULT_NONE; + this.ProcessCtrl.Size = new System.Drawing.Size(485, 130); + this.ProcessCtrl.Status = CodeRedLauncher.Controls.CRProcessPanel.StatusTypes.TYPE_LOADING; + this.ProcessCtrl.TabIndex = 0; + this.ProcessCtrl.TitleImage = global::CodeRedLauncher.Properties.Resources.Rocket_White; + // + // LaunchBtn + // + this.LaunchBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(175)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.LaunchBtn.DisplayFont = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.LaunchBtn.DisplayImage = global::CodeRedLauncher.Properties.Resources.Question_White; + this.LaunchBtn.DisplayStyle = CodeRedLauncher.Controls.CRButton.ButtonStyles.STYLE_COLORED; + this.LaunchBtn.DisplayText = "Launch Rocket League"; + this.LaunchBtn.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.LaunchBtn.Location = new System.Drawing.Point(288, 530); + this.LaunchBtn.Name = "LaunchBtn"; + this.LaunchBtn.Size = new System.Drawing.Size(320, 35); + this.LaunchBtn.TabIndex = 32; + this.LaunchBtn.Visible = false; + this.LaunchBtn.OnButtonClick += new System.EventHandler(this.LaunchBtn_OnButtonClick); + // + // ManualInjectBtn + // + this.ManualInjectBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(175)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.ManualInjectBtn.DisplayFont = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.ManualInjectBtn.DisplayImage = global::CodeRedLauncher.Properties.Resources.Hand_White; + this.ManualInjectBtn.DisplayStyle = CodeRedLauncher.Controls.CRButton.ButtonStyles.STYLE_COLORED; + this.ManualInjectBtn.DisplayText = "Manually Inject"; + this.ManualInjectBtn.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.ManualInjectBtn.Location = new System.Drawing.Point(288, 530); + this.ManualInjectBtn.Name = "ManualInjectBtn"; + this.ManualInjectBtn.Size = new System.Drawing.Size(320, 35); + this.ManualInjectBtn.TabIndex = 34; + this.ManualInjectBtn.Visible = false; + this.ManualInjectBtn.Click += new System.EventHandler(this.ManualInjectBtn_Click); + // // NewsTab // this.NewsTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16))))); @@ -872,88 +954,6 @@ private void InitializeComponent() this.LauncherVersionLbl.Text = "Launcher Version:"; this.LauncherVersionLbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // DashboardTab - // - this.DashboardTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(16)))), ((int)(((byte)(16)))), ((int)(((byte)(16))))); - this.DashboardTab.Controls.Add(this.ChangelogCtrl); - this.DashboardTab.Controls.Add(this.UpdateCtrl); - this.DashboardTab.Controls.Add(this.ProcessCtrl); - this.DashboardTab.Controls.Add(this.LaunchBtn); - this.DashboardTab.Controls.Add(this.ManualInjectBtn); - this.DashboardTab.Location = new System.Drawing.Point(4, 24); - this.DashboardTab.Name = "DashboardTab"; - this.DashboardTab.Padding = new System.Windows.Forms.Padding(3); - this.DashboardTab.Size = new System.Drawing.Size(910, 600); - this.DashboardTab.TabIndex = 0; - this.DashboardTab.Text = "Dashboard"; - // - // ChangelogCtrl - // - this.ChangelogCtrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.ChangelogCtrl.DisplayImage = global::CodeRedLauncher.Properties.Resources.Log_White; - this.ChangelogCtrl.DisplayText = "Loading..."; - this.ChangelogCtrl.DisplayTitle = "Module Changelog"; - this.ChangelogCtrl.Location = new System.Drawing.Point(25, 180); - this.ChangelogCtrl.Name = "ChangelogCtrl"; - this.ChangelogCtrl.Size = new System.Drawing.Size(860, 315); - this.ChangelogCtrl.TabIndex = 33; - this.ChangelogCtrl.OnChangelogSwap += new System.EventHandler(this.ChangelogCtrl_OnChangelogSwap); - // - // UpdateCtrl - // - this.UpdateCtrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.UpdateCtrl.DescriptionImage = global::CodeRedLauncher.Properties.Resources.Info_White; - this.UpdateCtrl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.UpdateCtrl.Location = new System.Drawing.Point(535, 25); - this.UpdateCtrl.Name = "UpdateCtrl"; - this.UpdateCtrl.Size = new System.Drawing.Size(350, 130); - this.UpdateCtrl.Status = CodeRedLauncher.Controls.CRUpdatePanel.StatusTypes.TYPE_LOADING; - this.UpdateCtrl.TabIndex = 1; - this.UpdateCtrl.TitleImage = global::CodeRedLauncher.Properties.Resources.Question_White; - // - // ProcessCtrl - // - this.ProcessCtrl.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.ProcessCtrl.DescriptionImage = global::CodeRedLauncher.Properties.Resources.Comment_White; - this.ProcessCtrl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.ProcessCtrl.Location = new System.Drawing.Point(25, 25); - this.ProcessCtrl.Name = "ProcessCtrl"; - this.ProcessCtrl.Result = CodeRedLauncher.InjectionResults.RESULT_NONE; - this.ProcessCtrl.Size = new System.Drawing.Size(485, 130); - this.ProcessCtrl.Status = CodeRedLauncher.Controls.CRProcessPanel.StatusTypes.TYPE_LOADING; - this.ProcessCtrl.TabIndex = 0; - this.ProcessCtrl.TitleImage = global::CodeRedLauncher.Properties.Resources.Rocket_White; - // - // LaunchBtn - // - this.LaunchBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(175)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.LaunchBtn.DisplayFont = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.LaunchBtn.DisplayImage = global::CodeRedLauncher.Properties.Resources.Question_White; - this.LaunchBtn.DisplayStyle = CodeRedLauncher.Controls.CRButton.ButtonStyles.STYLE_COLORED; - this.LaunchBtn.DisplayText = "Launch Rocket League"; - this.LaunchBtn.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.LaunchBtn.Location = new System.Drawing.Point(288, 530); - this.LaunchBtn.Name = "LaunchBtn"; - this.LaunchBtn.Size = new System.Drawing.Size(320, 35); - this.LaunchBtn.TabIndex = 32; - this.LaunchBtn.Visible = false; - this.LaunchBtn.OnButtonClick += new System.EventHandler(this.LaunchBtn_OnButtonClick); - // - // ManualInjectBtn - // - this.ManualInjectBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(175)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.ManualInjectBtn.DisplayFont = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.ManualInjectBtn.DisplayImage = global::CodeRedLauncher.Properties.Resources.Hand_White; - this.ManualInjectBtn.DisplayStyle = CodeRedLauncher.Controls.CRButton.ButtonStyles.STYLE_COLORED; - this.ManualInjectBtn.DisplayText = "Manually Inject"; - this.ManualInjectBtn.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.ManualInjectBtn.Location = new System.Drawing.Point(288, 530); - this.ManualInjectBtn.Name = "ManualInjectBtn"; - this.ManualInjectBtn.Size = new System.Drawing.Size(320, 35); - this.ManualInjectBtn.TabIndex = 34; - this.ManualInjectBtn.Visible = false; - this.ManualInjectBtn.Click += new System.EventHandler(this.ManualInjectBtn_Click); - // // BackgroundPnl // this.BackgroundPnl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -1232,6 +1232,7 @@ private void InitializeComponent() this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Load += new System.EventHandler(this.MainFrm_Load); this.TabCtrl.ResumeLayout(false); + this.DashboardTab.ResumeLayout(false); this.NewsTab.ResumeLayout(false); this.SessionsTab.ResumeLayout(false); this.TexturesTab.ResumeLayout(false); @@ -1251,7 +1252,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.PsyonixVersionImg)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ModVersionImg)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.LauncherVersionImg)).EndInit(); - this.DashboardTab.ResumeLayout(false); this.BackgroundPnl.ResumeLayout(false); this.TabPnl.ResumeLayout(false); this.ResumeLayout(false); diff --git a/Forms/MainFrm.cs b/Forms/MainFrm.cs index 7cda181..62e63ac 100644 --- a/Forms/MainFrm.cs +++ b/Forms/MainFrm.cs @@ -417,6 +417,7 @@ private void ProcessTmr_Tick(object sender, EventArgs e) { if (!Updator.IsOutdated()) { + CheckForUpdates(true, false); ProcessCtrl.Status = CRProcessPanel.StatusTypes.TYPE_RUNNING; ProcessCtrl.Result = InjectionResults.RESULT_NONE; } @@ -460,8 +461,6 @@ private void ProcessTmr_Tick(object sender, EventArgs e) private void InjectTmr_Tick(object sender, EventArgs e) { - CheckForUpdates(true); - if (!Configuration.OfflineMode.GetBoolValue()) { if (Updator.IsOutdated() && Configuration.ShouldPreventInjection()) @@ -513,7 +512,7 @@ private void InjectTmr_Tick(object sender, EventArgs e) private void UpdateTmr_Tick(object sender, EventArgs e) { - if (Updator.IsOutdated()) + if (!Updator.IsOutdated()) { Logger.Write("Auto checking for updates..."); CheckForUpdates(true); @@ -641,7 +640,7 @@ private async void StartupRoutine(bool bInvalidate = false) } else { - ContinueStartup(); + ContinueStartup(false); } } else @@ -658,7 +657,7 @@ private async void StartupRoutine(bool bInvalidate = false) } else { - ContinueStartup(); + ContinueStartup(false); } } @@ -666,10 +665,15 @@ private async void StartupRoutine(bool bInvalidate = false) StorageToInterface(); // Retrieves Rocket League paths, version, and platform info to then assign to the UI. } - private async void ContinueStartup() + private async void ContinueStartup(bool bInvalidate) { if (!Configuration.OfflineMode.GetBoolValue()) { + if (bInvalidate) + { + Retrievers.Invalidate(); + } + NewsCtrl.ParseArticles(await Retrievers.GetNewsUrl()); ChangelogCtrl.DisplayText = await Retrievers.GetModuleChangelog(); DiscordLink.Text = await Retrievers.GetDiscordUrl(); @@ -763,7 +767,7 @@ private void StorageToInterface() } // If "bInvalidate" is set to true it forces the application to retrieve all local and remote information. - private async Task CheckForUpdates(bool bInvalidate) + private async Task CheckForUpdates(bool bInvalidate, bool bShowPrompt = true) { if (!Configuration.OfflineMode.GetBoolValue() || bInvalidate) { @@ -822,7 +826,10 @@ private async Task CheckForUpdates(bool bInvalidate) UpdatePopupCtrl.DisplayDescription = "A new version of both the module and launcher were found, would you like to automatically install both now?"; } - UpdatePopupCtrl.Show(); + if (bShowPrompt) + { + UpdatePopupCtrl.Show(); + } } else if (!ignoreModule && moduleOutdated) { @@ -848,7 +855,10 @@ private async Task CheckForUpdates(bool bInvalidate) UpdatePopupCtrl.DisplayDescription = "A new version of the module was found, would you like to automatically install it now?"; } - UpdatePopupCtrl.Show(); + if (bShowPrompt) + { + UpdatePopupCtrl.Show(); + } } else if (launcherOutdated) { @@ -857,9 +867,12 @@ private async Task CheckForUpdates(bool bInvalidate) // Doesn't matter if Rocket League is open or not when updating the launcher, so no need to check if any processes are running. - UpdatePopupCtrl.ButtonLayout = CRPopup.ButtonLayouts.TYPE_DOUBLE; - UpdatePopupCtrl.DisplayDescription = "A new version of the launcher was found, would you like to automatically install it now?"; - UpdatePopupCtrl.Show(); + if (bShowPrompt) + { + UpdatePopupCtrl.ButtonLayout = CRPopup.ButtonLayouts.TYPE_DOUBLE; + UpdatePopupCtrl.DisplayDescription = "A new version of the launcher was found, would you like to automatically install it now?"; + UpdatePopupCtrl.Show(); + } } else { @@ -881,7 +894,8 @@ private async Task CheckForUpdates(bool bInvalidate) Logger.Write("Could not check for updates, launcher is running in offline mode!"); } - StorageToInterface(); + ConfigToInterface(); // Retrieves the users configuration settings and assigns it to the UI. + StorageToInterface(); // Retrieves Rocket League paths, version, and platform info to then assign to the UI. return true; } @@ -954,6 +968,8 @@ private void UpdatePopupCtrl_DoubleFirstButtonClick(object sender, EventArgs e) private async void UpdatePopupCtrl_DoubleSecondButtonClick(object sender, EventArgs e) { + Retrievers.Invalidate(); + await Retrievers.CheckInitialized(); Result report = await Updator.InstallUpdates(); if (report.Succeeded) @@ -976,14 +992,14 @@ private void UpdatePopupCtrl_SingleButtonClick(object sender, EventArgs e) private void OfflinePopupCtrl_DoubleFirstButtonClick(object sender, EventArgs e) { Configuration.OfflineMode.SetValue(false); - ContinueStartup(); + ContinueStartup(true); OfflinePopupCtrl.Hide(); } private void OfflinePopupCtrl_DoubleSecondButtonClick(object sender, EventArgs e) { Configuration.OfflineMode.SetValue(true); - ContinueStartup(); + ContinueStartup(false); OfflinePopupCtrl.Hide(); } } diff --git a/Forms/MainFrm.resx b/Forms/MainFrm.resx index a88c2dd..63fec21 100644 --- a/Forms/MainFrm.resx +++ b/Forms/MainFrm.resx @@ -60,6 +60,9 @@ True + + True + True @@ -69,9 +72,6 @@ True - - True - True diff --git a/Framework/Assembly.cs b/Framework/Assembly.cs index 67c7bda..6caf467 100644 --- a/Framework/Assembly.cs +++ b/Framework/Assembly.cs @@ -11,7 +11,7 @@ public static class Assembly private static readonly string Product = "CodeRedLauncher"; private static readonly string Copyright = "Copyright © CodeRedModding 2022"; private static readonly string License = "MIT License"; - private static readonly string Version = "1.0.6"; + private static readonly string Version = "1.0.7"; public static string GetTitle() { return Title; } public static string GetDescription() { return Description; } diff --git a/Framework/Retrievers.cs b/Framework/Retrievers.cs index a98e4c2..5c132aa 100644 --- a/Framework/Retrievers.cs +++ b/Framework/Retrievers.cs @@ -23,7 +23,7 @@ public static async Task WebsiteOnline(string url) try { - PingReply pingReply = await newPing.SendPingAsync(new Uri(url).Host); + PingReply pingReply = await newPing.SendPingAsync(new Uri(url).Host, 10000); if (pingReply.Status == IPStatus.Success) { @@ -31,7 +31,7 @@ public static async Task WebsiteOnline(string url) } else { - Logger.Write("Ping request failed: " + pingReply.Status.ToString(), LogLevel.LEVEL_WARN); + Logger.Write("Ping request failed, reason " + pingReply.Status.ToString(), LogLevel.LEVEL_WARN); } } catch (Exception ex) @@ -109,23 +109,26 @@ public static async Task DownloadPage(string url) return pageContent; } - public static async Task DownloadFile(string url, Architecture.Path toFolder, string fileName) + public static async Task DownloadFile(string url, Architecture.Path folder, string fileName) { - if (!String.IsNullOrEmpty(url)) + if (folder.Exists()) { - using (HttpClient client = new HttpClient()) + if (!String.IsNullOrEmpty(url)) { - HttpResponseMessage response = await client.GetAsync(url); - - if (response.IsSuccessStatusCode) + using (HttpClient client = new HttpClient()) { - string path = (toFolder / fileName).GetPath(); - byte[] content = await response.Content.ReadAsByteArrayAsync(); + HttpResponseMessage response = await client.GetAsync(url); - if (content.Length > 0) + if (response.IsSuccessStatusCode) { - File.WriteAllBytes(path, content); - return File.Exists(path); + string path = (folder / fileName).GetPath(); + byte[] content = await response.Content.ReadAsByteArrayAsync(); + + if (content.Length > 0) + { + File.WriteAllBytes(path, content); + return File.Exists(path); + } } } } @@ -207,8 +210,8 @@ public static async Task CheckInitialized() { if (await DownloadRemote() == false) { - Logger.Write("Failed to do download remote information, cannot check for updates or verify installed version!", LogLevel.LEVEL_WARN); - MessageBox.Show("Warning: Failed to do download remote information, cannot check for updates or verify installed version!", Assembly.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning); + Logger.Write("Failed to download remote information, cannot check for updates or verify installed version!", LogLevel.LEVEL_WARN); + MessageBox.Show("Warning: Failed to download remote information, cannot check for updates or verify installed version!", Assembly.GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } diff --git a/Framework/Updator.cs b/Framework/Updator.cs index b94c7d6..51480d1 100644 --- a/Framework/Updator.cs +++ b/Framework/Updator.cs @@ -166,13 +166,11 @@ private static async Task InstallModule(bool bForceInstall) else { report.FailReason = "Failed to download module archive."; - return report; } } else { report.FailReason = "Failed to retrieve download link."; - return report; } Directory.Delete(tempFolder.GetPath(), true); diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user index 0b25692..c587c47 100644 --- a/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2022-12-24T23:45:18.2492814Z;True|2022-12-24T17:58:05.8108440-05:00;True|2022-12-23T00:36:55.2356565-05:00;True|2022-12-22T20:46:31.3667454-05:00;True|2022-12-22T20:36:59.8978942-05:00;True|2022-12-22T20:32:40.9627042-05:00;True|2022-12-22T20:27:45.7845417-05:00;True|2022-12-22T20:08:26.4442830-05:00;True|2022-12-22T20:07:06.2254198-05:00;True|2022-12-22T20:01:04.3986967-05:00;True|2022-12-22T19:57:34.6741553-05:00;True|2022-12-22T19:46:09.3566048-05:00;True|2022-12-22T19:45:03.2884935-05:00;True|2022-12-22T19:36:42.2434776-05:00;True|2022-12-22T19:31:21.4738973-05:00;True|2022-12-22T19:27:34.9406205-05:00;False|2022-12-22T19:27:27.7152676-05:00;True|2022-12-22T19:14:05.9421852-05:00;True|2022-12-22T18:02:42.2130135-05:00; + True|2022-12-26T01:55:07.0626032Z;True|2022-12-24T18:45:18.2492814-05:00;True|2022-12-24T17:58:05.8108440-05:00;True|2022-12-23T00:36:55.2356565-05:00;True|2022-12-22T20:46:31.3667454-05:00;True|2022-12-22T20:36:59.8978942-05:00;True|2022-12-22T20:32:40.9627042-05:00;True|2022-12-22T20:27:45.7845417-05:00;True|2022-12-22T20:08:26.4442830-05:00;True|2022-12-22T20:07:06.2254198-05:00;True|2022-12-22T20:01:04.3986967-05:00;True|2022-12-22T19:57:34.6741553-05:00;True|2022-12-22T19:46:09.3566048-05:00;True|2022-12-22T19:45:03.2884935-05:00;True|2022-12-22T19:36:42.2434776-05:00;True|2022-12-22T19:31:21.4738973-05:00;True|2022-12-22T19:27:34.9406205-05:00;False|2022-12-22T19:27:27.7152676-05:00;True|2022-12-22T19:14:05.9421852-05:00;True|2022-12-22T18:02:42.2130135-05:00; \ No newline at end of file