some refactoring

This commit is contained in:
pointfeev 2023-01-29 20:12:30 -05:00
parent 2253cf973a
commit d2dfc7b95a
7 changed files with 13 additions and 44 deletions

View file

@ -195,7 +195,7 @@ internal sealed class CustomTreeView : TreeView
_ = comboBoxBounds.Remove(pair.Key); _ = comboBoxBounds.Remove(pair.Key);
else if (pair.Value.Contains(clickPoint)) else if (pair.Value.Contains(clickPoint))
{ {
List<string> proxies = EmbeddedResources.FindAll(r => r.StartsWith("Koaloader")).Select(p => List<string> proxies = EmbeddedResources.FindAll(r => r.StartsWith("Koaloader", StringComparison.Ordinal)).Select(p =>
{ {
p.GetProxyInfoFromIdentifier(out string proxyName, out _); p.GetProxyInfoFromIdentifier(out string proxyName, out _);
return proxyName; return proxyName;

View file

@ -769,30 +769,9 @@ internal sealed partial class SelectForm : CustomForm
items.Add(query); items.Add(query);
items.Add(new ContextMenuItem("Refresh Queries", "Command Prompt", (_, _) => items.Add(new ContextMenuItem("Refresh Queries", "Command Prompt", (_, _) =>
{ {
try appInfoVDF.Delete();
{ appInfoJSON.Delete();
appInfoVDF.Delete(); cooldown.Delete();
}
catch
{
// ignored
}
try
{
appInfoJSON.Delete();
}
catch
{
// ignored
}
try
{
cooldown.Delete();
}
catch
{
// ignored
}
OnLoad(true); OnLoad(true);
})); }));
} }

View file

@ -1,13 +0,0 @@
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("CodeQuality", "IDE0076:Invalid global 'SuppressMessageAttribute'")]
[assembly: SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression")]
[assembly: SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters")]
[assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider")]
[assembly: SuppressMessage("Globalization", "CA1307:Specify StringComparison for clarity")]
[assembly: SuppressMessage("Globalization", "CA1310:Specify StringComparison for correctness")]
[assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types")]
[assembly: SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
@ -21,7 +22,7 @@ internal static class EpicLibrary
epicManifestsPath ??= Registry.GetValue(@"HKEY_CURRENT_USER\Software\Wow6432Node\Epic Games\EOS", "ModSdkMetadataDir", null) as string; epicManifestsPath ??= Registry.GetValue(@"HKEY_CURRENT_USER\Software\Wow6432Node\Epic Games\EOS", "ModSdkMetadataDir", null) as string;
epicManifestsPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string; epicManifestsPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string;
epicManifestsPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string; epicManifestsPath ??= Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Epic Games\EpicGamesLauncher", "AppDataPath", null) as string;
if (epicManifestsPath is not null && epicManifestsPath.EndsWith(@"\Data")) if (epicManifestsPath is not null && epicManifestsPath.EndsWith(@"\Data", StringComparison.Ordinal))
epicManifestsPath += @"\Manifests"; epicManifestsPath += @"\Manifests";
return epicManifestsPath.BeautifyPath(); return epicManifestsPath.BeautifyPath();
} }

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -23,7 +24,7 @@ internal static class SteamStore
List<string> dlcIds = new(); List<string> dlcIds = new();
if (appData.dlc is null) if (appData.dlc is null)
return dlcIds; return dlcIds;
dlcIds.AddRange(from appId in appData.dlc where appId > 0 select appId.ToString()); dlcIds.AddRange(from appId in appData.dlc where appId > 0 select appId.ToString(CultureInfo.InvariantCulture));
return dlcIds; return dlcIds;
}); });

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -37,7 +38,7 @@ internal static class Koaloader
private static void WriteProxy(this string path, string proxyName, BinaryType binaryType) private static void WriteProxy(this string path, string proxyName, BinaryType binaryType)
{ {
foreach (string resourceIdentifier in EmbeddedResources.FindAll(r => r.StartsWith("Koaloader"))) foreach (string resourceIdentifier in EmbeddedResources.FindAll(r => r.StartsWith("Koaloader", StringComparison.Ordinal)))
{ {
resourceIdentifier.GetProxyInfoFromIdentifier(out string _proxyName, out BinaryType _binaryType); resourceIdentifier.GetProxyInfoFromIdentifier(out string _proxyName, out BinaryType _binaryType);
if (_proxyName != proxyName || _binaryType != binaryType) if (_proxyName != proxyName || _binaryType != binaryType)

View file

@ -431,7 +431,7 @@ internal static class Resources
return embeddedResources; return embeddedResources;
string[] names = Assembly.GetExecutingAssembly().GetManifestResourceNames(); string[] names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
embeddedResources = new(); embeddedResources = new();
foreach (string resourceName in names.Where(n => n.StartsWith("CreamInstaller.Resources."))) foreach (string resourceName in names.Where(n => n.StartsWith("CreamInstaller.Resources.", StringComparison.Ordinal)))
embeddedResources.Add(resourceName[25..]); embeddedResources.Add(resourceName[25..]);
return embeddedResources; return embeddedResources;
} }