From dfe52c1fa5695938d286b1ffad087fd83cc9813f Mon Sep 17 00:00:00 2001 From: Sefinek Actions Date: Tue, 12 Mar 2024 05:01:23 +0100 Subject: [PATCH] 8.0.0.1 --- Stella.Launcher/1. Stella Mod Launcher.csproj | 6 ++-- Stella.Launcher/Forms/Default.cs | 7 ++-- .../Scripts/Forms/MainForm/Labels.cs | 6 ++++ Stella.Launcher/Scripts/Helpers/Buffer.cs | 2 +- .../Scripts/Remote/CheckForUpdates.cs | 32 ++++++++++++------- .../Scripts/Remote/NormalRelease.cs | 5 +-- 6 files changed, 38 insertions(+), 20 deletions(-) diff --git a/Stella.Launcher/1. Stella Mod Launcher.csproj b/Stella.Launcher/1. Stella Mod Launcher.csproj index 494f520d..b461e515 100644 --- a/Stella.Launcher/1. Stella Mod Launcher.csproj +++ b/Stella.Launcher/1. Stella Mod Launcher.csproj @@ -8,9 +8,9 @@ true enable Properties\app.manifest - 7.9.7.0 - 7.9.7.0 - 7.9.7.0 + 8.0.0.1 + 8.0.0.1 + 8.0.0.1 StellaModLauncher.Program data\images\icons\nahida.ico ..\Build\ diff --git a/Stella.Launcher/Forms/Default.cs b/Stella.Launcher/Forms/Default.cs index d5ef81b6..6db93cef 100644 --- a/Stella.Launcher/Forms/Default.cs +++ b/Stella.Launcher/Forms/Default.cs @@ -339,14 +339,15 @@ private async void Main_Shown(object sender, EventArgs e) int found = await CheckForUpdates.Analyze().ConfigureAwait(true); switch (found) { - case 2: - return; case 666: WindowState = FormWindowState.Minimized; return; } - MessageBox.Show($@"OK: {found}"); + await Task.Run(() => + { + while (UpdateIsAvailable) Task.Delay(1000).Wait(); + }).ConfigureAwait(true); // Updated? diff --git a/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs b/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs index 9ef2195c..b2df3459 100644 --- a/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs +++ b/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs @@ -29,6 +29,8 @@ public static void ShowStartGameBtns() public static void ShowProgressbar() { + // Default._webView21!.Visible = false; + Default._progressBar1!.Show(); Default._preparingPleaseWait!.Show(); @@ -45,6 +47,8 @@ public static void ShowProgressbar() public static void HideProgressbar(string? successText, bool error) { + // Default._webView21!.Visible = true; + Default._progressBar1!.Hide(); Default._progressBar1.Value = 0; Default._preparingPleaseWait!.Hide(); @@ -72,6 +76,8 @@ public static void HideProgressbar(string? successText, bool error) public static void FailedToLoad() { + // Default._webView21!.Visible = false; + Default._version_LinkLabel!.Text = @"v-.-.-.-"; Default._checkForUpdates_LinkLabel!.Text = @"---"; Default._progressBar1!.Value = 100; diff --git a/Stella.Launcher/Scripts/Helpers/Buffer.cs b/Stella.Launcher/Scripts/Helpers/Buffer.cs index d484c89e..eab7728c 100644 --- a/Stella.Launcher/Scripts/Helpers/Buffer.cs +++ b/Stella.Launcher/Scripts/Helpers/Buffer.cs @@ -9,7 +9,7 @@ internal static class BufferHelper */ public static byte[] Get() { - int bufferCfg = Program.Settings.ReadInt("Launcher", "BufferValue", 65536); + int bufferCfg = Program.Settings.ReadInt("Launcher", "BufferValue", 1048576); return new byte[bufferCfg]; } } diff --git a/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs b/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs index 7e6a32da..1a46be56 100644 --- a/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs +++ b/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs @@ -13,8 +13,6 @@ namespace StellaModLauncher.Scripts.Remote; internal static class CheckForUpdates { - public static int FoundUpdates = 0; - public static async Task Analyze() { Default._checkForUpdates_LinkLabel!.LinkColor = Color.White; @@ -81,6 +79,8 @@ public static async Task Analyze() await DownloadResources.Run(data?.Version!, remoteDbResourcesVersion, remoteResourcesDate).ConfigureAwait(true); return 1; } + + Default.UpdateIsAvailable = false; } @@ -119,10 +119,14 @@ public static async Task Analyze() if (Secret.IsStellaPlusSubscriber) { int found = await CheckForUpdatesOfBenefits.Analyze().ConfigureAwait(true); - MessageBox.Show($@"CheckForUpdatesOfBenefits: {found}"); switch (found) { + case 0: + Default.UpdateIsAvailable = false; + break; case 1: + Default.UpdateIsAvailable = true; + Default._checkForUpdates_LinkLabel.LinkColor = Color.Cyan; Default._checkForUpdates_LinkLabel.Text = Resources.Default_UpdatingBenefits; Default._updateIco_PictureBox!.Image = Resources.icons8_download_from_the_cloud; @@ -150,7 +154,7 @@ public static async Task Analyze() Default._updateIco_PictureBox!.Image = Resources.icons8_available_updates; Default._version_LinkLabel!.Text = $@"v{(Program.AppVersion == Program.AppFileVersion ? Program.AppVersion : $"{Program.AppFileVersion}-alpha")}"; - + // if (actionOnClick) Default._webView21!.Visible = true; Default.UpdateIsAvailable = false; Program.Logger.Info($"Not found any new updates. AppVersion v{Program.AppVersion}; ProductVersion v{Program.AppFileVersion};"); @@ -159,15 +163,15 @@ public static async Task Analyze() Labels.ShowStartGameBtns(); return 0; } - catch (Exception e) + catch (Exception ex) { Default.UpdateIsAvailable = false; Default._checkForUpdates_LinkLabel.LinkColor = Color.Red; Default._checkForUpdates_LinkLabel.Text = Resources.Default_OhhSomethingWentWrong; - Utils.UpdateStatusLabel(e.Message, Utils.StatusType.Error); + Utils.UpdateStatusLabel(ex.Message, Utils.StatusType.Error); - Program.Logger.Error(string.Format(Resources.Default_SomethingWentWrongWhileCheckingForNewUpdates, e)); + Program.Logger.Error(string.Format(Resources.Default_SomethingWentWrongWhileCheckingForNewUpdates, ex)); Labels.HideProgressbar(null, true); return -1; } @@ -176,16 +180,22 @@ public static async Task Analyze() public static async void CheckUpdates_Click(object? sender, LinkLabelLinkClickedEventArgs e) { if (Secret.IsStellaPlusSubscriber) Music.PlaySound("winxp", "hardware_insert"); + Default._webView21!.Visible = false; + int update = await Analyze().ConfigureAwait(true); - if (update == -1) + switch (update) { - Music.PlaySound("winxp", "hardware_fail"); - return; + case -1: + Default._webView21!.Visible = false; + Music.PlaySound("winxp", "hardware_fail"); + return; + case 0: + Default._webView21!.Visible = true; + break; } if (update != 0) return; - if (Secret.IsStellaPlusSubscriber) Music.PlaySound("winxp", "hardware_remove"); Default._checkForUpdates_LinkLabel!.LinkColor = Color.LawnGreen; diff --git a/Stella.Launcher/Scripts/Remote/NormalRelease.cs b/Stella.Launcher/Scripts/Remote/NormalRelease.cs index a39f3627..c2f78d2b 100644 --- a/Stella.Launcher/Scripts/Remote/NormalRelease.cs +++ b/Stella.Launcher/Scripts/Remote/NormalRelease.cs @@ -1,4 +1,3 @@ -using System.Diagnostics; using ByteSizeLib; using CliWrap.Builders; using StellaModLauncher.Forms; @@ -12,7 +11,9 @@ namespace StellaModLauncher.Scripts.Remote; internal static class NormalRelease { public static readonly string SetupPathExe = Path.Combine(Path.GetTempPath(), "Stella-Mod-Update.exe"); - private static readonly string DownloadUrl = Debugger.IsAttached ? "http://127.0.0.1:5180/Stella-Mod-Setup.exe" : "https://github.com/sefinek24/Genshin-Impact-ReShade/releases/latest/download/Stella-Mod-Setup.exe"; + + // private static readonly string DownloadUrl = Debugger.IsAttached ? "http://127.0.0.1:5180/Stella-Mod-Setup.exe" : "https://github.com/sefinek24/Genshin-Impact-ReShade/releases/latest/download/Stella-Mod-Setup.exe"; + private static readonly string DownloadUrl = "https://github.com/sefinek24/Genshin-Impact-ReShade/releases/latest/download/Stella-Mod-Setup.exe"; public static async Task Run(string? remoteVersion, DateTime remoteVerDate, bool beta) {