RuntimeCompatibility -> Compatibility

This commit is contained in:
JustArchi 2021-05-08 01:43:08 +02:00
parent e60b54e402
commit d21d2473fe
35 changed files with 46 additions and 46 deletions

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Generic;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
using File = System.IO.File;
using Path = System.IO.Path;
#else
@ -86,7 +86,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
GlobalCache? globalCache;
try {
string json = await RuntimeCompatibility.File.ReadAllTextAsync(SharedFilePath).ConfigureAwait(false);
string json = await Compatibility.File.ReadAllTextAsync(SharedFilePath).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(json)));

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Concurrent;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Generic;

View file

@ -22,7 +22,7 @@
using System.Threading.Tasks;
using JetBrains.Annotations;
namespace ArchiSteamFarm.RuntimeCompatibility {
namespace ArchiSteamFarm.Compatibility {
[PublicAPI]
public static class File {
public static Task AppendAllTextAsync(string path, string contents) {

View file

@ -21,7 +21,7 @@
using JetBrains.Annotations;
namespace ArchiSteamFarm.RuntimeCompatibility {
namespace ArchiSteamFarm.Compatibility {
[PublicAPI]
public static class HashCode {
public static int Combine<T1, T2, T3>(T1 value1, T2 value2, T3 value3) =>

View file

@ -25,7 +25,7 @@ using System.Text;
#endif
using JetBrains.Annotations;
namespace ArchiSteamFarm.RuntimeCompatibility {
namespace ArchiSteamFarm.Compatibility {
[PublicAPI]
public static class Path {
public static string GetRelativePath(string relativeTo, string path) {

View file

@ -24,7 +24,7 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace ArchiSteamFarm.RuntimeCompatibility {
namespace ArchiSteamFarm.Compatibility {
internal static class PathInternalNetCore {
private const string ExtendedDevicePathPrefix = @"\\?\";
private const string UncExtendedPathPrefix = @"\\?\UNC\";

View file

@ -34,7 +34,7 @@ using System;
using System.Diagnostics;
using JetBrains.Annotations;
namespace ArchiSteamFarm.RuntimeCompatibility {
namespace ArchiSteamFarm.Compatibility {
[PublicAPI]
public static class StaticHelpers {
#if NETFRAMEWORK

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
using File = System.IO.File;
using Path = System.IO.Path;
#endif
@ -212,7 +212,7 @@ namespace ArchiSteamFarm.Core {
return false;
}
return RuntimeCompatibility.Path.GetRelativePath(".", botName) == botName;
return Compatibility.Path.GetRelativePath(".", botName) == botName;
}
internal static async Task RestartOrExit() {
@ -951,7 +951,7 @@ namespace ArchiSteamFarm.Core {
return false;
}
string relativeFilePath = RuntimeCompatibility.Path.GetRelativePath(targetDirectory, file);
string relativeFilePath = Compatibility.Path.GetRelativePath(targetDirectory, file);
if (string.IsNullOrEmpty(relativeFilePath)) {
ArchiLogger.LogNullError(nameof(relativeFilePath));
@ -996,7 +996,7 @@ namespace ArchiSteamFarm.Core {
Directory.CreateDirectory(targetBackupDirectory);
string targetBackupFile = Path.Combine(targetBackupDirectory, fileName);
RuntimeCompatibility.File.Move(file, targetBackupFile, true);
Compatibility.File.Move(file, targetBackupFile, true);
}
// We can now get rid of directories that are empty
@ -1017,7 +1017,7 @@ namespace ArchiSteamFarm.Core {
if (File.Exists(file)) {
// This is possible only with files that we decided to leave in place during our backup function
string targetBackupFile = file + ".bak";
RuntimeCompatibility.File.Move(file, targetBackupFile, true);
Compatibility.File.Move(file, targetBackupFile, true);
}
// Check if this file requires its own folder

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
using File = System.IO.File;
#endif
using System;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Generic;

View file

@ -22,8 +22,8 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using ArchiSteamFarm.Compatibility;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.RuntimeCompatibility;
using Newtonsoft.Json;
namespace ArchiSteamFarm.Helpers {

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
using File = System.IO.File;
using Path = System.IO.Path;
#else
@ -95,7 +95,7 @@ namespace ArchiSteamFarm.IPC {
if (customConfigExists) {
if (Debugging.IsDebugConfigured) {
try {
string json = await RuntimeCompatibility.File.ReadAllTextAsync(customConfigPath).ConfigureAwait(false);
string json = await Compatibility.File.ReadAllTextAsync(customConfigPath).ConfigureAwait(false);
if (!string.IsNullOrEmpty(json)) {
JObject jObject = JObject.Parse(json);

View file

@ -25,11 +25,11 @@ using System.Globalization;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using ArchiSteamFarm.Compatibility;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.IPC.Requests;
using ArchiSteamFarm.IPC.Responses;
using ArchiSteamFarm.Localization;
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Steam.Interaction;
using ArchiSteamFarm.Storage;
using Microsoft.AspNetCore.Mvc;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Generic;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Concurrent;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
using Newtonsoft.Json.Converters;
using File = System.IO.File;
using Path = System.IO.Path;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Linq;

View file

@ -24,9 +24,9 @@ using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using ArchiSteamFarm.Compatibility;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.Localization;
using ArchiSteamFarm.RuntimeCompatibility;
using JetBrains.Annotations;
using NLog;
using SteamKit2;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
using File = System.IO.File;
using Path = System.IO.Path;
#endif
@ -2035,7 +2035,7 @@ namespace ArchiSteamFarm.Steam {
ArchiLogger.LogGenericInfo(Strings.BotAuthenticatorConverting);
try {
string json = await RuntimeCompatibility.File.ReadAllTextAsync(maFilePath).ConfigureAwait(false);
string json = await Compatibility.File.ReadAllTextAsync(maFilePath).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(json)));
@ -2304,7 +2304,7 @@ namespace ArchiSteamFarm.Steam {
if (File.Exists(sentryFilePath)) {
try {
byte[] sentryFileContent = await RuntimeCompatibility.File.ReadAllBytesAsync(sentryFilePath).ConfigureAwait(false);
byte[] sentryFileContent = await Compatibility.File.ReadAllBytesAsync(sentryFilePath).ConfigureAwait(false);
sentryFileHash = CryptoHelper.SHAHash(sentryFileContent);
} catch (Exception e) {
ArchiLogger.LogGenericException(e);
@ -3335,7 +3335,7 @@ namespace ArchiSteamFarm.Steam {
}
try {
await RuntimeCompatibility.File.AppendAllTextAsync(filePath, logEntry + Environment.NewLine).ConfigureAwait(false);
await Compatibility.File.AppendAllTextAsync(filePath, logEntry + Environment.NewLine).ConfigureAwait(false);
} catch (Exception e) {
ArchiLogger.LogGenericException(e);
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.Content, logEntry));

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Generic;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Concurrent;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using HashCode = ArchiSteamFarm.RuntimeCompatibility.HashCode;
using HashCode = ArchiSteamFarm.Compatibility.HashCode;
#endif
using System;
using Newtonsoft.Json;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Concurrent;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Immutable;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.Collections.Generic;

View file

@ -27,11 +27,11 @@ using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using ArchiSteamFarm.Compatibility;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.Helpers;
using ArchiSteamFarm.Localization;
using ArchiSteamFarm.Plugins;
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Steam.Data;
using ArchiSteamFarm.Steam.Idling;
using ArchiSteamFarm.Steam.Integration;

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using HashCode = ArchiSteamFarm.RuntimeCompatibility.HashCode;
using HashCode = ArchiSteamFarm.Compatibility.HashCode;
#endif
using System;
using System.ComponentModel;

View file

@ -27,10 +27,10 @@ using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ArchiSteamFarm.Compatibility;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.Helpers;
using ArchiSteamFarm.Localization;
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Steam.Data;
using ArchiSteamFarm.Steam.Integration;
using JetBrains.Annotations;

View file

@ -155,7 +155,7 @@ namespace ArchiSteamFarm.Steam.Storage {
BotDatabase? botDatabase;
try {
string json = await RuntimeCompatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false);
string json = await Compatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(json)));

View file

@ -351,7 +351,7 @@ namespace ArchiSteamFarm.Storage {
GlobalConfig? globalConfig;
try {
string json = await RuntimeCompatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false);
string json = await Compatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(json)));
@ -400,7 +400,7 @@ namespace ArchiSteamFarm.Storage {
await WriteSemaphore.WaitAsync().ConfigureAwait(false);
try {
await RuntimeCompatibility.File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
await Compatibility.File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
if (File.Exists(filePath)) {
File.Replace(newFilePath, filePath, null);

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
using File = System.IO.File;
#else
using System.IO;
@ -138,7 +138,7 @@ namespace ArchiSteamFarm.Storage {
GlobalDatabase? globalDatabase;
try {
string json = await RuntimeCompatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false);
string json = await Compatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(json)));

View file

@ -20,7 +20,7 @@
// limitations under the License.
#if NETFRAMEWORK
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Compatibility;
#endif
using System;
using System.IO;

View file

@ -29,10 +29,10 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using ArchiSteamFarm.Compatibility;
using ArchiSteamFarm.Core;
using ArchiSteamFarm.Localization;
using ArchiSteamFarm.NLog;
using ArchiSteamFarm.RuntimeCompatibility;
using ArchiSteamFarm.Web.Responses;
using JetBrains.Annotations;
using Newtonsoft.Json;