intermediary updates
- Uplay R1 & R2 preparation - Minor refactoring - Install form whiteout fix
This commit is contained in:
parent
d95598fa38
commit
e4a90d9c8d
21 changed files with 241 additions and 183 deletions
|
@ -19,12 +19,12 @@ insert_final_newline = false
|
||||||
|
|
||||||
# Organize usings
|
# Organize usings
|
||||||
dotnet_separate_import_directive_groups = true
|
dotnet_separate_import_directive_groups = true
|
||||||
dotnet_sort_system_directives_first = true
|
dotnet_sort_system_directives_first = false
|
||||||
file_header_template = unset
|
file_header_template = unset
|
||||||
|
|
||||||
# this. and Me. preferences
|
# this. and Me. preferences
|
||||||
dotnet_style_qualification_for_event = false:suggestion
|
dotnet_style_qualification_for_event = false:suggestion
|
||||||
dotnet_style_qualification_for_field = false
|
dotnet_style_qualification_for_field = false:suggestion
|
||||||
dotnet_style_qualification_for_method = false:suggestion
|
dotnet_style_qualification_for_method = false:suggestion
|
||||||
dotnet_style_qualification_for_property = false:suggestion
|
dotnet_style_qualification_for_property = false:suggestion
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ dotnet_style_prefer_auto_properties = true:suggestion
|
||||||
dotnet_style_prefer_compound_assignment = true
|
dotnet_style_prefer_compound_assignment = true
|
||||||
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
||||||
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
||||||
|
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
|
||||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true
|
||||||
dotnet_style_prefer_inferred_tuple_names = true
|
dotnet_style_prefer_inferred_tuple_names = true
|
||||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
|
||||||
|
@ -92,6 +93,7 @@ csharp_style_expression_bodied_properties = true:suggestion
|
||||||
# Pattern matching preferences
|
# Pattern matching preferences
|
||||||
csharp_style_pattern_matching_over_as_with_null_check = true
|
csharp_style_pattern_matching_over_as_with_null_check = true
|
||||||
csharp_style_pattern_matching_over_is_with_cast_check = true
|
csharp_style_pattern_matching_over_is_with_cast_check = true
|
||||||
|
csharp_style_prefer_extended_property_pattern = true
|
||||||
csharp_style_prefer_not_pattern = true
|
csharp_style_prefer_not_pattern = true
|
||||||
csharp_style_prefer_pattern_matching = true:suggestion
|
csharp_style_prefer_pattern_matching = true:suggestion
|
||||||
csharp_style_prefer_switch_expression = true
|
csharp_style_prefer_switch_expression = true
|
||||||
|
@ -101,31 +103,35 @@ csharp_style_conditional_delegate_call = true
|
||||||
|
|
||||||
# Modifier preferences
|
# Modifier preferences
|
||||||
csharp_prefer_static_local_function = true
|
csharp_prefer_static_local_function = true
|
||||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
|
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
|
||||||
|
|
||||||
# Code-block preferences
|
# Code-block preferences
|
||||||
csharp_prefer_braces = false:suggestion
|
csharp_prefer_braces = false:suggestion
|
||||||
csharp_prefer_simple_using_statement = true
|
csharp_prefer_simple_using_statement = true
|
||||||
csharp_style_namespace_declarations = file_scoped:suggestion
|
csharp_style_namespace_declarations = file_scoped:suggestion
|
||||||
|
csharp_style_prefer_method_group_conversion = true:suggestion
|
||||||
|
csharp_style_prefer_top_level_statements = true:suggestion
|
||||||
|
|
||||||
# Expression-level preferences
|
# Expression-level preferences
|
||||||
csharp_prefer_simple_default_expression = true
|
csharp_prefer_simple_default_expression = true
|
||||||
csharp_style_deconstructed_variable_declaration = true
|
csharp_style_deconstructed_variable_declaration = true
|
||||||
csharp_style_implicit_object_creation_when_type_is_apparent = true
|
csharp_style_implicit_object_creation_when_type_is_apparent = true
|
||||||
csharp_style_inlined_variable_declaration = true
|
csharp_style_inlined_variable_declaration = true
|
||||||
csharp_style_pattern_local_over_anonymous_function = true
|
|
||||||
csharp_style_prefer_index_operator = true
|
csharp_style_prefer_index_operator = true
|
||||||
|
csharp_style_prefer_local_over_anonymous_function = 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_prefer_tuple_swap = true
|
||||||
|
csharp_style_prefer_utf8_string_literals = true
|
||||||
csharp_style_throw_expression = true
|
csharp_style_throw_expression = true
|
||||||
csharp_style_unused_value_assignment_preference = discard_variable:silent
|
csharp_style_unused_value_assignment_preference = discard_variable
|
||||||
csharp_style_unused_value_expression_statement_preference = discard_variable
|
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
|
||||||
|
|
||||||
# 'using' directive preferences
|
# 'using' directive preferences
|
||||||
csharp_using_directive_placement = outside_namespace:suggestion
|
csharp_using_directive_placement = outside_namespace:suggestion
|
||||||
|
|
||||||
# New line preferences
|
# New line preferences
|
||||||
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:suggestion
|
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:suggestion
|
||||||
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion
|
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion
|
||||||
csharp_style_allow_embedded_statements_on_same_line_experimental = true:suggestion
|
csharp_style_allow_embedded_statements_on_same_line_experimental = true:suggestion
|
||||||
|
|
||||||
|
@ -144,8 +150,8 @@ csharp_new_line_between_query_expression_clauses = true
|
||||||
csharp_indent_block_contents = true
|
csharp_indent_block_contents = true
|
||||||
csharp_indent_braces = false
|
csharp_indent_braces = false
|
||||||
csharp_indent_case_contents = true
|
csharp_indent_case_contents = true
|
||||||
csharp_indent_case_contents_when_block = true
|
csharp_indent_case_contents_when_block = false
|
||||||
csharp_indent_labels = one_less_than_current
|
csharp_indent_labels = no_change
|
||||||
csharp_indent_switch_labels = true
|
csharp_indent_switch_labels = true
|
||||||
|
|
||||||
# Space preferences
|
# Space preferences
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
using System;
|
using CreamInstaller.Paradox;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using CreamInstaller.Paradox;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
namespace CreamInstaller.Components;
|
namespace CreamInstaller.Components;
|
||||||
|
|
||||||
internal class ContextMenuItem : ToolStripMenuItem
|
internal class ContextMenuItem : ToolStripMenuItem
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
using System.Collections.Generic;
|
using CreamInstaller.Resources;
|
||||||
|
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using CreamInstaller.Resources;
|
|
||||||
|
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace CreamInstaller.Epic;
|
namespace CreamInstaller.Epic;
|
||||||
|
|
||||||
internal static class EpicLibrary
|
internal static class EpicLibrary
|
||||||
|
@ -53,13 +53,12 @@ internal static class EpicLibrary
|
||||||
{
|
{
|
||||||
List<string> dllDirectories = new();
|
List<string> dllDirectories = new();
|
||||||
if (Program.Canceled || !Directory.Exists(gameDirectory)) return null;
|
if (Program.Canceled || !Directory.Exists(gameDirectory)) return null;
|
||||||
gameDirectory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config, out string cache);
|
gameDirectory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
|
||||||
if (File.Exists(sdk32)
|
if (File.Exists(sdk32)
|
||||||
|| File.Exists(sdk32_o)
|
|| File.Exists(sdk32_o)
|
||||||
|| File.Exists(sdk64)
|
|| File.Exists(sdk64)
|
||||||
|| File.Exists(sdk64_o)
|
|| File.Exists(sdk64_o)
|
||||||
|| File.Exists(config)
|
|| File.Exists(config))
|
||||||
|| File.Exists(cache))
|
|
||||||
dllDirectories.Add(gameDirectory);
|
dllDirectories.Add(gameDirectory);
|
||||||
string[] directories = Directory.GetDirectories(gameDirectory);
|
string[] directories = Directory.GetDirectories(gameDirectory);
|
||||||
foreach (string _directory in directories)
|
foreach (string _directory in directories)
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
using System;
|
using CreamInstaller.Epic.GraphQL;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -7,11 +12,6 @@ using System.Net.Http.Headers;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
using CreamInstaller.Epic.GraphQL;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace CreamInstaller.Epic;
|
namespace CreamInstaller.Epic;
|
||||||
|
|
||||||
internal static class EpicStore
|
internal static class EpicStore
|
||||||
|
@ -124,7 +124,7 @@ internal static class EpicStore
|
||||||
HttpClient client = HttpClientManager.HttpClient;
|
HttpClient client = HttpClientManager.HttpClient;
|
||||||
if (client is null) return null;
|
if (client is null) return null;
|
||||||
HttpResponseMessage httpResponse = await client.PostAsync(new Uri("https://graphql.epicgames.com/graphql"), content);
|
HttpResponseMessage httpResponse = await client.PostAsync(new Uri("https://graphql.epicgames.com/graphql"), content);
|
||||||
httpResponse.EnsureSuccessStatusCode();
|
_ = httpResponse.EnsureSuccessStatusCode();
|
||||||
string response = await httpResponse.Content.ReadAsStringAsync();
|
string response = await httpResponse.Content.ReadAsStringAsync();
|
||||||
return JsonConvert.DeserializeObject<Response>(response);
|
return JsonConvert.DeserializeObject<Response>(response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma warning disable CA1819 // Properties should not return arrays
|
#pragma warning disable CA1819 // Properties should not return arrays
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace CreamInstaller.Epic.GraphQL;
|
namespace CreamInstaller.Epic.GraphQL;
|
||||||
|
|
||||||
public class Response
|
public class Response
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
using System;
|
using CreamInstaller.Components;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using CreamInstaller.Components;
|
|
||||||
|
|
||||||
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(Icon descriptionIcon, string descriptionText, string acceptButtonText, string cancelButtonText = null, string customFormText = null, Icon customFormIcon = null)
|
internal DialogResult Show(Icon descriptionIcon, string descriptionText, string acceptButtonText = "OK", string cancelButtonText = null, string customFormText = null, Icon customFormIcon = null)
|
||||||
{
|
{
|
||||||
if (descriptionIcon is null)
|
descriptionIcon ??= Icon;
|
||||||
descriptionIcon = Icon;
|
|
||||||
icon.Image = descriptionIcon.ToBitmap();
|
icon.Image = descriptionIcon.ToBitmap();
|
||||||
descriptionLabel.Text = descriptionText;
|
descriptionLabel.Text = descriptionText;
|
||||||
acceptButton.Text = acceptButtonText;
|
acceptButton.Text = acceptButtonText;
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
using System;
|
using CreamInstaller.Components;
|
||||||
|
using CreamInstaller.Resources;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -8,10 +12,6 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using CreamInstaller.Components;
|
|
||||||
using CreamInstaller.Resources;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
using static CreamInstaller.Paradox.ParadoxLauncher;
|
using static CreamInstaller.Paradox.ParadoxLauncher;
|
||||||
|
|
||||||
namespace CreamInstaller;
|
namespace CreamInstaller;
|
||||||
|
@ -45,13 +45,14 @@ internal partial class InstallForm : CustomForm
|
||||||
|
|
||||||
internal void UpdateUser(string text, Color color, bool info = true, bool log = true)
|
internal void UpdateUser(string text, Color color, bool info = true, bool log = true)
|
||||||
{
|
{
|
||||||
if (info) userInfoLabel.Invoke(() => userInfoLabel.Text = text);
|
if (info) _ = userInfoLabel.Invoke(() => userInfoLabel.Text = text);
|
||||||
if (log && !logTextBox.Disposing && !logTextBox.IsDisposed)
|
if (log && !logTextBox.Disposing && !logTextBox.IsDisposed)
|
||||||
{
|
{
|
||||||
logTextBox.Invoke(() =>
|
logTextBox.Invoke(() =>
|
||||||
{
|
{
|
||||||
if (logTextBox.Text.Length > 0) logTextBox.AppendText(Environment.NewLine, color);
|
if (logTextBox.Text.Length > 0) logTextBox.AppendText(Environment.NewLine, color);
|
||||||
logTextBox.AppendText(text, color);
|
logTextBox.AppendText(text, color);
|
||||||
|
logTextBox.Refresh();
|
||||||
});
|
});
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +269,7 @@ internal partial class InstallForm : CustomForm
|
||||||
|
|
||||||
internal static async Task UninstallScreamAPI(string directory, InstallForm installForm = null, bool deleteConfig = true) => await Task.Run(() =>
|
internal static async Task UninstallScreamAPI(string directory, InstallForm installForm = null, bool deleteConfig = true) => await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config, out string cache);
|
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
|
||||||
if (File.Exists(sdk32_o))
|
if (File.Exists(sdk32_o))
|
||||||
{
|
{
|
||||||
if (File.Exists(sdk32))
|
if (File.Exists(sdk32))
|
||||||
|
@ -299,17 +300,11 @@ internal partial class InstallForm : CustomForm
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||||
}
|
}
|
||||||
if (deleteConfig && File.Exists(cache))
|
|
||||||
{
|
|
||||||
File.Delete(cache);
|
|
||||||
if (installForm is not null)
|
|
||||||
installForm.UpdateUser($"Deleted cache: {Path.GetFileName(cache)}", InstallationLog.Action, info: false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
internal static async Task InstallScreamAPI(string directory, ProgramSelection selection, InstallForm installForm = null, bool generateConfig = true) => await Task.Run(() =>
|
internal static async Task InstallScreamAPI(string directory, ProgramSelection selection, InstallForm installForm = null, bool generateConfig = true) => await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config, out _);
|
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
|
||||||
if (File.Exists(sdk32) && !File.Exists(sdk32_o))
|
if (File.Exists(sdk32) && !File.Exists(sdk32_o))
|
||||||
{
|
{
|
||||||
File.Move(sdk32, sdk32_o);
|
File.Move(sdk32, sdk32_o);
|
||||||
|
@ -372,7 +367,7 @@ internal partial class InstallForm : CustomForm
|
||||||
if (selection.Id == "ParadoxLauncher")
|
if (selection.Id == "ParadoxLauncher")
|
||||||
{
|
{
|
||||||
UpdateUser($"Repairing Paradox Launcher . . . ", InstallationLog.Operation);
|
UpdateUser($"Repairing Paradox Launcher . . . ", InstallationLog.Operation);
|
||||||
await Repair(this, selection);
|
_ = await Repair(this, selection);
|
||||||
}
|
}
|
||||||
foreach (string directory in selection.DllDirectories)
|
foreach (string directory in selection.DllDirectories)
|
||||||
{
|
{
|
||||||
|
@ -394,8 +389,8 @@ internal partial class InstallForm : CustomForm
|
||||||
if (selection.IsEpic && selection.SelectedDlc.Any(d => d.Value.type is DlcType.EpicCatalogItem or DlcType.EpicEntitlement)
|
if (selection.IsEpic && selection.SelectedDlc.Any(d => d.Value.type is DlcType.EpicCatalogItem or DlcType.EpicEntitlement)
|
||||||
|| selection.ExtraSelectedDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.EpicCatalogItem or DlcType.EpicEntitlement)))
|
|| selection.ExtraSelectedDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.EpicCatalogItem or DlcType.EpicEntitlement)))
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config, out string cache);
|
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
|
||||||
if (File.Exists(sdk32) || File.Exists(sdk32_o) || File.Exists(sdk64) || File.Exists(sdk64_o) || File.Exists(config) || File.Exists(cache))
|
if (File.Exists(sdk32) || File.Exists(sdk32_o) || File.Exists(sdk64) || File.Exists(sdk64_o) || File.Exists(config))
|
||||||
{
|
{
|
||||||
UpdateUser($"{(Uninstalling ? "Uninstalling" : "Installing")} ScreamAPI" +
|
UpdateUser($"{(Uninstalling ? "Uninstalling" : "Installing")} ScreamAPI" +
|
||||||
$" {(Uninstalling ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
$" {(Uninstalling ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||||
|
@ -469,7 +464,7 @@ internal partial class InstallForm : CustomForm
|
||||||
|
|
||||||
private void OnLoad(object sender, EventArgs _)
|
private void OnLoad(object sender, EventArgs _)
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userInfoLabel.Text = "Loading . . . ";
|
userInfoLabel.Text = "Loading . . . ";
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
using System;
|
using CreamInstaller.Components;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using HtmlAgilityPack;
|
||||||
|
|
||||||
|
using Onova;
|
||||||
|
using Onova.Models;
|
||||||
|
using Onova.Services;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -8,15 +17,6 @@ using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using CreamInstaller.Components;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
using HtmlAgilityPack;
|
|
||||||
|
|
||||||
using Onova;
|
|
||||||
using Onova.Models;
|
|
||||||
using Onova.Services;
|
|
||||||
|
|
||||||
namespace CreamInstaller;
|
namespace CreamInstaller;
|
||||||
|
|
||||||
internal partial class MainForm : CustomForm
|
internal partial class MainForm : CustomForm
|
||||||
|
@ -39,7 +39,7 @@ internal partial class MainForm : CustomForm
|
||||||
}
|
}
|
||||||
Hide();
|
Hide();
|
||||||
using SelectForm form = new(this);
|
using SelectForm form = new(this);
|
||||||
form.ShowDialog();
|
_ = form.ShowDialog();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ internal partial class MainForm : CustomForm
|
||||||
|
|
||||||
private void OnLoad(object sender, EventArgs _)
|
private void OnLoad(object sender, EventArgs _)
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string FileName = Path.GetFileName(Program.CurrentProcessFilePath);
|
string FileName = Path.GetFileName(Program.CurrentProcessFilePath);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
using System;
|
using CreamInstaller.Components;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using CreamInstaller.Components;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
using static CreamInstaller.Components.CustomTreeView;
|
using static CreamInstaller.Components.CustomTreeView;
|
||||||
|
|
||||||
namespace CreamInstaller;
|
namespace CreamInstaller;
|
||||||
|
@ -34,7 +34,7 @@ internal partial class SelectDialogForm : CustomForm
|
||||||
Checked = alreadySelected
|
Checked = alreadySelected
|
||||||
};
|
};
|
||||||
OnTreeNodeChecked(node);
|
OnTreeNodeChecked(node);
|
||||||
selectionTreeView.Nodes.Add(node);
|
_ = selectionTreeView.Nodes.Add(node);
|
||||||
}
|
}
|
||||||
if (!selected.Any()) OnLoad(null, null);
|
if (!selected.Any()) OnLoad(null, null);
|
||||||
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
|
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
|
||||||
|
@ -62,7 +62,7 @@ internal partial class SelectDialogForm : CustomForm
|
||||||
if (node.Checked)
|
if (node.Checked)
|
||||||
selected.Add((node.Tag as string, id, node.Text));
|
selected.Add((node.Tag as string, id, node.Text));
|
||||||
else
|
else
|
||||||
selected.RemoveAll(s => s.id == id);
|
_ = selected.RemoveAll(s => s.id == id);
|
||||||
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
|
allCheckBox.CheckedChanged -= OnAllCheckBoxChanged;
|
||||||
allCheckBox.Checked = selectionTreeView.Nodes.Cast<TreeNode>().All(n => n.Checked);
|
allCheckBox.Checked = selectionTreeView.Nodes.Cast<TreeNode>().All(n => n.Checked);
|
||||||
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
|
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
|
||||||
|
|
|
@ -1,13 +1,4 @@
|
||||||
using System;
|
#pragma warning disable IDE0058
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
using CreamInstaller.Components;
|
using CreamInstaller.Components;
|
||||||
using CreamInstaller.Epic;
|
using CreamInstaller.Epic;
|
||||||
|
@ -18,6 +9,17 @@ using CreamInstaller.Utility;
|
||||||
|
|
||||||
using Gameloop.Vdf.Linq;
|
using Gameloop.Vdf.Linq;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace CreamInstaller;
|
namespace CreamInstaller;
|
||||||
|
|
||||||
internal partial class SelectForm : CustomForm
|
internal partial class SelectForm : CustomForm
|
||||||
|
@ -51,7 +53,7 @@ internal partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
if (Program.Canceled) return;
|
if (Program.Canceled) return;
|
||||||
if (RemainingGames.Contains(gameName))
|
if (RemainingGames.Contains(gameName))
|
||||||
RemainingGames.Remove(gameName);
|
_ = RemainingGames.Remove(gameName);
|
||||||
UpdateRemainingGames();
|
UpdateRemainingGames();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -76,7 +78,7 @@ internal partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
if (Program.Canceled) return;
|
if (Program.Canceled) return;
|
||||||
if (RemainingDLCs.Contains(dlcId))
|
if (RemainingDLCs.Contains(dlcId))
|
||||||
RemainingDLCs.Remove(dlcId);
|
_ = RemainingDLCs.Remove(dlcId);
|
||||||
UpdateRemainingDLCs();
|
UpdateRemainingDLCs();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -123,7 +125,7 @@ internal partial class SelectForm : CustomForm
|
||||||
programNode.Text = selection.Name;
|
programNode.Text = selection.Name;
|
||||||
programNode.Checked = selection.Enabled;
|
programNode.Checked = selection.Enabled;
|
||||||
programNode.Remove();
|
programNode.Remove();
|
||||||
selectionTreeView.Nodes.Add(programNode);
|
_ = selectionTreeView.Nodes.Add(programNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Directory.Exists(SteamLibrary.InstallPath) && ProgramsToScan.Any(c => c.platform == "Steam"))
|
if (Directory.Exists(SteamLibrary.InstallPath) && ProgramsToScan.Any(c => c.platform == "Steam"))
|
||||||
|
@ -245,7 +247,7 @@ internal partial class SelectForm : CustomForm
|
||||||
programNode.Text = appData?.name ?? name;
|
programNode.Text = appData?.name ?? name;
|
||||||
programNode.Checked = selection.Enabled;
|
programNode.Checked = selection.Enabled;
|
||||||
programNode.Remove();
|
programNode.Remove();
|
||||||
selectionTreeView.Nodes.Add(programNode);
|
_ = selectionTreeView.Nodes.Add(programNode);
|
||||||
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in dlc)
|
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in dlc)
|
||||||
{
|
{
|
||||||
if (Program.Canceled || programNode is null) return;
|
if (Program.Canceled || programNode is null) return;
|
||||||
|
@ -259,7 +261,7 @@ internal partial class SelectForm : CustomForm
|
||||||
dlcNode.Text = dlcApp.name;
|
dlcNode.Text = dlcApp.name;
|
||||||
dlcNode.Checked = selection.SelectedDlc.ContainsKey(appId);
|
dlcNode.Checked = selection.SelectedDlc.ContainsKey(appId);
|
||||||
dlcNode.Remove();
|
dlcNode.Remove();
|
||||||
programNode.Nodes.Add(dlcNode);
|
_ = programNode.Nodes.Add(dlcNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (Program.Canceled) return;
|
if (Program.Canceled) return;
|
||||||
|
@ -352,7 +354,7 @@ internal partial class SelectForm : CustomForm
|
||||||
programNode.Text = name;
|
programNode.Text = name;
|
||||||
programNode.Checked = selection.Enabled;
|
programNode.Checked = selection.Enabled;
|
||||||
programNode.Remove();
|
programNode.Remove();
|
||||||
selectionTreeView.Nodes.Add(programNode);
|
_ = selectionTreeView.Nodes.Add(programNode);
|
||||||
/*TreeNode catalogItemsNode = treeNodes.Find(s => s.Name == @namespace + "_catalogItems") ?? new();
|
/*TreeNode catalogItemsNode = treeNodes.Find(s => s.Name == @namespace + "_catalogItems") ?? new();
|
||||||
catalogItemsNode.Name = @namespace + "_catalogItems";
|
catalogItemsNode.Name = @namespace + "_catalogItems";
|
||||||
catalogItemsNode.Text = "Catalog Items";
|
catalogItemsNode.Text = "Catalog Items";
|
||||||
|
@ -380,7 +382,7 @@ internal partial class SelectForm : CustomForm
|
||||||
dlcNode.Text = dlcApp.name;
|
dlcNode.Text = dlcApp.name;
|
||||||
dlcNode.Checked = selection.SelectedDlc.ContainsKey(dlcId);
|
dlcNode.Checked = selection.SelectedDlc.ContainsKey(dlcId);
|
||||||
dlcNode.Remove();
|
dlcNode.Remove();
|
||||||
programNode.Nodes.Add(dlcNode); //entitlementsNode.Nodes.Add(dlcNode);
|
_ = programNode.Nodes.Add(dlcNode); //entitlementsNode.Nodes.Add(dlcNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -585,7 +587,7 @@ internal partial class SelectForm : CustomForm
|
||||||
|
|
||||||
private void OnLoad(object sender, EventArgs _)
|
private void OnLoad(object sender, EventArgs _)
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HideProgressBar();
|
HideProgressBar();
|
||||||
|
@ -683,8 +685,8 @@ internal partial class SelectForm : CustomForm
|
||||||
for (int i = 0; i < directories.Count; i++)
|
for (int i = 0; i < directories.Count; i++)
|
||||||
{
|
{
|
||||||
string directory = directories[i];
|
string directory = directories[i];
|
||||||
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config, out string cache);
|
directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
|
||||||
if (File.Exists(sdk32) || File.Exists(sdk32_o) || File.Exists(sdk64) || File.Exists(sdk64_o) || File.Exists(config) || File.Exists(cache))
|
if (File.Exists(sdk32) || File.Exists(sdk32_o) || File.Exists(sdk64) || File.Exists(sdk64_o) || File.Exists(config))
|
||||||
{
|
{
|
||||||
contextMenuStrip.Items.Add(new ContextMenuItem($"Open Epic Online Services SDK Directory #{i + 1}", "File Explorer",
|
contextMenuStrip.Items.Add(new ContextMenuItem($"Open Epic Online Services SDK Directory #{i + 1}", "File Explorer",
|
||||||
new EventHandler((sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory))));
|
new EventHandler((sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory))));
|
||||||
|
@ -743,7 +745,7 @@ internal partial class SelectForm : CustomForm
|
||||||
if (ParadoxLauncher.DlcDialog(this)) return;
|
if (ParadoxLauncher.DlcDialog(this)) return;
|
||||||
Hide();
|
Hide();
|
||||||
using InstallForm installForm = new(this, uninstall);
|
using InstallForm installForm = new(this, uninstall);
|
||||||
installForm.ShowDialog();
|
_ = installForm.ShowDialog();
|
||||||
if (installForm.Reselecting)
|
if (installForm.Reselecting)
|
||||||
{
|
{
|
||||||
InheritLocation(installForm);
|
InheritLocation(installForm);
|
||||||
|
@ -795,15 +797,15 @@ internal partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
StringBuilder blockedGames = new();
|
StringBuilder blockedGames = new();
|
||||||
foreach (string name in Program.ProtectedGames)
|
foreach (string name in Program.ProtectedGames)
|
||||||
blockedGames.Append(helpButtonListPrefix + name);
|
_ = blockedGames.Append(helpButtonListPrefix + name);
|
||||||
StringBuilder blockedDirectories = new();
|
StringBuilder blockedDirectories = new();
|
||||||
foreach (string path in Program.ProtectedGameDirectories)
|
foreach (string path in Program.ProtectedGameDirectories)
|
||||||
blockedDirectories.Append(helpButtonListPrefix + path);
|
_ = blockedDirectories.Append(helpButtonListPrefix + path);
|
||||||
StringBuilder blockedDirectoryExceptions = new();
|
StringBuilder blockedDirectoryExceptions = new();
|
||||||
foreach (string name in Program.ProtectedGameDirectoryExceptions)
|
foreach (string name in Program.ProtectedGameDirectoryExceptions)
|
||||||
blockedDirectoryExceptions.Append(helpButtonListPrefix + name);
|
_ = blockedDirectoryExceptions.Append(helpButtonListPrefix + name);
|
||||||
using DialogForm form = new(this);
|
using DialogForm form = new(this);
|
||||||
form.Show(SystemIcons.Information,
|
_ = form.Show(SystemIcons.Information,
|
||||||
"Blocks the program from caching and displaying games protected by DLL checks," +
|
"Blocks the program from caching and displaying games protected by DLL checks," +
|
||||||
"\nanti-cheats, or that are confirmed not to be working with SmokeAPI or ScreamAPI." +
|
"\nanti-cheats, or that are confirmed not to be working with SmokeAPI or ScreamAPI." +
|
||||||
"\n\nBlocked games:" + blockedGames +
|
"\n\nBlocked games:" + blockedGames +
|
||||||
|
@ -812,3 +814,5 @@ internal partial class SelectForm : CustomForm
|
||||||
"OK", customFormText: "Block Protected Games");
|
"OK", customFormText: "Block Protected Games");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning restore IDE0058
|
|
@ -1,14 +1,14 @@
|
||||||
using System.Drawing;
|
using CreamInstaller.Resources;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using CreamInstaller.Resources;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
using static CreamInstaller.Resources.Resources;
|
using static CreamInstaller.Resources.Resources;
|
||||||
|
|
||||||
namespace CreamInstaller.Paradox;
|
namespace CreamInstaller.Paradox;
|
||||||
|
@ -97,7 +97,7 @@ internal static class ParadoxLauncher
|
||||||
if (steamOriginalSdk64 is null && File.Exists(sdk64) && !sdk64.IsResourceFile(ResourceIdentifier.Steamworks64))
|
if (steamOriginalSdk64 is null && File.Exists(sdk64) && !sdk64.IsResourceFile(ResourceIdentifier.Steamworks64))
|
||||||
steamOriginalSdk64 = File.ReadAllBytes(sdk64);
|
steamOriginalSdk64 = File.ReadAllBytes(sdk64);
|
||||||
|
|
||||||
directory.GetScreamApiComponents(out sdk32, out _, out sdk64, out _, out config, out _);
|
directory.GetScreamApiComponents(out sdk32, out _, out sdk64, out _, out config);
|
||||||
screamConfig = screamConfig || File.Exists(config);
|
screamConfig = screamConfig || File.Exists(config);
|
||||||
await InstallForm.UninstallScreamAPI(directory, deleteConfig: false);
|
await InstallForm.UninstallScreamAPI(directory, deleteConfig: false);
|
||||||
if (epicOriginalSdk32 is null && File.Exists(sdk32) && !sdk32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
if (epicOriginalSdk32 is null && File.Exists(sdk32) && !sdk32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
||||||
|
@ -129,7 +129,7 @@ internal static class ParadoxLauncher
|
||||||
if (smokeConfig)
|
if (smokeConfig)
|
||||||
await InstallForm.InstallSmokeAPI(directory, selection, generateConfig: false);
|
await InstallForm.InstallSmokeAPI(directory, selection, generateConfig: false);
|
||||||
|
|
||||||
directory.GetScreamApiComponents(out sdk32, out _, out sdk64, out _, out _, out _);
|
directory.GetScreamApiComponents(out sdk32, out _, out sdk64, out _, out _);
|
||||||
if (epicOriginalSdk32 is not null && sdk32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
if (epicOriginalSdk32 is not null && sdk32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
||||||
{
|
{
|
||||||
epicOriginalSdk32.Write(sdk32);
|
epicOriginalSdk32.Write(sdk32);
|
||||||
|
@ -152,7 +152,7 @@ internal static class ParadoxLauncher
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser("Paradox Launcher successfully repaired!", InstallationLog.Success);
|
installForm.UpdateUser("Paradox Launcher successfully repaired!", InstallationLog.Success);
|
||||||
else
|
else
|
||||||
dialogForm.Show(form.Icon, "Paradox Launcher successfully repaired!", "OK", customFormText: "Paradox Launcher");
|
_ = dialogForm.Show(form.Icon, "Paradox Launcher successfully repaired!", "OK", customFormText: "Paradox Launcher");
|
||||||
return RepairResult.Success;
|
return RepairResult.Success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -160,18 +160,17 @@ internal static class ParadoxLauncher
|
||||||
if (installForm is not null)
|
if (installForm is not null)
|
||||||
installForm.UpdateUser("Paradox Launcher did not need to be repaired.", InstallationLog.Success);
|
installForm.UpdateUser("Paradox Launcher did not need to be repaired.", InstallationLog.Success);
|
||||||
else
|
else
|
||||||
dialogForm.Show(SystemIcons.Information, "Paradox Launcher does not need to be repaired.", "OK", customFormText: "Paradox Launcher");
|
_ = dialogForm.Show(SystemIcons.Information, "Paradox Launcher does not need to be repaired.", "OK", customFormText: "Paradox Launcher");
|
||||||
return RepairResult.Unnecessary;
|
return RepairResult.Unnecessary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (form is InstallForm)
|
_ = form is InstallForm
|
||||||
throw new CustomMessageException("Repair failed! " +
|
? throw new CustomMessageException("Repair failed! " +
|
||||||
"An original Steamworks/Epic Online Services SDK file could not be found. " +
|
"An original Steamworks/Epic Online Services SDK file could not be found. " +
|
||||||
"You will likely have to reinstall Paradox Launcher to fix this issue.");
|
"You will likely have to reinstall Paradox Launcher to fix this issue.")
|
||||||
else
|
: dialogForm.Show(SystemIcons.Error, "Paradox Launcher repair failed!"
|
||||||
dialogForm.Show(SystemIcons.Error, "Paradox Launcher repair failed!"
|
|
||||||
+ "\n\nAn original Steamworks/Epic Online Services SDK file could not be found."
|
+ "\n\nAn original Steamworks/Epic Online Services SDK file could not be found."
|
||||||
+ "\nYou will likely have to reinstall Paradox Launcher to fix this issue.", "OK", customFormText: "Paradox Launcher");
|
+ "\nYou will likely have to reinstall Paradox Launcher to fix this issue.", "OK", customFormText: "Paradox Launcher");
|
||||||
return RepairResult.Failure;
|
return RepairResult.Failure;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
using CreamInstaller.Steam;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
@ -7,9 +10,6 @@ using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using CreamInstaller.Steam;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
namespace CreamInstaller;
|
namespace CreamInstaller;
|
||||||
|
|
||||||
internal static class Program
|
internal static class Program
|
||||||
|
@ -62,14 +62,14 @@ internal static class Program
|
||||||
using Mutex mutex = new(true, "CreamInstaller", out bool createdNew);
|
using Mutex mutex = new(true, "CreamInstaller", out bool createdNew);
|
||||||
if (createdNew)
|
if (createdNew)
|
||||||
{
|
{
|
||||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
_ = Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.ApplicationExit += new(OnApplicationExit);
|
Application.ApplicationExit += new(OnApplicationExit);
|
||||||
Application.ThreadException += new((s, e) => e.Exception?.HandleFatalException());
|
Application.ThreadException += new((s, e) => e.Exception?.HandleFatalException());
|
||||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||||
AppDomain.CurrentDomain.UnhandledException += new((s, e) => (e.ExceptionObject as Exception)?.HandleFatalException());
|
AppDomain.CurrentDomain.UnhandledException += new((s, e) => (e.ExceptionObject as Exception)?.HandleFatalException());
|
||||||
retry:
|
retry:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpClientManager.Setup();
|
HttpClientManager.Setup();
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Collections.Generic;
|
using CreamInstaller.Components;
|
||||||
|
using CreamInstaller.Resources;
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using CreamInstaller.Components;
|
|
||||||
using CreamInstaller.Resources;
|
|
||||||
|
|
||||||
namespace CreamInstaller;
|
namespace CreamInstaller;
|
||||||
|
|
||||||
public enum DlcType
|
public enum DlcType
|
||||||
|
@ -56,13 +56,12 @@ internal class ProgramSelection
|
||||||
|| config.IsFilePathLocked()
|
|| config.IsFilePathLocked()
|
||||||
|| cache.IsFilePathLocked())
|
|| cache.IsFilePathLocked())
|
||||||
return true;
|
return true;
|
||||||
directory.GetScreamApiComponents(out sdk32, out sdk32_o, out sdk64, out sdk64_o, out config, out cache);
|
directory.GetScreamApiComponents(out sdk32, out sdk32_o, out sdk64, out sdk64_o, out config);
|
||||||
if (sdk32.IsFilePathLocked()
|
if (sdk32.IsFilePathLocked()
|
||||||
|| sdk32_o.IsFilePathLocked()
|
|| sdk32_o.IsFilePathLocked()
|
||||||
|| sdk64.IsFilePathLocked()
|
|| sdk64.IsFilePathLocked()
|
||||||
|| sdk64_o.IsFilePathLocked()
|
|| sdk64_o.IsFilePathLocked()
|
||||||
|| config.IsFilePathLocked()
|
|| config.IsFilePathLocked())
|
||||||
|| cache.IsFilePathLocked())
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -72,7 +71,7 @@ internal class ProgramSelection
|
||||||
private void Toggle(string dlcAppId, (DlcType type, string name, string icon) dlcApp, bool enabled)
|
private void Toggle(string dlcAppId, (DlcType type, string name, string icon) dlcApp, bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled) SelectedDlc[dlcAppId] = dlcApp;
|
if (enabled) SelectedDlc[dlcAppId] = dlcApp;
|
||||||
else SelectedDlc.Remove(dlcAppId);
|
else _ = SelectedDlc.Remove(dlcAppId);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ToggleDlc(string dlcId, bool enabled)
|
internal void ToggleDlc(string dlcId, bool enabled)
|
||||||
|
@ -96,23 +95,23 @@ internal class ProgramSelection
|
||||||
{
|
{
|
||||||
if (Program.IsGameBlocked(Name, RootDirectory))
|
if (Program.IsGameBlocked(Name, RootDirectory))
|
||||||
{
|
{
|
||||||
All.Remove(this);
|
_ = All.Remove(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Directory.Exists(RootDirectory))
|
if (!Directory.Exists(RootDirectory))
|
||||||
{
|
{
|
||||||
All.Remove(this);
|
_ = All.Remove(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DllDirectories.RemoveAll(directory => !Directory.Exists(directory));
|
_ = DllDirectories.RemoveAll(directory => !Directory.Exists(directory));
|
||||||
if (!DllDirectories.Any()) All.Remove(this);
|
if (!DllDirectories.Any()) _ = All.Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Validate(List<(string platform, string id, string name)> programsToScan)
|
internal void Validate(List<(string platform, string id, string name)> programsToScan)
|
||||||
{
|
{
|
||||||
if (programsToScan is null || !programsToScan.Any(p => p.id == Id))
|
if (programsToScan is null || !programsToScan.Any(p => p.id == Id))
|
||||||
{
|
{
|
||||||
All.Remove(this);
|
_ = All.Remove(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Validate();
|
Validate();
|
||||||
|
|
|
@ -31,7 +31,11 @@ internal static class Resources
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void GetCreamApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config)
|
internal static void GetCreamApiComponents(
|
||||||
|
this string directory,
|
||||||
|
out string sdk32, out string sdk32_o,
|
||||||
|
out string sdk64, out string sdk64_o,
|
||||||
|
out string config)
|
||||||
{
|
{
|
||||||
sdk32 = directory + @"\steam_api.dll";
|
sdk32 = directory + @"\steam_api.dll";
|
||||||
sdk32_o = directory + @"\steam_api_o.dll";
|
sdk32_o = directory + @"\steam_api_o.dll";
|
||||||
|
@ -40,7 +44,12 @@ internal static class Resources
|
||||||
config = directory + @"\cream_api.ini";
|
config = directory + @"\cream_api.ini";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void GetSmokeApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config, out string cache)
|
internal static void GetSmokeApiComponents(
|
||||||
|
this string directory,
|
||||||
|
out string sdk32, out string sdk32_o,
|
||||||
|
out string sdk64, out string sdk64_o,
|
||||||
|
out string config,
|
||||||
|
out string cache)
|
||||||
{
|
{
|
||||||
sdk32 = directory + @"\steam_api.dll";
|
sdk32 = directory + @"\steam_api.dll";
|
||||||
sdk32_o = directory + @"\steam_api_o.dll";
|
sdk32_o = directory + @"\steam_api_o.dll";
|
||||||
|
@ -50,14 +59,48 @@ internal static class Resources
|
||||||
cache = directory + @"\SmokeAPI.cache.json";
|
cache = directory + @"\SmokeAPI.cache.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void GetScreamApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config, out string cache)
|
internal static void GetScreamApiComponents(
|
||||||
|
this string directory,
|
||||||
|
out string sdk32, out string sdk32_o,
|
||||||
|
out string sdk64, out string sdk64_o,
|
||||||
|
out string config
|
||||||
|
)
|
||||||
{
|
{
|
||||||
sdk32 = directory + @"\EOSSDK-Win32-Shipping.dll";
|
sdk32 = directory + @"\EOSSDK-Win32-Shipping.dll";
|
||||||
sdk32_o = directory + @"\EOSSDK-Win32-Shipping_o.dll";
|
sdk32_o = directory + @"\EOSSDK-Win32-Shipping_o.dll";
|
||||||
sdk64 = directory + @"\EOSSDK-Win64-Shipping.dll";
|
sdk64 = directory + @"\EOSSDK-Win64-Shipping.dll";
|
||||||
sdk64_o = directory + @"\EOSSDK-Win64-Shipping_o.dll";
|
sdk64_o = directory + @"\EOSSDK-Win64-Shipping_o.dll";
|
||||||
config = directory + @"\ScreamAPI.json";
|
config = directory + @"\ScreamAPI.json";
|
||||||
cache = directory + @"\ScreamAPI.cache.json";
|
}
|
||||||
|
|
||||||
|
internal static void GetUplayR1Components(
|
||||||
|
this string directory,
|
||||||
|
out string sdk32, out string sdk32_o,
|
||||||
|
out string sdk64, out string sdk64_o,
|
||||||
|
out string config
|
||||||
|
)
|
||||||
|
{
|
||||||
|
sdk32 = directory + @"\uplay_r1_loader.dll";
|
||||||
|
sdk32_o = directory + @"\uplay_r1_loader_o.dll";
|
||||||
|
sdk64 = directory + @"\uplay_r1_loader64.dll";
|
||||||
|
sdk64_o = directory + @"\uplay_r1_loader64_o.dll";
|
||||||
|
config = directory + @"\UplayR1Unlocker.jsonc";
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void GetUplayR2Components(
|
||||||
|
this string directory,
|
||||||
|
out string old_sdk32, out string old_sdk64,
|
||||||
|
out string sdk32, out string sdk32_o,
|
||||||
|
out string sdk64, out string sdk64_o,
|
||||||
|
out string config)
|
||||||
|
{
|
||||||
|
old_sdk32 = directory + @"\uplay_r2_loader.dll";
|
||||||
|
old_sdk64 = directory + @"\uplay_r2_loader64.dll";
|
||||||
|
sdk32 = directory + @"\upc_r2_loader.dll";
|
||||||
|
sdk32_o = directory + @"\upc_r2_loader_o.dll";
|
||||||
|
sdk64 = directory + @"\upc_r2_loader64.dll";
|
||||||
|
sdk64_o = directory + @"\upc_r2_loader64_o.dll";
|
||||||
|
config = directory + @"\UplayR2Unlocker.jsonc";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ResourceIdentifier
|
public enum ResourceIdentifier
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
using System;
|
using CreamInstaller.Resources;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using Gameloop.Vdf.Linq;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
@ -10,11 +15,6 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using CreamInstaller.Resources;
|
|
||||||
using CreamInstaller.Utility;
|
|
||||||
|
|
||||||
using Gameloop.Vdf.Linq;
|
|
||||||
|
|
||||||
namespace CreamInstaller.Steam;
|
namespace CreamInstaller.Steam;
|
||||||
|
|
||||||
internal static class SteamCMD
|
internal static class SteamCMD
|
||||||
|
@ -34,7 +34,7 @@ internal static class SteamCMD
|
||||||
private static readonly int[] locks = new int[ProcessLimit];
|
private static readonly int[] locks = new int[ProcessLimit];
|
||||||
internal static async Task<string> Run(string appId) => await Task.Run(() =>
|
internal static async Task<string> Run(string appId) => await Task.Run(() =>
|
||||||
{
|
{
|
||||||
wait_for_lock:
|
wait_for_lock:
|
||||||
if (Program.Canceled) return "";
|
if (Program.Canceled) return "";
|
||||||
Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
for (int i = 0; i < locks.Length; i++)
|
for (int i = 0; i < locks.Length; i++)
|
||||||
|
@ -84,8 +84,7 @@ internal static class SteamCMD
|
||||||
lastOutput = DateTime.UtcNow;
|
lastOutput = DateTime.UtcNow;
|
||||||
char ch = (char)c;
|
char ch = (char)c;
|
||||||
if (ch == '{') appInfoStarted = true;
|
if (ch == '{') appInfoStarted = true;
|
||||||
if (appInfoStarted) appInfo.Append(ch);
|
_ = appInfoStarted ? appInfo.Append(ch) : output.Append(ch);
|
||||||
else output.Append(ch);
|
|
||||||
}
|
}
|
||||||
DateTime now = DateTime.UtcNow;
|
DateTime now = DateTime.UtcNow;
|
||||||
TimeSpan timeDiff = now - lastOutput;
|
TimeSpan timeDiff = now - lastOutput;
|
||||||
|
@ -99,13 +98,13 @@ internal static class SteamCMD
|
||||||
processStartInfo.Arguments = GetArguments(appId);
|
processStartInfo.Arguments = GetArguments(appId);
|
||||||
process = Process.Start(processStartInfo);
|
process = Process.Start(processStartInfo);
|
||||||
appInfoStarted = false;
|
appInfoStarted = false;
|
||||||
output.Clear();
|
_ = output.Clear();
|
||||||
appInfo.Clear();
|
_ = appInfo.Clear();
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Interlocked.Decrement(ref locks[i]);
|
_ = Interlocked.Decrement(ref locks[i]);
|
||||||
return appInfo.ToString();
|
return appInfo.ToString();
|
||||||
}
|
}
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
|
@ -142,7 +141,7 @@ internal static class SteamCMD
|
||||||
int cur = 0;
|
int cur = 0;
|
||||||
progress.Report(cur);
|
progress.Report(cur);
|
||||||
watcher.Changed += (sender, e) => progress.Report(++cur);
|
watcher.Changed += (sender, e) => progress.Report(++cur);
|
||||||
await Run(null);
|
_ = await Run(null);
|
||||||
watcher.Dispose();
|
watcher.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +186,7 @@ internal static class SteamCMD
|
||||||
if (Program.Canceled) return null;
|
if (Program.Canceled) return null;
|
||||||
string output;
|
string output;
|
||||||
string appUpdateFile = $@"{AppInfoPath}\{appId}.vdf";
|
string appUpdateFile = $@"{AppInfoPath}\{appId}.vdf";
|
||||||
restart:
|
restart:
|
||||||
if (Program.Canceled) return null;
|
if (Program.Canceled) return null;
|
||||||
if (File.Exists(appUpdateFile)) output = File.ReadAllText(appUpdateFile, Encoding.UTF8);
|
if (File.Exists(appUpdateFile)) output = File.ReadAllText(appUpdateFile, Encoding.UTF8);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
using System.Collections.Generic;
|
using CreamInstaller.Resources;
|
||||||
|
|
||||||
|
using Gameloop.Vdf.Linq;
|
||||||
|
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using CreamInstaller.Resources;
|
|
||||||
|
|
||||||
using Gameloop.Vdf.Linq;
|
|
||||||
|
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace CreamInstaller.Steam;
|
namespace CreamInstaller.Steam;
|
||||||
|
|
||||||
internal static class SteamLibrary
|
internal static class SteamLibrary
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
using System.Collections.Generic;
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using CreamInstaller.Utility;
|
#if DEBUG
|
||||||
|
using System;
|
||||||
using Newtonsoft.Json;
|
using System.Drawing;
|
||||||
using Newtonsoft.Json.Linq;
|
#endif
|
||||||
|
|
||||||
namespace CreamInstaller.Steam;
|
namespace CreamInstaller.Steam;
|
||||||
|
|
||||||
|
@ -34,7 +39,7 @@ internal static class SteamStore
|
||||||
string response = await HttpClientManager.EnsureGet($"https://store.steampowered.com/api/appdetails?appids={appId}");
|
string response = await HttpClientManager.EnsureGet($"https://store.steampowered.com/api/appdetails?appids={appId}");
|
||||||
if (response is not null)
|
if (response is not null)
|
||||||
{
|
{
|
||||||
IDictionary<string, JToken> apps = JsonConvert.DeserializeObject(response) as dynamic;
|
IDictionary<string, JToken> apps = (IDictionary<string, JToken>)JsonConvert.DeserializeObject(response);
|
||||||
if (apps is not null)
|
if (apps is not null)
|
||||||
foreach (KeyValuePair<string, JToken> app in apps)
|
foreach (KeyValuePair<string, JToken> app in apps)
|
||||||
{
|
{
|
||||||
|
@ -47,19 +52,29 @@ internal static class SteamStore
|
||||||
{
|
{
|
||||||
File.WriteAllText(cacheFile, JsonConvert.SerializeObject(data, Formatting.Indented));
|
File.WriteAllText(cacheFile, JsonConvert.SerializeObject(data, Formatting.Indented));
|
||||||
}
|
}
|
||||||
catch //(Exception e)
|
catch
|
||||||
|
#if DEBUG
|
||||||
|
(Exception e)
|
||||||
{
|
{
|
||||||
//using DialogForm dialogForm = new(null);
|
using DialogForm dialogForm = new(null);
|
||||||
//dialogForm.Show(SystemIcons.Error, "Unsuccessful serialization of query for appid " + appId + ":\n\n" + e.ToString(), "FUCK");
|
dialogForm.Show(SystemIcons.Error, "Unsuccessful serialization of query for appid " + appId + ":\n\n" + e.ToString());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{ }
|
||||||
|
#endif
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch //(Exception e)
|
catch
|
||||||
|
#if DEBUG
|
||||||
|
(Exception e)
|
||||||
{
|
{
|
||||||
//using DialogForm dialogForm = new(null);
|
using DialogForm dialogForm = new(null);
|
||||||
//dialogForm.Show(SystemIcons.Error, "Unsuccessful deserialization of query for appid " + appId + ":\n\n" + e.ToString(), "FUCK");
|
dialogForm.Show(SystemIcons.Error, "Unsuccessful deserialization of query for appid " + appId + ":\n\n" + e.ToString());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{ }
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace CreamInstaller.Utility;
|
namespace CreamInstaller.Utility;
|
||||||
|
|
||||||
internal static class Diagnostics
|
internal static class Diagnostics
|
||||||
|
|
|
@ -15,7 +15,7 @@ internal static class ExceptionHandler
|
||||||
string[] stackTrace = e.StackTrace?.Split('\n');
|
string[] stackTrace = e.StackTrace?.Split('\n');
|
||||||
if (stackTrace is not null && stackTrace.Length > 0)
|
if (stackTrace is not null && stackTrace.Length > 0)
|
||||||
{
|
{
|
||||||
output.Append("STACK TRACE\n");
|
_ = output.Append("STACK TRACE\n");
|
||||||
for (int i = 0; i < Math.Min(stackTrace.Length, 3); i++)
|
for (int i = 0; i < Math.Min(stackTrace.Length, 3); i++)
|
||||||
{
|
{
|
||||||
string line = stackTrace[i];
|
string line = stackTrace[i];
|
||||||
|
@ -24,7 +24,7 @@ internal static class ExceptionHandler
|
||||||
int ciNum = line.LastIndexOf(@"CreamInstaller\");
|
int ciNum = line.LastIndexOf(@"CreamInstaller\");
|
||||||
int lineNum = line.LastIndexOf(":line ");
|
int lineNum = line.LastIndexOf(":line ");
|
||||||
if (line is not null && atNum != -1)
|
if (line is not null && atNum != -1)
|
||||||
output.Append("\n " + (inNum != -1 ? line[atNum..(inNum - 1)] : line[atNum..])
|
_ = output.Append("\n " + (inNum != -1 ? line[atNum..(inNum - 1)] : line[atNum..])
|
||||||
+ (inNum != -1 ? ("\n "
|
+ (inNum != -1 ? ("\n "
|
||||||
+ (ciNum != -1 ? ("in "
|
+ (ciNum != -1 ? ("in "
|
||||||
+ (lineNum != -1 ? line[ciNum..lineNum]
|
+ (lineNum != -1 ? line[ciNum..lineNum]
|
||||||
|
@ -38,13 +38,13 @@ internal static class ExceptionHandler
|
||||||
if (messageLines is not null && messageLines.Length > 0)
|
if (messageLines is not null && messageLines.Length > 0)
|
||||||
{
|
{
|
||||||
if (output.Length > 0)
|
if (output.Length > 0)
|
||||||
output.Append("\n\n");
|
_ = output.Append("\n\n");
|
||||||
output.Append("MESSAGE\n");
|
_ = output.Append("MESSAGE\n");
|
||||||
for (int i = 0; i < messageLines.Length; i++)
|
for (int i = 0; i < messageLines.Length; i++)
|
||||||
{
|
{
|
||||||
string line = messageLines[i];
|
string line = messageLines[i];
|
||||||
if (line is not null)
|
if (line is not null)
|
||||||
output.Append("\n " + line);
|
_ = output.Append("\n " + line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
using DialogForm dialogForm = new(form ?? Form.ActiveForm);
|
using DialogForm dialogForm = new(form ?? Form.ActiveForm);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
using System;
|
using HtmlAgilityPack;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using HtmlAgilityPack;
|
|
||||||
|
|
||||||
namespace CreamInstaller.Utility;
|
namespace CreamInstaller.Utility;
|
||||||
|
|
||||||
internal static class HttpClientManager
|
internal static class HttpClientManager
|
||||||
|
@ -23,7 +23,7 @@ internal static class HttpClientManager
|
||||||
{
|
{
|
||||||
using HttpRequestMessage request = new(HttpMethod.Get, url);
|
using HttpRequestMessage request = new(HttpMethod.Get, url);
|
||||||
using HttpResponseMessage response = await HttpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
using HttpResponseMessage response = await HttpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
|
||||||
response.EnsureSuccessStatusCode();
|
_ = response.EnsureSuccessStatusCode();
|
||||||
return await response.Content.ReadAsStringAsync();
|
return await response.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
|
@ -29,15 +29,15 @@ internal static class ProgramData
|
||||||
if (Directory.Exists(DirectoryPath)) Directory.Delete(DirectoryPath, true);
|
if (Directory.Exists(DirectoryPath)) Directory.Delete(DirectoryPath, true);
|
||||||
Directory.Move(DirectoryPathOld, DirectoryPath);
|
Directory.Move(DirectoryPathOld, DirectoryPath);
|
||||||
}
|
}
|
||||||
if (!Directory.Exists(DirectoryPath)) Directory.CreateDirectory(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 (!File.Exists(AppInfoVersionPath) || !Version.TryParse(File.ReadAllText(AppInfoVersionPath, Encoding.UTF8), out Version version) || version < MinimumAppInfoVersion)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(AppInfoPath)) Directory.Delete(AppInfoPath, true);
|
if (Directory.Exists(AppInfoPath)) Directory.Delete(AppInfoPath, true);
|
||||||
Directory.CreateDirectory(AppInfoPath);
|
_ = Directory.CreateDirectory(AppInfoPath);
|
||||||
File.WriteAllText(AppInfoVersionPath, Application.ProductVersion, Encoding.UTF8);
|
File.WriteAllText(AppInfoVersionPath, Application.ProductVersion, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
if (!Directory.Exists(CooldownPath))
|
if (!Directory.Exists(CooldownPath))
|
||||||
Directory.CreateDirectory(CooldownPath);
|
_ = Directory.CreateDirectory(CooldownPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
internal static bool CheckCooldown(string identifier, int cooldown)
|
internal static bool CheckCooldown(string identifier, int cooldown)
|
||||||
|
@ -69,7 +69,7 @@ internal static class ProgramData
|
||||||
private static void SetCooldown(string identifier, DateTime time)
|
private static void SetCooldown(string identifier, DateTime time)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(CooldownPath))
|
if (!Directory.Exists(CooldownPath))
|
||||||
Directory.CreateDirectory(CooldownPath);
|
_ = Directory.CreateDirectory(CooldownPath);
|
||||||
string cooldownFile = CooldownPath + @$"\{identifier}.txt";
|
string cooldownFile = CooldownPath + @$"\{identifier}.txt";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue