- Minor refactoring
- Moved from VDF dynamic parsing to the more reliable method introduced in v2.2.4.1
- Fixed a bug where selections were validating prematurely
This commit is contained in:
pointfeev 2022-01-24 14:10:29 -05:00
parent f1b7e04842
commit 947809b4ad
15 changed files with 1363 additions and 1386 deletions

View file

@ -118,8 +118,8 @@ csharp_style_prefer_index_operator = true
csharp_style_prefer_null_check_over_type_check = true csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_range_operator = true csharp_style_prefer_range_operator = true
csharp_style_throw_expression = true csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable csharp_style_unused_value_assignment_preference = discard_variable:silent
csharp_style_unused_value_expression_statement_preference = unused_local_variable:suggestion csharp_style_unused_value_expression_statement_preference = discard_variable
# 'using' directive preferences # 'using' directive preferences
csharp_using_directive_placement = outside_namespace:suggestion csharp_using_directive_placement = outside_namespace:suggestion

View file

@ -1,10 +1,10 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
namespace CreamInstaller namespace CreamInstaller;
internal static class ExceptionHandler
{ {
internal static class ExceptionHandler
{
internal static bool OutputException(Exception e) internal static bool OutputException(Exception e)
{ {
while (e.InnerException is not null) while (e.InnerException is not null)
@ -46,15 +46,14 @@ namespace CreamInstaller
} }
return MessageBox.Show(output, caption: "CreamInstaller encountered an exception", buttons: MessageBoxButtons.RetryCancel, icon: MessageBoxIcon.Error) == DialogResult.Retry; return MessageBox.Show(output, caption: "CreamInstaller encountered an exception", buttons: MessageBoxButtons.RetryCancel, icon: MessageBoxIcon.Error) == DialogResult.Retry;
} }
} }
internal class CustomMessageException : Exception internal class CustomMessageException : Exception
{ {
private readonly string message; private readonly string message;
public override string Message => message ?? "CustomMessageException"; public override string Message => message ?? "CustomMessageException";
public override string ToString() => Message; public override string ToString() => Message;
internal CustomMessageException(string message) => this.message = message; internal CustomMessageException(string message) => this.message = message;
}
} }

View file

@ -1,10 +1,10 @@
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace CreamInstaller namespace CreamInstaller;
internal static class InstallationLog
{ {
internal static class InstallationLog
{
internal static readonly Color Background = Color.DarkSlateGray; internal static readonly Color Background = Color.DarkSlateGray;
internal static readonly Color Operation = Color.LightGray; internal static readonly Color Operation = Color.LightGray;
internal static readonly Color Resource = Color.LightBlue; internal static readonly Color Resource = Color.LightBlue;
@ -21,5 +21,4 @@ namespace CreamInstaller
logTextBox.AppendText(text); logTextBox.AppendText(text);
logTextBox.SelectionColor = logTextBox.ForeColor; logTextBox.SelectionColor = logTextBox.ForeColor;
} }
}
} }

View file

@ -7,10 +7,10 @@ using System.Threading.Tasks;
using Gameloop.Vdf.Linq; using Gameloop.Vdf.Linq;
namespace CreamInstaller namespace CreamInstaller;
internal class ProgramSelection
{ {
internal class ProgramSelection
{
internal bool Enabled = false; internal bool Enabled = false;
internal bool Usable = true; internal bool Usable = true;
@ -133,5 +133,4 @@ namespace CreamInstaller
if (app.Key == appId) return app; if (app.Key == appId) return app;
return null; return null;
} }
}
} }

View file

@ -11,10 +11,10 @@ using System.Windows.Forms;
using Gameloop.Vdf.Linq; using Gameloop.Vdf.Linq;
namespace CreamInstaller namespace CreamInstaller;
internal static class SteamCMD
{ {
internal static class SteamCMD
{
internal static readonly string DirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\CreamInstaller"; internal static readonly string DirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\CreamInstaller";
internal static readonly string FilePath = DirectoryPath + @"\steamcmd.exe"; internal static readonly string FilePath = DirectoryPath + @"\steamcmd.exe";
internal static readonly string ArchivePath = DirectoryPath + @"\steamcmd.zip"; internal static readonly string ArchivePath = DirectoryPath + @"\steamcmd.zip";
@ -107,10 +107,10 @@ namespace CreamInstaller
} }
if (appInfo.Value is VValue) goto restart; if (appInfo.Value is VValue) goto restart;
if (appInfo is null || appInfo.Value?.Children()?.ToList()?.Count == 0) return appInfo; if (appInfo is null || appInfo.Value?.Children()?.ToList()?.Count == 0) return appInfo;
VToken type = appInfo.Value?.TryGet("common")?.TryGet("type"); VToken type = appInfo.Value?.GetChild("common")?.GetChild("type");
if (type is null || type.ToString() == "Game") if (type is null || type.ToString() == "Game")
{ {
string buildid = appInfo.Value?.TryGet("depots")?.TryGet("branches")?.TryGet(branch)?.TryGet("buildid")?.ToString(); string buildid = appInfo.Value?.GetChild("depots")?.GetChild("branches")?.GetChild(branch)?.GetChild("buildid")?.ToString();
if (buildid is null && type is not null) return appInfo; if (buildid is null && type is not null) return appInfo;
if (type is null || int.Parse(buildid) < buildId) if (type is null || int.Parse(buildid) < buildId)
{ {
@ -131,14 +131,16 @@ namespace CreamInstaller
{ {
List<int> dlcIds = new(); List<int> dlcIds = new();
if (Program.Canceled || appInfo is not VProperty) return dlcIds; if (Program.Canceled || appInfo is not VProperty) return dlcIds;
VToken extended = appInfo.Value.TryGet("extended"); VToken extended = appInfo.Value.GetChild("extended");
if (extended is not null) foreach (VProperty property in extended) if (extended is not null)
if (property.Key.ToString() == "listofdlc") foreach (string id in property.Value.ToString().Split(",")) foreach (VProperty property in extended)
if (property.Key.ToString() == "listofdlc")
foreach (string id in property.Value.ToString().Split(","))
if (!dlcIds.Contains(int.Parse(id))) dlcIds.Add(int.Parse(id)); if (!dlcIds.Contains(int.Parse(id))) dlcIds.Add(int.Parse(id));
VToken depots = appInfo.Value.TryGet("depots"); VToken depots = appInfo.Value.GetChild("depots");
if (depots is not null) foreach (VProperty property in depots) if (depots is not null) foreach (VProperty property in depots)
if (int.TryParse(property.Key.ToString(), out int _) if (int.TryParse(property.Key.ToString(), out int _)
&& int.TryParse(property.Value.TryGet("dlcappid")?.ToString(), out int appid) && int.TryParse(property.Value.GetChild("dlcappid")?.ToString(), out int appid)
&& !dlcIds.Contains(appid)) && !dlcIds.Contains(appid))
dlcIds.Add(appid); dlcIds.Add(appid);
return dlcIds; return dlcIds;
@ -163,5 +165,4 @@ namespace CreamInstaller
Directory.Delete(DirectoryPath, true); Directory.Delete(DirectoryPath, true);
} }
} }
}
} }

View file

@ -17,7 +17,7 @@ internal static class ValveDataFile
return false; return false;
} }
internal static VToken TryGet(this VToken token, string index) internal static VToken GetChild(this VToken token, string index)
{ {
try try
{ {

View file

@ -5,7 +5,7 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon> <ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>2.2.4.1</Version> <Version>2.2.4.2</Version>
<PackageIcon>Resources\ini.ico</PackageIcon> <PackageIcon>Resources\ini.ico</PackageIcon>
<PackageIconUrl /> <PackageIconUrl />
<Description>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.</Description> <Description>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.</Description>

View file

@ -1,9 +1,9 @@
using System.Windows.Forms; using System.Windows.Forms;
namespace CreamInstaller namespace CreamInstaller;
internal class CustomForm : Form
{ {
internal class CustomForm : Form
{
internal CustomForm() : base() => Icon = Properties.Resources.Icon; internal CustomForm() : base() => Icon = Properties.Resources.Icon;
internal CustomForm(IWin32Window owner) : this() => Owner = owner as Form; internal CustomForm(IWin32Window owner) : this() => Owner = owner as Form;
@ -17,5 +17,4 @@ namespace CreamInstaller
return handleParam; return handleParam;
} }
} }
}
} }

View file

@ -2,10 +2,10 @@
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace CreamInstaller namespace CreamInstaller;
internal class CustomTreeView : TreeView
{ {
internal class CustomTreeView : TreeView
{
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
{ {
if (m.Msg == 0x203) if (m.Msg == 0x203)
@ -53,5 +53,4 @@ namespace CreamInstaller
Point subLocation = new(location.X - 1, location.Y + 1); Point subLocation = new(location.X - 1, location.Y + 1);
TextRenderer.DrawText(graphics, subText, subFont, subLocation, Color.Gray); TextRenderer.DrawText(graphics, subText, subFont, subLocation, Color.Gray);
} }
}
} }

View file

@ -1,10 +1,10 @@
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace CreamInstaller namespace CreamInstaller;
internal partial class DialogForm : CustomForm
{ {
internal partial class DialogForm : CustomForm
{
internal DialogForm(IWin32Window owner) : base(owner) => InitializeComponent(); internal DialogForm(IWin32Window owner) : base(owner) => InitializeComponent();
internal DialogResult Show(string formName, Icon descriptionIcon, string descriptionText, string acceptButtonText, string cancelButtonText = null) internal DialogResult Show(string formName, Icon descriptionIcon, string descriptionText, string acceptButtonText, string cancelButtonText = null)
@ -21,5 +21,4 @@ namespace CreamInstaller
else cancelButton.Text = cancelButtonText; else cancelButton.Text = cancelButtonText;
return ShowDialog(); return ShowDialog();
} }
}
} }

View file

@ -8,10 +8,10 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace CreamInstaller namespace CreamInstaller;
internal partial class InstallForm : CustomForm
{ {
internal partial class InstallForm : CustomForm
{
internal bool Reselecting = false; internal bool Reselecting = false;
internal bool Uninstalling = false; internal bool Uninstalling = false;
@ -69,10 +69,7 @@ namespace CreamInstaller
foreach (string directory in selection.SteamApiDllDirectories) foreach (string directory in selection.SteamApiDllDirectories)
{ {
await UpdateUser($"{(Uninstalling ? "Uninstalling" : "Installing")} CreamAPI for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation); await UpdateUser($"{(Uninstalling ? "Uninstalling" : "Installing")} CreamAPI for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
if (!Program.IsProgramRunningDialog(this, selection)) if (!Program.IsProgramRunningDialog(this, selection)) throw new OperationCanceledException();
{
throw new OperationCanceledException();
}
string api = directory + @"\steam_api.dll"; string api = directory + @"\steam_api.dll";
string api_o = directory + @"\steam_api_o.dll"; string api_o = directory + @"\steam_api_o.dll";
string api64 = directory + @"\steam_api64.dll"; string api64 = directory + @"\steam_api64.dll";
@ -132,14 +129,9 @@ namespace CreamInstaller
File.Create(cApi).Close(); File.Create(cApi).Close();
StreamWriter writer = new(cApi, true, Encoding.UTF8); StreamWriter writer = new(cApi, true, Encoding.UTF8);
writer.WriteLine("; " + Application.CompanyName + " v" + Application.ProductVersion); writer.WriteLine("; " + Application.CompanyName + " v" + Application.ProductVersion);
if (selection.SteamAppId > 0) if (selection.SteamAppId > 0) await WriteConfiguration(writer, selection.SteamAppId, selection.Name, selection.SelectedSteamDlc);
{
await WriteConfiguration(writer, selection.SteamAppId, selection.Name, selection.SelectedSteamDlc);
}
foreach (Tuple<int, string, SortedList<int, string>> extraAppDlc in selection.ExtraSteamAppIdDlc) foreach (Tuple<int, string, SortedList<int, string>> extraAppDlc in selection.ExtraSteamAppIdDlc)
{
await WriteConfiguration(writer, extraAppDlc.Item1, extraAppDlc.Item2, extraAppDlc.Item3); await WriteConfiguration(writer, extraAppDlc.Item1, extraAppDlc.Item2, extraAppDlc.Item3);
}
writer.Flush(); writer.Flush();
writer.Close(); writer.Close();
} }
@ -239,5 +231,4 @@ namespace CreamInstaller
Reselecting = true; Reselecting = true;
Close(); Close();
} }
}
} }

View file

@ -15,10 +15,10 @@ using Onova;
using Onova.Models; using Onova.Models;
using Onova.Services; using Onova.Services;
namespace CreamInstaller namespace CreamInstaller;
internal partial class MainForm : CustomForm
{ {
internal partial class MainForm : CustomForm
{
internal MainForm() : base() internal MainForm() : base()
{ {
InitializeComponent(); InitializeComponent();
@ -199,5 +199,4 @@ namespace CreamInstaller
updateManager.Dispose(); updateManager.Dispose();
updateManager = null; updateManager = null;
} }
}
} }

View file

@ -14,10 +14,10 @@ using Gameloop.Vdf.Linq;
using Microsoft.Win32; using Microsoft.Win32;
namespace CreamInstaller namespace CreamInstaller;
internal partial class SelectForm : CustomForm
{ {
internal partial class SelectForm : CustomForm
{
internal SelectForm(IWin32Window owner) : base(owner) internal SelectForm(IWin32Window owner) : base(owner)
{ {
InitializeComponent(); InitializeComponent();
@ -38,12 +38,12 @@ namespace CreamInstaller
{ {
gameDirectories.Add(libraryFolder); gameDirectories.Add(libraryFolder);
string libraryFolders = libraryFolder + @"\libraryfolders.vdf"; string libraryFolders = libraryFolder + @"\libraryfolders.vdf";
if (File.Exists(libraryFolders) && ValveDataFile.TryDeserialize(File.ReadAllText(libraryFolders, Encoding.UTF8), out VProperty _result)) if (File.Exists(libraryFolders) && ValveDataFile.TryDeserialize(File.ReadAllText(libraryFolders, Encoding.UTF8), out VProperty result))
{ {
dynamic result = _result; foreach (VProperty property in result.Value)
foreach (dynamic property in result?.Value) if (int.TryParse(property.Key, out int _)) if (int.TryParse(property.Key, out int _))
{ {
string path = property.Value?.path?.ToString(); string path = property.Value.GetChild("path")?.ToString();
if (string.IsNullOrWhiteSpace(path)) continue; if (string.IsNullOrWhiteSpace(path)) continue;
path += @"\steamapps"; path += @"\steamapps";
if (Directory.Exists(path) && !gameDirectories.Contains(path)) gameDirectories.Add(path); if (Directory.Exists(path) && !gameDirectories.Contains(path)) gameDirectories.Add(path);
@ -72,8 +72,7 @@ namespace CreamInstaller
} }
catch { } catch { }
} }
if (!dllDirectories.Any()) return null; return !dllDirectories.Any() ? null : dllDirectories;
return dllDirectories;
}); });
private static async Task<List<Tuple<int, string, string, int, string>>> GetGamesFromLibraryDirectory(string libraryDirectory) => await Task.Run(() => private static async Task<List<Tuple<int, string, string, int, string>>> GetGamesFromLibraryDirectory(string libraryDirectory) => await Task.Run(() =>
@ -84,28 +83,26 @@ namespace CreamInstaller
foreach (string file in files) foreach (string file in files)
{ {
if (Program.Canceled) return null; if (Program.Canceled) return null;
if (Path.GetExtension(file) == ".acf" && ValveDataFile.TryDeserialize(File.ReadAllText(file, Encoding.UTF8), out VProperty _result)) if (Path.GetExtension(file) == ".acf" && ValveDataFile.TryDeserialize(File.ReadAllText(file, Encoding.UTF8), out VProperty result))
{ {
dynamic result = _result; string appId = result.Value.GetChild("appid")?.ToString();
string _appid = result.Value?.appid?.ToString(); string installdir = result.Value.GetChild("installdir")?.ToString();
string installdir = result.Value?.installdir?.ToString(); string name = result.Value.GetChild("name")?.ToString();
string name = result.Value?.name?.ToString(); string buildId = result.Value.GetChild("buildid")?.ToString();
string _buildid = result.Value?.buildid?.ToString(); if (string.IsNullOrWhiteSpace(appId)
if (string.IsNullOrWhiteSpace(_appid)
|| string.IsNullOrWhiteSpace(installdir) || string.IsNullOrWhiteSpace(installdir)
|| string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(name)
|| string.IsNullOrWhiteSpace(_buildid)) || string.IsNullOrWhiteSpace(buildId))
continue; continue;
string branch = result.Value?.UserConfig?.betakey?.ToString(); string branch = result.Value.GetChild("UserConfig")?.GetChild("betakey")?.ToString();
if (string.IsNullOrWhiteSpace(branch)) branch = "public"; if (string.IsNullOrWhiteSpace(branch)) branch = "public";
string gameDirectory = libraryDirectory + @"\common\" + installdir; string gameDirectory = libraryDirectory + @"\common\" + installdir;
if (!int.TryParse(_appid, out int appid)) continue; if (!int.TryParse(appId, out int appIdInt)) continue;
if (!int.TryParse(_buildid, out int buildid)) continue; if (!int.TryParse(buildId, out int buildIdInt)) continue;
games.Add(new(appid, name, branch, buildid, gameDirectory)); games.Add(new(appIdInt, name, branch, buildIdInt, gameDirectory));
} }
} }
if (!games.Any()) return null; return !games.Any() ? null : games;
return games;
}); });
internal List<TreeNode> TreeNodes => GatherTreeNodes(selectionTreeView.Nodes); internal List<TreeNode> TreeNodes => GatherTreeNodes(selectionTreeView.Nodes);
@ -138,7 +135,7 @@ namespace CreamInstaller
applicablePrograms.Add(game); applicablePrograms.Add(game);
} }
int cur = 0; int CompleteTasks = 0;
RunningTasks.Clear(); RunningTasks.Clear();
foreach (Tuple<int, string, string, int, string> program in applicablePrograms) foreach (Tuple<int, string, string, int, string> program in applicablePrograms)
{ {
@ -148,7 +145,6 @@ namespace CreamInstaller
int buildId = program.Item4; int buildId = program.Item4;
string directory = program.Item5; string directory = program.Item5;
ProgramSelection selection = ProgramSelection.FromAppId(appId); ProgramSelection selection = ProgramSelection.FromAppId(appId);
if (selection is not null) selection.Validate();
if (Program.Canceled) return; if (Program.Canceled) return;
if (Program.BlockProtectedGames && Program.IsGameBlocked(name, directory)) continue; if (Program.BlockProtectedGames && Program.IsGameBlocked(name, directory)) continue;
RunningTasks.Add(Task.Run(async () => RunningTasks.Add(Task.Run(async () =>
@ -173,11 +169,11 @@ namespace CreamInstaller
if (Program.Canceled) return; if (Program.Canceled) return;
string dlcName = null; string dlcName = null;
VProperty dlcAppInfo = await SteamCMD.GetAppInfo(id); VProperty dlcAppInfo = await SteamCMD.GetAppInfo(id);
if (dlcAppInfo is not null) dlcName = dlcAppInfo.Value?.TryGet("common")?.TryGet("name")?.ToString(); if (dlcAppInfo is not null) dlcName = dlcAppInfo.Value?.GetChild("common")?.GetChild("name")?.ToString();
if (Program.Canceled) return; if (Program.Canceled) return;
if (string.IsNullOrWhiteSpace(dlcName)) return; //dlcName = "Unknown DLC"; if (string.IsNullOrWhiteSpace(dlcName)) return; //dlcName = "Unknown DLC";
dlc[id] = /*$"[{id}] " +*/ dlcName; dlc[id] = /*$"[{id}] " +*/ dlcName;
progress.Report(++cur); progress.Report(++CompleteTasks);
}); });
dlcTasks.Add(task); dlcTasks.Add(task);
RunningTasks.Add(task); RunningTasks.Add(task);
@ -201,8 +197,8 @@ namespace CreamInstaller
if (appId == 0) selection.Icon = Program.GetFileIconImage(directory + @"\launcher\bootstrapper-v2.exe"); if (appId == 0) selection.Icon = Program.GetFileIconImage(directory + @"\launcher\bootstrapper-v2.exe");
else else
{ {
selection.IconStaticID = appInfo?.Value?.TryGet("common")?.TryGet("icon")?.ToString(); selection.IconStaticID = appInfo?.Value?.GetChild("common")?.GetChild("icon")?.ToString();
selection.ClientIconStaticID = appInfo?.Value?.TryGet("common")?.TryGet("clienticon")?.ToString(); selection.ClientIconStaticID = appInfo?.Value?.GetChild("common")?.GetChild("clienticon")?.ToString();
} }
} }
if (allCheckBox.Checked) selection.Enabled = true; if (allCheckBox.Checked) selection.Enabled = true;
@ -242,8 +238,7 @@ namespace CreamInstaller
} }
} }
}); });
progress.Report(++CompleteTasks);
progress.Report(++cur);
})); }));
progress.Report(-RunningTasks.Count); progress.Report(-RunningTasks.Count);
} }
@ -443,14 +438,14 @@ namespace CreamInstaller
foreach (ProgramSelection selection in ProgramSelection.AllUsableEnabled) foreach (ProgramSelection selection in ProgramSelection.AllUsableEnabled)
{ {
if (selection.Name == paradoxLauncher.Name) continue; if (selection.Name == paradoxLauncher.Name) continue;
if (selection.AppInfo.Value?.TryGet("extended")?.TryGet("publisher")?.ToString() != "Paradox Interactive") continue; if (selection.AppInfo.Value?.GetChild("extended")?.GetChild("publisher")?.ToString() != "Paradox Interactive") continue;
paradoxLauncher.ExtraSteamAppIdDlc.Add(new(selection.SteamAppId, selection.Name, selection.SelectedSteamDlc)); paradoxLauncher.ExtraSteamAppIdDlc.Add(new(selection.SteamAppId, selection.Name, selection.SelectedSteamDlc));
} }
if (!paradoxLauncher.ExtraSteamAppIdDlc.Any()) if (!paradoxLauncher.ExtraSteamAppIdDlc.Any())
foreach (ProgramSelection selection in ProgramSelection.AllUsable) foreach (ProgramSelection selection in ProgramSelection.AllUsable)
{ {
if (selection.Name == paradoxLauncher.Name) continue; if (selection.Name == paradoxLauncher.Name) continue;
if (selection.AppInfo.Value?.TryGet("extended")?.TryGet("publisher")?.ToString() != "Paradox Interactive") continue; if (selection.AppInfo.Value?.GetChild("extended")?.GetChild("publisher")?.ToString() != "Paradox Interactive") continue;
paradoxLauncher.ExtraSteamAppIdDlc.Add(new(selection.SteamAppId, selection.Name, selection.AllSteamDlc)); paradoxLauncher.ExtraSteamAppIdDlc.Add(new(selection.SteamAppId, selection.Name, selection.AllSteamDlc));
} }
} }
@ -547,5 +542,4 @@ namespace CreamInstaller
"\n\nBlocked game sub-directory exceptions (not blocked):" + blockedDirectoryExceptions, "\n\nBlocked game sub-directory exceptions (not blocked):" + blockedDirectoryExceptions,
"OK"); "OK");
} }
}
} }

View file

@ -10,10 +10,10 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace CreamInstaller namespace CreamInstaller;
internal static class Program
{ {
internal static class Program
{
internal static readonly string ApplicationName = Application.CompanyName + " v" + Application.ProductVersion + ": " + Application.ProductName; internal static readonly string ApplicationName = Application.CompanyName + " v" + Application.ProductVersion + ": " + Application.ProductName;
internal static readonly Assembly EntryAssembly = Assembly.GetEntryAssembly(); internal static readonly Assembly EntryAssembly = Assembly.GetEntryAssembly();
internal static readonly Process CurrentProcess = Process.GetCurrentProcess(); internal static readonly Process CurrentProcess = Process.GetCurrentProcess();
@ -130,5 +130,4 @@ namespace CreamInstaller
int Y = fromForm.Location.Y + fromForm.Size.Height / 2 - form.Size.Height / 2; int Y = fromForm.Location.Y + fromForm.Size.Height / 2 - form.Size.Height / 2;
form.Location = new(X, Y); form.Location = new(X, Y);
} }
}
} }

View file

@ -1,13 +1,12 @@
using System.IO; using System.IO;
namespace CreamInstaller namespace CreamInstaller;
internal static class FileResourceExtensions
{ {
internal static class FileResourceExtensions
{
internal static void Write(this byte[] resource, string filePath) internal static void Write(this byte[] resource, string filePath)
{ {
using FileStream file = new(filePath, FileMode.Create, FileAccess.Write); using FileStream file = new(filePath, FileMode.Create, FileAccess.Write);
file.Write(resource); file.Write(resource);
} }
}
} }