- Fixed steam store query caching
- Improved the context menu display for app infos
- Fixed selection form exception handling
This commit is contained in:
pointfeev 2022-03-08 22:41:41 -05:00
parent 509033c8c9
commit 47c99e5e89
4 changed files with 253 additions and 233 deletions

View file

@ -5,7 +5,7 @@
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>3.2.2.2</Version>
<Version>3.2.2.3</Version>
<PackageIcon>Resources\ini.ico</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>

View file

@ -32,13 +32,20 @@ internal static class EpicStore
{
response = JsonConvert.DeserializeObject<Response>(File.ReadAllText(cacheFile));
}
catch { }
catch
{
File.Delete(cacheFile);
}
if (response is null) return dlcIds;
try
{
File.WriteAllText(cacheFile, JsonConvert.SerializeObject(response, Formatting.Indented));
}
catch { }
catch //(Exception e)
{
//using DialogForm dialogForm = new(null);
//dialogForm.Show(SystemIcons.Error, "Unsuccessful serialization of query for category namespace " + categoryNamespace + ":\n\n" + e.ToString(), "FUCK");
}
List<Element> searchStore = new(response.Data.Catalog.SearchStore.Elements);
foreach (Element element in searchStore)
{

View file

@ -386,9 +386,6 @@ internal partial class SelectForm : CustomForm
}
private async void OnLoad()
{
retry:
try
{
Program.Canceled = false;
blockedGamesCheckBox.Enabled = false;
@ -442,12 +439,6 @@ internal partial class SelectForm : CustomForm
blockedGamesCheckBox.Enabled = true;
blockProtectedHelpButton.Enabled = true;
}
catch (Exception e)
{
if (ExceptionHandler.OutputException(e)) goto retry;
Close();
}
}
private void OnTreeViewNodeCheckedChanged(object sender, TreeViewEventArgs e)
{
@ -548,6 +539,9 @@ internal partial class SelectForm : CustomForm
}
private void OnLoad(object sender, EventArgs _)
{
retry:
try
{
HideProgressBar();
selectionTreeView.TreeViewNodeSorter = new TreeNodeSorter();
@ -579,16 +573,19 @@ internal partial class SelectForm : CustomForm
string appInfoJSON = $@"{SteamCMD.AppInfoPath}\{id}.json";
if (Directory.Exists(Directory.GetDirectoryRoot(appInfoVDF)) && (File.Exists(appInfoVDF) || File.Exists(appInfoJSON)))
{
contextMenuStrip.Items.Add(new ToolStripSeparator());
contextMenuStrip.Items.Add(new ContextMenuItem("Open AppInfo", "Notepad",
new EventHandler((sender, e) =>
{
List<ContextMenuItem> queries = new();
if (File.Exists(appInfoJSON))
Diagnostics.OpenFileInNotepad(appInfoJSON);
else if (File.Exists(appInfoVDF))
Diagnostics.OpenFileInNotepad(appInfoVDF);
})));
contextMenuStrip.Items.Add(new ContextMenuItem("Refresh AppInfo", "Command Prompt",
queries.Add(new ContextMenuItem((selection is null || selection.IsSteam) ? "Open Steam Store Query" : "Open Epic GraphQL Query", "Notepad",
new EventHandler((sender, e) => Diagnostics.OpenFileInNotepad(appInfoJSON))));
if (File.Exists(appInfoVDF))
queries.Add(new ContextMenuItem("Open SteamCMD Query", "Notepad",
new EventHandler((sender, e) => Diagnostics.OpenFileInNotepad(appInfoVDF))));
if (queries.Any())
{
contextMenuStrip.Items.Add(new ToolStripSeparator());
foreach (ContextMenuItem query in queries)
contextMenuStrip.Items.Add(query);
contextMenuStrip.Items.Add(new ContextMenuItem("Refresh Queries", "Command Prompt",
new EventHandler((sender, e) =>
{
try
@ -604,6 +601,7 @@ internal partial class SelectForm : CustomForm
OnLoad();
})));
}
}
if (selection is not null)
{
if (id == "ParadoxLauncher")
@ -729,6 +727,12 @@ internal partial class SelectForm : CustomForm
};
OnLoad();
}
catch (Exception e)
{
if (ExceptionHandler.OutputException(e)) goto retry;
Close();
}
}
private void OnAccept(bool uninstall = false)
{

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@ -44,17 +43,24 @@ internal static class SteamStore
try
{
AppData data = JsonConvert.DeserializeObject<AppDetails>(app.Value.ToString()).data;
if (data is not null)
{
try
{
File.WriteAllText(cacheFile, JsonConvert.SerializeObject(data, Formatting.Indented));
}
catch { }
catch //(Exception e)
{
//using DialogForm dialogForm = new(null);
//dialogForm.Show(SystemIcons.Error, "Unsuccessful serialization of query for appid " + appId + ":\n\n" + e.ToString(), "FUCK");
}
return data;
}
catch (Exception e)
}
catch //(Exception e)
{
using DialogForm dialogForm = new(null);
dialogForm.Show(SystemIcons.Error, "Unsuccessful deserialization of query for appid " + appId + ":\n\n" + e.ToString(), "FUCK");
//using DialogForm dialogForm = new(null);
//dialogForm.Show(SystemIcons.Error, "Unsuccessful deserialization of query for appid " + appId + ":\n\n" + e.ToString(), "FUCK");
}
}
}
@ -65,7 +71,10 @@ internal static class SteamStore
{
return JsonConvert.DeserializeObject<AppData>(File.ReadAllText(cacheFile));
}
catch { }
catch
{
File.Delete(cacheFile);
}
}
return null;
}