diff --git a/CreamInstaller/Forms/Components/CustomForm.cs b/CreamInstaller/Components/CustomForm.cs
similarity index 94%
rename from CreamInstaller/Forms/Components/CustomForm.cs
rename to CreamInstaller/Components/CustomForm.cs
index fddf86b..273de14 100644
--- a/CreamInstaller/Forms/Components/CustomForm.cs
+++ b/CreamInstaller/Components/CustomForm.cs
@@ -1,6 +1,6 @@
using System.Windows.Forms;
-namespace CreamInstaller.Forms.Components;
+namespace CreamInstaller.Components;
internal class CustomForm : Form
{
diff --git a/CreamInstaller/Forms/Components/CustomTreeView.cs b/CreamInstaller/Components/CustomTreeView.cs
similarity index 97%
rename from CreamInstaller/Forms/Components/CustomTreeView.cs
rename to CreamInstaller/Components/CustomTreeView.cs
index 2b27db4..a9e30e3 100644
--- a/CreamInstaller/Forms/Components/CustomTreeView.cs
+++ b/CreamInstaller/Components/CustomTreeView.cs
@@ -2,7 +2,7 @@
using System.Drawing;
using System.Windows.Forms;
-namespace CreamInstaller.Forms.Components;
+namespace CreamInstaller.Components;
internal class CustomTreeView : TreeView
{
diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj
index 29ce3de..30feef6 100644
--- a/CreamInstaller/CreamInstaller.csproj
+++ b/CreamInstaller/CreamInstaller.csproj
@@ -48,8 +48,8 @@
-
-
+
+
True
True
diff --git a/CreamInstaller/Forms/DialogForm.Designer.cs b/CreamInstaller/DialogForm.Designer.cs
similarity index 100%
rename from CreamInstaller/Forms/DialogForm.Designer.cs
rename to CreamInstaller/DialogForm.Designer.cs
diff --git a/CreamInstaller/Forms/DialogForm.cs b/CreamInstaller/DialogForm.cs
similarity index 96%
rename from CreamInstaller/Forms/DialogForm.cs
rename to CreamInstaller/DialogForm.cs
index 2a23509..ab494ec 100644
--- a/CreamInstaller/Forms/DialogForm.cs
+++ b/CreamInstaller/DialogForm.cs
@@ -2,7 +2,7 @@
using System.Drawing;
using System.Windows.Forms;
-using CreamInstaller.Forms.Components;
+using CreamInstaller.Components;
namespace CreamInstaller;
diff --git a/CreamInstaller/Forms/DialogForm.resx b/CreamInstaller/DialogForm.resx
similarity index 100%
rename from CreamInstaller/Forms/DialogForm.resx
rename to CreamInstaller/DialogForm.resx
diff --git a/CreamInstaller/Epic/EpicStore.cs b/CreamInstaller/Epic/EpicStore.cs
index b0a6042..a3a1b02 100644
--- a/CreamInstaller/Epic/EpicStore.cs
+++ b/CreamInstaller/Epic/EpicStore.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
@@ -13,12 +14,13 @@ namespace CreamInstaller.Epic;
internal static class EpicStore
{
- internal static async Task> ParseDlcAppIds(string categoryNamespace)
+ internal static async Task> ParseDlcIds(string categoryNamespace)
{
List<(string id, string name, string product, string icon, string developer)> dlcIds = new();
Response response = await QueryGraphQL(categoryNamespace);
if (response is null)
return dlcIds;
+ try { File.WriteAllText(ProgramData.AppInfoPath + @$"\{categoryNamespace}.json", JsonConvert.SerializeObject(response, Formatting.Indented)); } catch { }
List elements = new(response.Data.Catalog.CatalogOffers.Elements);
elements.AddRange(response.Data.Catalog.SearchStore.Elements);
foreach (Element element in elements)
diff --git a/CreamInstaller/Forms/InstallForm.Designer.cs b/CreamInstaller/InstallForm.Designer.cs
similarity index 100%
rename from CreamInstaller/Forms/InstallForm.Designer.cs
rename to CreamInstaller/InstallForm.Designer.cs
diff --git a/CreamInstaller/Forms/InstallForm.cs b/CreamInstaller/InstallForm.cs
similarity index 99%
rename from CreamInstaller/Forms/InstallForm.cs
rename to CreamInstaller/InstallForm.cs
index 7fe3b82..da36e95 100644
--- a/CreamInstaller/Forms/InstallForm.cs
+++ b/CreamInstaller/InstallForm.cs
@@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-using CreamInstaller.Forms.Components;
+using CreamInstaller.Components;
using CreamInstaller.Resources;
using CreamInstaller.Utility;
diff --git a/CreamInstaller/Forms/InstallForm.resx b/CreamInstaller/InstallForm.resx
similarity index 100%
rename from CreamInstaller/Forms/InstallForm.resx
rename to CreamInstaller/InstallForm.resx
diff --git a/CreamInstaller/Forms/MainForm.Designer.cs b/CreamInstaller/MainForm.Designer.cs
similarity index 99%
rename from CreamInstaller/Forms/MainForm.Designer.cs
rename to CreamInstaller/MainForm.Designer.cs
index 3a662da..f35169b 100644
--- a/CreamInstaller/Forms/MainForm.Designer.cs
+++ b/CreamInstaller/MainForm.Designer.cs
@@ -2,7 +2,7 @@
using System;
using System.Windows.Forms;
-using CreamInstaller.Forms.Components;
+using CreamInstaller.Components;
namespace CreamInstaller
{
diff --git a/CreamInstaller/Forms/MainForm.cs b/CreamInstaller/MainForm.cs
similarity index 99%
rename from CreamInstaller/Forms/MainForm.cs
rename to CreamInstaller/MainForm.cs
index c121079..85c7c65 100644
--- a/CreamInstaller/Forms/MainForm.cs
+++ b/CreamInstaller/MainForm.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using System.Web;
using System.Windows.Forms;
-using CreamInstaller.Forms.Components;
+using CreamInstaller.Components;
using CreamInstaller.Utility;
using HtmlAgilityPack;
diff --git a/CreamInstaller/Forms/MainForm.resx b/CreamInstaller/MainForm.resx
similarity index 100%
rename from CreamInstaller/Forms/MainForm.resx
rename to CreamInstaller/MainForm.resx
diff --git a/CreamInstaller/Forms/SelectForm.Designer.cs b/CreamInstaller/SelectForm.Designer.cs
similarity index 99%
rename from CreamInstaller/Forms/SelectForm.Designer.cs
rename to CreamInstaller/SelectForm.Designer.cs
index 5704576..aa1d444 100644
--- a/CreamInstaller/Forms/SelectForm.Designer.cs
+++ b/CreamInstaller/SelectForm.Designer.cs
@@ -1,7 +1,7 @@
using System.Windows.Forms;
-using CreamInstaller.Forms.Components;
+using CreamInstaller.Components;
namespace CreamInstaller
{
diff --git a/CreamInstaller/Forms/SelectForm.cs b/CreamInstaller/SelectForm.cs
similarity index 98%
rename from CreamInstaller/Forms/SelectForm.cs
rename to CreamInstaller/SelectForm.cs
index 1bd0371..94273bb 100644
--- a/CreamInstaller/Forms/SelectForm.cs
+++ b/CreamInstaller/SelectForm.cs
@@ -9,8 +9,8 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
+using CreamInstaller.Components;
using CreamInstaller.Epic;
-using CreamInstaller.Forms.Components;
using CreamInstaller.Paradox;
using CreamInstaller.Resources;
using CreamInstaller.Steam;
@@ -262,7 +262,7 @@ internal partial class SelectForm : CustomForm
if (Program.Canceled) return;
ConcurrentDictionary dlc = new();
List dlcTasks = new();
- List<(string id, string name, string product, string icon, string developer)> dlcIds = await EpicStore.ParseDlcAppIds(@namespace);
+ List<(string id, string name, string product, string icon, string developer)> dlcIds = await EpicStore.ParseDlcIds(@namespace);
if (dlcIds.Count > 0)
{
foreach ((string id, string name, string product, string icon, string developer) in dlcIds)
@@ -384,6 +384,7 @@ internal partial class SelectForm : CustomForm
progressBar.Value = p;
};
+ await ProgramData.Setup();
if (Directory.Exists(SteamLibrary.InstallPath))
{
progressLabel.Text = $"Setting up SteamCMD . . . ";
@@ -573,11 +574,18 @@ internal partial class SelectForm : CustomForm
}
nodeContextMenu.Items.Add(header);
string appInfo = $@"{SteamCMD.AppInfoPath}\{id}.vdf";
- if (Directory.Exists(Directory.GetDirectoryRoot(appInfo)) && File.Exists(appInfo))
+ string appInfoEpic = $@"{SteamCMD.AppInfoPath}\{id}.json";
+ if (Directory.Exists(Directory.GetDirectoryRoot(appInfo)) && (File.Exists(appInfo) || File.Exists(appInfoEpic)))
{
nodeContextMenu.Items.Add(new ToolStripSeparator());
nodeContextMenu.Items.Add(new ToolStripMenuItem("Open AppInfo", Image("Notepad"),
- new EventHandler((sender, e) => Diagnostics.OpenFileInNotepad(appInfo))));
+ new EventHandler((sender, e) =>
+ {
+ if (File.Exists(appInfo))
+ Diagnostics.OpenFileInNotepad(appInfo);
+ else
+ Diagnostics.OpenFileInNotepad(appInfoEpic);
+ })));
nodeContextMenu.Items.Add(new ToolStripMenuItem("Refresh AppInfo", Image("Command Prompt"),
new EventHandler((sender, e) =>
{
@@ -586,6 +594,11 @@ internal partial class SelectForm : CustomForm
File.Delete(appInfo);
}
catch { }
+ try
+ {
+ File.Delete(appInfoEpic);
+ }
+ catch { }
OnLoad();
})));
}
diff --git a/CreamInstaller/Forms/SelectForm.resx b/CreamInstaller/SelectForm.resx
similarity index 100%
rename from CreamInstaller/Forms/SelectForm.resx
rename to CreamInstaller/SelectForm.resx
diff --git a/CreamInstaller/Steam/SteamCMD.cs b/CreamInstaller/Steam/SteamCMD.cs
index 8f0e427..d4d20aa 100644
--- a/CreamInstaller/Steam/SteamCMD.cs
+++ b/CreamInstaller/Steam/SteamCMD.cs
@@ -8,9 +8,9 @@ using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using System.Windows.Forms;
using CreamInstaller.Resources;
+using CreamInstaller.Utility;
using Gameloop.Vdf.Linq;
@@ -19,10 +19,10 @@ namespace CreamInstaller.Steam;
internal static class SteamCMD
{
internal static readonly int ProcessLimit = 20;
- 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";
+ internal static string DirectoryPath => ProgramData.DirectoryPath;
+ internal static string AppInfoPath => ProgramData.AppInfoPath;
+
internal static readonly string FilePath = DirectoryPath + @"\steamcmd.exe";
private static readonly int[] locks = new int[ProcessLimit];
@@ -67,18 +67,10 @@ internal static class SteamCMD
internal static readonly string ArchivePath = DirectoryPath + @"\steamcmd.zip";
internal static readonly string DllPath = DirectoryPath + @"\steamclient.dll";
- internal static readonly string AppInfoPath = DirectoryPath + @"\appinfo";
- internal static readonly string AppInfoVersionPath = AppInfoPath + @"\version.txt";
internal static async Task Setup(IProgress progress = null)
{
await Cleanup();
- if (Directory.Exists(DirectoryPathOld))
- {
- if (Directory.Exists(DirectoryPath)) Directory.Delete(DirectoryPath, true);
- Directory.Move(DirectoryPathOld, DirectoryPath);
- }
- if (!Directory.Exists(DirectoryPath)) Directory.CreateDirectory(DirectoryPath);
if (!File.Exists(FilePath))
{
using (HttpClient httpClient = new())
@@ -89,12 +81,6 @@ internal static class SteamCMD
ZipFile.ExtractToDirectory(ArchivePath, DirectoryPath);
File.Delete(ArchivePath);
}
- if (!File.Exists(AppInfoVersionPath) || !Version.TryParse(File.ReadAllText(AppInfoVersionPath, Encoding.UTF8), out Version version) || version < MinimumAppInfoVersion)
- {
- if (Directory.Exists(AppInfoPath)) Directory.Delete(AppInfoPath, true);
- Directory.CreateDirectory(AppInfoPath);
- File.WriteAllText(AppInfoVersionPath, Application.ProductVersion, Encoding.UTF8);
- }
if (!File.Exists(DllPath))
{
FileSystemWatcher watcher = new(DirectoryPath);
diff --git a/CreamInstaller/Utility/ProgramData.cs b/CreamInstaller/Utility/ProgramData.cs
new file mode 100644
index 0000000..4237dc7
--- /dev/null
+++ b/CreamInstaller/Utility/ProgramData.cs
@@ -0,0 +1,34 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace CreamInstaller.Utility;
+
+internal static class ProgramData
+{
+ internal static readonly string DirectoryPathOld = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\CreamInstaller";
+ internal static readonly string DirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\CreamInstaller";
+
+ internal static readonly string AppInfoPath = DirectoryPath + @"\appinfo";
+ internal static readonly string AppInfoVersionPath = AppInfoPath + @"\version.txt";
+
+ internal static readonly Version MinimumAppInfoVersion = Version.Parse("2.4.0.0");
+
+ internal static async Task Setup() => await Task.Run(() =>
+ {
+ if (Directory.Exists(DirectoryPathOld))
+ {
+ if (Directory.Exists(DirectoryPath)) Directory.Delete(DirectoryPath, true);
+ Directory.Move(DirectoryPathOld, DirectoryPath);
+ }
+ if (!Directory.Exists(DirectoryPath)) Directory.CreateDirectory(DirectoryPath);
+ if (!File.Exists(AppInfoVersionPath) || !Version.TryParse(File.ReadAllText(AppInfoVersionPath, Encoding.UTF8), out Version version) || version < MinimumAppInfoVersion)
+ {
+ if (Directory.Exists(AppInfoPath)) Directory.Delete(AppInfoPath, true);
+ Directory.CreateDirectory(AppInfoPath);
+ File.WriteAllText(AppInfoVersionPath, Application.ProductVersion, Encoding.UTF8);
+ }
+ });
+}