Add support for the steamcmd.net query to the right-click menu Open and Refresh Query functionalities

This commit is contained in:
pointfeev 2024-08-19 23:51:54 -04:00
parent 5e161e9e62
commit 4d066b703e
2 changed files with 10 additions and 3 deletions

View file

@ -4,7 +4,7 @@
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework> <TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>True</UseWindowsForms> <UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\program.ico</ApplicationIcon> <ApplicationIcon>Resources\program.ico</ApplicationIcon>
<Version>5.0.0.0</Version> <Version>5.0.1.0</Version>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright> <Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
<Company>CreamInstaller</Company> <Company>CreamInstaller</Company>
<Product>Automatic DLC Unlocker Installer &amp; Configuration Generator</Product> <Product>Automatic DLC Unlocker Installer &amp; Configuration Generator</Product>

View file

@ -801,11 +801,12 @@ internal sealed partial class SelectForm : CustomForm
: new(node.Text, (id, dlc.Icon), (id, dlcParentSelection.Icon)); : new(node.Text, (id, dlc.Icon), (id, dlcParentSelection.Icon));
_ = items.Add(header); _ = items.Add(header);
string appInfoVDF = $@"{SteamCMD.AppInfoPath}\{id}.vdf"; string appInfoVDF = $@"{SteamCMD.AppInfoPath}\{id}.vdf";
string appInfoCmdJSON = $@"{SteamCMD.AppInfoPath}\{id}.cmd.json";
string appInfoJSON = $@"{SteamCMD.AppInfoPath}\{id}.json"; string appInfoJSON = $@"{SteamCMD.AppInfoPath}\{id}.json";
string cooldown = $@"{ProgramData.CooldownPath}\{id}.txt"; string cooldown = $@"{ProgramData.CooldownPath}\{id}.txt";
if (appInfoVDF.FileExists() || appInfoJSON.FileExists()) if (appInfoVDF.FileExists() || appInfoCmdJSON.FileExists() || appInfoJSON.FileExists())
{ {
List<ContextMenuItem> queries = new(); List<ContextMenuItem> queries = [];
if (appInfoJSON.FileExists()) if (appInfoJSON.FileExists())
{ {
string platformString = selection is null || selection.Platform is Platform.Steam string platformString = selection is null || selection.Platform is Platform.Steam
@ -817,9 +818,14 @@ internal sealed partial class SelectForm : CustomForm
(_, _) => Diagnostics.OpenFileInNotepad(appInfoJSON))); (_, _) => Diagnostics.OpenFileInNotepad(appInfoJSON)));
} }
if (appInfoCmdJSON.FileExists())
queries.Add(new("Open SteamCMD.net Query", "Notepad",
(_, _) => Diagnostics.OpenFileInNotepad(appInfoCmdJSON)));
if (appInfoVDF.FileExists()) if (appInfoVDF.FileExists())
queries.Add(new("Open SteamCMD Query", "Notepad", queries.Add(new("Open SteamCMD Query", "Notepad",
(_, _) => Diagnostics.OpenFileInNotepad(appInfoVDF))); (_, _) => Diagnostics.OpenFileInNotepad(appInfoVDF)));
if (queries.Count > 0) if (queries.Count > 0)
{ {
_ = items.Add(new ToolStripSeparator()); _ = items.Add(new ToolStripSeparator());
@ -828,6 +834,7 @@ internal sealed partial class SelectForm : CustomForm
_ = items.Add(new ContextMenuItem("Refresh Queries", "Command Prompt", (_, _) => _ = items.Add(new ContextMenuItem("Refresh Queries", "Command Prompt", (_, _) =>
{ {
appInfoVDF.DeleteFile(); appInfoVDF.DeleteFile();
appInfoCmdJSON.DeleteFile();
appInfoJSON.DeleteFile(); appInfoJSON.DeleteFile();
cooldown.DeleteFile(); cooldown.DeleteFile();
selection?.Remove(); selection?.Remove();