diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj
index 27fe89d..01cde39 100644
--- a/CreamInstaller/CreamInstaller.csproj
+++ b/CreamInstaller/CreamInstaller.csproj
@@ -6,7 +6,7 @@
true
ini.ico
true
- 2.0.2.2
+ 2.0.2.3
ini.ico
Automatically generates and installs CreamAPI files for Steam games on the user's computer. It can also generate and install CreamAPI for the Paradox Launcher should the user select a Paradox Interactive game.
diff --git a/CreamInstaller/Forms/InstallForm.cs b/CreamInstaller/Forms/InstallForm.cs
index 0238f46..8590c47 100644
--- a/CreamInstaller/Forms/InstallForm.cs
+++ b/CreamInstaller/Forms/InstallForm.cs
@@ -180,11 +180,20 @@ namespace CreamInstaller
reselectButton.Enabled = true;
}
- private void OnLoad(object sender, EventArgs e)
+ private void OnLoad(object sender, EventArgs _)
{
- userInfoLabel.Text = "Loading . . . ";
- logTextBox.Text = string.Empty;
- Start();
+ retry:
+ try
+ {
+ userInfoLabel.Text = "Loading . . . ";
+ logTextBox.Text = string.Empty;
+ Start();
+ }
+ catch (Exception e)
+ {
+ if (ExceptionHandler.OutputException(e)) goto retry;
+ Close();
+ }
}
private void OnAccept(object sender, EventArgs e)
diff --git a/CreamInstaller/Forms/MainForm.cs b/CreamInstaller/Forms/MainForm.cs
index 6d6f53e..3968dff 100644
--- a/CreamInstaller/Forms/MainForm.cs
+++ b/CreamInstaller/Forms/MainForm.cs
@@ -130,20 +130,29 @@ namespace CreamInstaller
}
}
- private void OnLoad(object sender, EventArgs e)
+ private void OnLoad(object sender, EventArgs _)
{
- string FileName = Path.GetFileName(Program.CurrentProcessFilePath);
- if (FileName != "CreamInstaller.exe")
+ retry:
+ try
{
- if (new DialogForm(this).Show(Program.ApplicationName, SystemIcons.Warning,
- "WARNING: CreamInstaller.exe was renamed!" +
- "\n\nThis will cause unwanted behavior when updating the program!",
- "Ignore", "Abort") == DialogResult.Cancel)
+ string FileName = Path.GetFileName(Program.CurrentProcessFilePath);
+ if (FileName != "CreamInstaller.exe")
{
- Environment.Exit(0);
+ if (new DialogForm(this).Show(Program.ApplicationName, SystemIcons.Warning,
+ "WARNING: CreamInstaller.exe was renamed!" +
+ "\n\nThis will cause unwanted behavior when updating the program!",
+ "Ignore", "Abort") == DialogResult.Cancel)
+ {
+ Environment.Exit(0);
+ }
}
+ OnLoad();
+ }
+ catch (Exception e)
+ {
+ if (ExceptionHandler.OutputException(e)) goto retry;
+ Close();
}
- OnLoad();
}
private void OnIgnore(object sender, EventArgs e)
diff --git a/CreamInstaller/Forms/SelectForm.cs b/CreamInstaller/Forms/SelectForm.cs
index e6e1ba0..24ed769 100644
--- a/CreamInstaller/Forms/SelectForm.cs
+++ b/CreamInstaller/Forms/SelectForm.cs
@@ -31,25 +31,31 @@ namespace CreamInstaller
if (Program.Canceled) return gameDirectories;
string steamInstallPath = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Valve\\Steam", "InstallPath", null) as string;
if (steamInstallPath == null) steamInstallPath = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Valve\\Steam", "InstallPath", null) as string;
- if (steamInstallPath != null)
+ if (steamInstallPath != null && Directory.Exists(steamInstallPath))
{
string libraryFolder = steamInstallPath + @"\steamapps";
- gameDirectories.Add(libraryFolder);
- try
+ if (Directory.Exists(libraryFolder))
{
- string libraryFolders = libraryFolder + @"\libraryfolders.vdf";
- dynamic property = VdfConvert.Deserialize(File.ReadAllText(libraryFolders));
- foreach (dynamic _property in property.Value)
+ gameDirectories.Add(libraryFolder);
+ try
{
- if (int.TryParse(_property.Key, out int _))
+ string libraryFolders = libraryFolder + @"\libraryfolders.vdf";
+ if (File.Exists(libraryFolders))
{
- string path = _property.Value.path.ToString() + @"\steamapps";
- if (string.IsNullOrWhiteSpace(path)) continue;
- if (!gameDirectories.Contains(path)) gameDirectories.Add(path);
+ dynamic property = VdfConvert.Deserialize(File.ReadAllText(libraryFolders));
+ foreach (dynamic _property in property.Value)
+ {
+ if (int.TryParse(_property.Key, out int _))
+ {
+ string path = _property.Value.path.ToString() + @"\steamapps";
+ if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path)) continue;
+ if (!gameDirectories.Contains(path)) gameDirectories.Add(path);
+ }
+ }
}
}
+ catch { }
}
- catch { }
}
return gameDirectories;
}
@@ -58,7 +64,7 @@ namespace CreamInstaller
private static bool GetDllDirectoriesFromGameDirectory(string gameDirectory, out List dllDirectories)
{
dllDirectories = new();
- if (Program.Canceled) return false;
+ if (Program.Canceled || !Directory.Exists(gameDirectory)) return false;
string api = gameDirectory + @"\steam_api.dll";
string api64 = gameDirectory + @"\steam_api64.dll";
if (File.Exists(api) || File.Exists(api64)) dllDirectories.Add(gameDirectory);
@@ -79,7 +85,7 @@ namespace CreamInstaller
private static bool GetGamesFromLibraryDirectory(string libraryDirectory, out List> games)
{
games = new();
- if (Program.Canceled) return false;
+ if (Program.Canceled || !Directory.Exists(libraryDirectory)) return false;
foreach (string directory in Directory.GetFiles(libraryDirectory))
{
if (Program.Canceled) return false;
@@ -335,7 +341,7 @@ namespace CreamInstaller
}
}
- private void OnLoad(object sender, EventArgs e)
+ private void OnLoad(object sender, EventArgs _)
{
treeView1.AfterCheck += OnTreeViewNodeCheckedChanged;
treeView1.NodeMouseClick += (sender, e) =>
@@ -352,7 +358,16 @@ namespace CreamInstaller
});
}
};
- OnLoad();
+ retry:
+ try
+ {
+ OnLoad();
+ }
+ catch (Exception e)
+ {
+ if (ExceptionHandler.OutputException(e)) goto retry;
+ Close();
+ }
}
private static bool ParadoxLauncherDlcDialog(Form form)
diff --git a/CreamInstaller/Program.cs b/CreamInstaller/Program.cs
index 646d754..c89c92c 100644
--- a/CreamInstaller/Program.cs
+++ b/CreamInstaller/Program.cs
@@ -28,15 +28,7 @@ namespace CreamInstaller
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ApplicationExit += new(OnApplicationExit);
- retry:
- try
- {
- Application.Run(new MainForm());
- }
- catch (Exception e)
- {
- if (ExceptionHandler.OutputException(e)) goto retry;
- }
+ Application.Run(new MainForm());
}
mutex.Close();
}