From 6d5b70ffe3f7618bbc900afe710a017795d2437a Mon Sep 17 00:00:00 2001 From: pointfeev Date: Mon, 14 Feb 2022 13:53:09 -0500 Subject: [PATCH] v2.4.0.0 - Added an "Open AppInfo" button to the right click context menu - Fixed an issue where the string "ERROR! Failed to install app '4' (Invalid platform)" was sometimes somewhere in the middle of AppInfo files, unfortunately meaning I have to bump the minimum appinfo version again - By fixing the above issue, I also fixed certain random DLCs from being excluded --- CreamInstaller/Classes/SteamCMD.cs | 3 ++- CreamInstaller/CreamInstaller.csproj | 2 +- CreamInstaller/Forms/SelectForm.cs | 5 +++++ CreamInstaller/Program.cs | 8 ++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CreamInstaller/Classes/SteamCMD.cs b/CreamInstaller/Classes/SteamCMD.cs index f628619..75376f0 100644 --- a/CreamInstaller/Classes/SteamCMD.cs +++ b/CreamInstaller/Classes/SteamCMD.cs @@ -19,7 +19,7 @@ namespace CreamInstaller.Classes; internal static class SteamCMD { internal static readonly int ProcessLimit = 20; - internal static readonly Version MinimumAppInfoVersion = Version.Parse("2.3.3.0"); + internal static readonly Version MinimumAppInfoVersion = Version.Parse("2.4.0.0"); internal static readonly string DirectoryPathOld = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\CreamInstaller"; internal static readonly string DirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\CreamInstaller"; @@ -188,6 +188,7 @@ internal static class SteamCMD if (openBracket != -1 && closeBracket != -1) { output = $"\"{appId}\"\n" + output[openBracket..(1 + closeBracket)]; + output = output.Replace("ERROR! Failed to install app '4' (Invalid platform)", ""); File.WriteAllText(appUpdateFile, output, Encoding.UTF8); } } diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj index 72c5282..e5ed0b7 100644 --- a/CreamInstaller/CreamInstaller.csproj +++ b/CreamInstaller/CreamInstaller.csproj @@ -5,7 +5,7 @@ True Resources\ini.ico true - 2.3.3.1 + 2.4.0.0 Resources\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/SelectForm.cs b/CreamInstaller/Forms/SelectForm.cs index f19e570..dfd9702 100644 --- a/CreamInstaller/Forms/SelectForm.cs +++ b/CreamInstaller/Forms/SelectForm.cs @@ -485,6 +485,7 @@ internal partial class SelectForm : CustomForm Dictionary images = new(); Task.Run(async () => { + images["Notepad"] = Program.GetNotepadImage(); images["File Explorer"] = Program.GetFileExplorerImage(); images["SteamDB"] = await Program.GetImageFromUrl("https://steamdb.info/favicon.ico"); images["Steam Store"] = await Program.GetImageFromUrl("https://store.steampowered.com/favicon.ico"); @@ -505,6 +506,10 @@ internal partial class SelectForm : CustomForm { nodeContextMenu.Items.Add(new ToolStripMenuItem(selection.Name, selection.Icon)); nodeContextMenu.Items.Add(new ToolStripSeparator()); + string appInfo = $@"{SteamCMD.AppInfoPath}\{appId}.vdf"; + if (Directory.Exists(Directory.GetDirectoryRoot(appInfo)) && File.Exists(appInfo)) + nodeContextMenu.Items.Add(new ToolStripMenuItem("Open AppInfo", Image("Notepad"), + new EventHandler((sender, e) => Program.OpenFileInNotepad(appInfo)))); nodeContextMenu.Items.Add(new ToolStripMenuItem("Open Root Directory", Image("File Explorer"), new EventHandler((sender, e) => Program.OpenDirectoryInFileExplorer(selection.RootDirectory)))); for (int i = 0; i < selection.SteamApiDllDirectories.Count; i++) diff --git a/CreamInstaller/Program.cs b/CreamInstaller/Program.cs index 2b10d58..a437066 100644 --- a/CreamInstaller/Program.cs +++ b/CreamInstaller/Program.cs @@ -75,6 +75,12 @@ internal static class Program return null; } + internal static void OpenFileInNotepad(string path) => Process.Start(new ProcessStartInfo + { + FileName = "notepad.exe", + Arguments = path + }); + internal static void OpenDirectoryInFileExplorer(string path) => Process.Start(new ProcessStartInfo { FileName = "explorer.exe", @@ -89,6 +95,8 @@ internal static class Program internal static Image GetFileIconImage(string path) => File.Exists(path) ? Icon.ExtractAssociatedIcon(path).ToBitmap() : null; + internal static Image GetNotepadImage() => GetFileIconImage(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\notepad.exe"); + internal static Image GetFileExplorerImage() => GetFileIconImage(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\explorer.exe"); internal static bool IsProgramRunningDialog(Form form, ProgramSelection selection)