diff --git a/Stella.Launcher/1. Stella Mod Launcher.csproj b/Stella.Launcher/1. Stella Mod Launcher.csproj
index 9bb6f218..494f520d 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
- 8.0.0.0
- 8.0.0.0
- 8.0.0.0
+ 7.9.7.0
+ 7.9.7.0
+ 7.9.7.0
StellaModLauncher.Program
data\images\icons\nahida.ico
..\Build\
diff --git a/Stella.Launcher/Forms/Default.cs b/Stella.Launcher/Forms/Default.cs
index 70b15d09..d5ef81b6 100644
--- a/Stella.Launcher/Forms/Default.cs
+++ b/Stella.Launcher/Forms/Default.cs
@@ -307,6 +307,35 @@ private async void Main_Shown(object sender, EventArgs e)
// Check for updates
Stages.UpdateStage(7, "Checking for updates...");
+
+ // Detect resource path
+ string? resourcesPath = null;
+ using (RegistryKey? key = Registry.CurrentUser.OpenSubKey(Program.RegistryPath))
+ {
+ if (key != null) resourcesPath = key.GetValue("ResourcesPath") as string;
+ }
+
+ if (string.IsNullOrEmpty(resourcesPath))
+ {
+ Program.Logger.Error("Path of the resources was not found. Is null or empty");
+ MessageBox.Show(Resources.Default_ResourceDirNotFound, Program.AppNameVer, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+
+ if (!Directory.Exists(resourcesPath))
+ {
+ Program.Logger.Error($"Directory with the resources '{resourcesPath}' was not found");
+ MessageBox.Show(string.Format(Resources.Default_Directory_WasNotFound, resourcesPath), Program.AppNameVer, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ if (string.IsNullOrEmpty(resourcesPath) || !Directory.Exists(resourcesPath))
+ {
+ _ = Cmd.Execute(new Cmd.CliWrap { App = Program.ConfigurationWindow });
+ Application.Exit();
+ }
+
+ ResourcesPath = resourcesPath;
+
+ // Updates
int found = await CheckForUpdates.Analyze().ConfigureAwait(true);
switch (found)
{
@@ -317,6 +346,9 @@ private async void Main_Shown(object sender, EventArgs e)
return;
}
+ MessageBox.Show($@"OK: {found}");
+
+
// Updated?
int updatedLauncher = Program.Settings.ReadInt("Updates", "UpdateAvailable", 0);
string oldVersion = Program.Settings.ReadString("Updates", "OldVersion");
@@ -334,31 +366,6 @@ private async void Main_Shown(object sender, EventArgs e)
Stages.UpdateStage(8, "Checking required data...");
- string? resourcesPath = null;
- using (RegistryKey? key = Registry.CurrentUser.OpenSubKey(Program.RegistryPath))
- {
- if (key != null) resourcesPath = key.GetValue("ResourcesPath") as string;
- }
-
- if (string.IsNullOrEmpty(resourcesPath))
- {
- Program.Logger.Error("Path of the resources was not found. Is null or empty");
- MessageBox.Show(Resources.Default_ResourceDirNotFound, Program.AppNameVer, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
-
- if (!Directory.Exists(resourcesPath))
- {
- Program.Logger.Error($"Directory with the resources '{resourcesPath}' was not found");
- MessageBox.Show(string.Format(Resources.Default_Directory_WasNotFound, resourcesPath), Program.AppNameVer, MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
-
- if (string.IsNullOrEmpty(resourcesPath) || !Directory.Exists(resourcesPath))
- {
- _ = Cmd.Execute(new Cmd.CliWrap { App = Program.ConfigurationWindow });
- Application.Exit();
- }
-
- ResourcesPath = resourcesPath;
// Check Genshin Stella Mod.exe
if (!File.Exists(Run.GsmPath) && !Debugger.IsAttached)
diff --git a/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs b/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs
index 5c0d8d3c..9ef2195c 100644
--- a/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs
+++ b/Stella.Launcher/Scripts/Forms/MainForm/Labels.cs
@@ -69,4 +69,15 @@ public static void HideProgressbar(string? successText, bool error)
TaskbarProgress.SetProgressValue(100);
TaskbarProgress.SetProgressState(TaskbarProgress.Flags.Error);
}
+
+ public static void FailedToLoad()
+ {
+ Default._version_LinkLabel!.Text = @"v-.-.-.-";
+ Default._checkForUpdates_LinkLabel!.Text = @"---";
+ Default._progressBar1!.Value = 100;
+ Default._preparingPleaseWait!.Text = @"Canceled.";
+
+ TaskbarProgress.SetProgressState(TaskbarProgress.Flags.Paused);
+ TaskbarProgress.SetProgressValue(100);
+ }
}
diff --git a/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs b/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs
index 7752cc2c..7e6a32da 100644
--- a/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs
+++ b/Stella.Launcher/Scripts/Remote/CheckForUpdates.cs
@@ -13,6 +13,8 @@ namespace StellaModLauncher.Scripts.Remote;
internal static class CheckForUpdates
{
+ public static int FoundUpdates = 0;
+
public static async Task Analyze()
{
Default._checkForUpdates_LinkLabel!.LinkColor = Color.White;
@@ -47,7 +49,7 @@ public static async Task Analyze()
{
Default.UpdateIsAvailable = true;
- NormalRelease.Run(remoteDbLauncherVersion, remoteLauncherDate, res.Launcher!.Beta);
+ await NormalRelease.Run(remoteDbLauncherVersion, remoteLauncherDate, res.Launcher!.Beta).ConfigureAwait(true);
return 2;
}
@@ -76,7 +78,7 @@ public static async Task Analyze()
Default.UpdateIsAvailable = true;
DateTime remoteResourcesDate = DateTime.Parse(res.Resources.Date!, null, DateTimeStyles.RoundtripKind).ToUniversalTime().ToLocalTime();
- DownloadResources.Run(data?.Version!, remoteDbResourcesVersion, remoteResourcesDate);
+ await DownloadResources.Run(data?.Version!, remoteDbResourcesVersion, remoteResourcesDate).ConfigureAwait(true);
return 1;
}
}
@@ -117,12 +119,17 @@ public static async Task Analyze()
if (Secret.IsStellaPlusSubscriber)
{
int found = await CheckForUpdatesOfBenefits.Analyze().ConfigureAwait(true);
- if (found == 1)
+ MessageBox.Show($@"CheckForUpdatesOfBenefits: {found}");
+ switch (found)
{
- Default._checkForUpdates_LinkLabel.LinkColor = Color.Cyan;
- Default._checkForUpdates_LinkLabel.Text = Resources.Default_UpdatingBenefits;
- Default._updateIco_PictureBox!.Image = Resources.icons8_download_from_the_cloud;
- return found;
+ case 1:
+ Default._checkForUpdates_LinkLabel.LinkColor = Color.Cyan;
+ Default._checkForUpdates_LinkLabel.Text = Resources.Default_UpdatingBenefits;
+ Default._updateIco_PictureBox!.Image = Resources.icons8_download_from_the_cloud;
+ return found;
+ case 666:
+ Labels.FailedToLoad();
+ return 666;
}
}
@@ -130,13 +137,7 @@ public static async Task Analyze()
// == Banned? ==
if (res!.IsBanned)
{
- Default._version_LinkLabel!.Text = @"v-.-.-.-";
- Default._checkForUpdates_LinkLabel!.Text = @"---";
- Default._progressBar1!.Value = 100;
- Default._preparingPleaseWait!.Text = @"Canceled.";
-
- TaskbarProgress.SetProgressState(TaskbarProgress.Flags.Paused);
- TaskbarProgress.SetProgressValue(100);
+ Labels.FailedToLoad();
new Banned().Show();
diff --git a/Stella.Launcher/Scripts/Remote/NormalRelease.cs b/Stella.Launcher/Scripts/Remote/NormalRelease.cs
index f1007cdc..a39f3627 100644
--- a/Stella.Launcher/Scripts/Remote/NormalRelease.cs
+++ b/Stella.Launcher/Scripts/Remote/NormalRelease.cs
@@ -14,7 +14,7 @@ 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";
- public static async void Run(string? remoteVersion, DateTime remoteVerDate, bool beta)
+ public static async Task Run(string? remoteVersion, DateTime remoteVerDate, bool beta)
{
// 1
Default._version_LinkLabel!.Text = $@"v{Program.AppFileVersion} → v{remoteVersion}";
diff --git a/Stella.Launcher/Scripts/Remote/StellaResources.cs b/Stella.Launcher/Scripts/Remote/StellaResources.cs
index 227db4e7..877e1c80 100644
--- a/Stella.Launcher/Scripts/Remote/StellaResources.cs
+++ b/Stella.Launcher/Scripts/Remote/StellaResources.cs
@@ -12,7 +12,7 @@ internal static class DownloadResources
private const string DownloadUrl = "https://github.com/sefinek24/Genshin-Stella-Resources/releases/latest/download/resources.zip";
private static string? _stellaResZip;
- public static async void Run(string? localResVersion, string? remoteResVersion, DateTime remoteResDate)
+ public static async Task Run(string? localResVersion, string? remoteResVersion, DateTime remoteResDate)
{
// 1
Default._version_LinkLabel!.Text = $@"v{localResVersion} → v{remoteResVersion}";
diff --git a/Stella.Launcher/Scripts/StellaPlus/CheckForUpdatesOfBenefits.cs b/Stella.Launcher/Scripts/StellaPlus/CheckForUpdatesOfBenefits.cs
index 2fce623c..bf1e7534 100644
--- a/Stella.Launcher/Scripts/StellaPlus/CheckForUpdatesOfBenefits.cs
+++ b/Stella.Launcher/Scripts/StellaPlus/CheckForUpdatesOfBenefits.cs
@@ -11,11 +11,20 @@ internal static class CheckForUpdatesOfBenefits
{
public static async Task Analyze()
{
- BenefitVersions? remoteVersions = await GetVersions().ConfigureAwait(true);
+ if (!Directory.Exists(Default.ResourcesPath))
+ {
+ Program.Logger.Error($"Default.ResourcesPath not exists: {Default.ResourcesPath}");
+ MessageBox.Show("The resources folder was not found. It probably does not exist, or the program encountered some issue in locating it.\n\nContact the developer if you need assistance.",
+ Program.AppNameVer, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return 666;
+ }
+
+ BenefitVersions? remoteVersions = await GetVersions().ConfigureAwait(true);
// 3DMigoto
string migotoVerPath = Path.Combine(Default.ResourcesPath!, "3DMigoto", "3dmigoto-version.json");
+ Program.Logger.Info($"Checking: {migotoVerPath}");
if (File.Exists(migotoVerPath))
{
string migotoJson = await File.ReadAllTextAsync(migotoVerPath).ConfigureAwait(true);
@@ -42,6 +51,7 @@ public static async Task Analyze()
// Mods for 3DMigoto
string modsVerPath = Path.Combine(Default.ResourcesPath!, "3DMigoto", "mods-version.json");
+ Program.Logger.Info($"Checking: {modsVerPath}");
if (File.Exists(modsVerPath))
{
string modsJson = await File.ReadAllTextAsync(modsVerPath).ConfigureAwait(true);
@@ -70,6 +80,7 @@ public static async Task Analyze()
// Addons
string addonsVersionPath = Path.Combine(Default.ResourcesPath!, "ReShade", "Addons", "version.json");
+ Program.Logger.Info($"Checking: {addonsVersionPath}");
if (File.Exists(addonsVersionPath))
{
string addonsJson = await File.ReadAllTextAsync(addonsVersionPath).ConfigureAwait(true);
@@ -95,6 +106,7 @@ public static async Task Analyze()
// Presets
string presetsVersionPath = Path.Combine(Default.ResourcesPath!, "ReShade", "Presets", "3. Stella Mod Plus", "version.json");
+ Program.Logger.Info($"Checking: {presetsVersionPath}");
if (File.Exists(presetsVersionPath))
{
string presetsJson = await File.ReadAllTextAsync(presetsVersionPath).ConfigureAwait(true);
@@ -123,6 +135,7 @@ public static async Task Analyze()
// Shaders
string shadersVersionPath = Path.Combine(Default.ResourcesPath!, "ReShade", "Shaders", "version.json");
+ Program.Logger.Info($"Checking: {shadersVersionPath}");
if (File.Exists(shadersVersionPath))
{
string shadersJson = await File.ReadAllTextAsync(shadersVersionPath).ConfigureAwait(true);
@@ -148,6 +161,7 @@ public static async Task Analyze()
// Cmd files
string cmdVersionPath = Path.Combine(Program.AppPath, "data", "cmd", "patrons", "version.json");
+ Program.Logger.Info($"Checking: {cmdVersionPath}");
if (File.Exists(cmdVersionPath))
{
string cmdJson = await File.ReadAllTextAsync(cmdVersionPath).ConfigureAwait(true);