From fb4eb0b03a61f218b868e8a9d4c52ef25349615f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C3=B6ls?= <6608231+Abrynos@users.noreply.github.com> Date: Tue, 9 Nov 2021 16:33:09 +0100 Subject: [PATCH] Use Madness via global usings (#2447) * Use Madness via global usings * Apply feedback * Disable false positive null warning --- .../ExamplePlugin.cs | 3 --- .../GlobalCache.cs | 4 ---- .../SteamTokenDumperPlugin.cs | 3 --- ArchiSteamFarm.Tests/Bot.cs | 3 --- ArchiSteamFarm/ArchiSteamFarm.csproj | 1 - ArchiSteamFarm/Core/ASF.cs | 6 ------ ArchiSteamFarm/Core/OS.cs | 7 +------ ArchiSteamFarm/Core/Statistics.cs | 3 --- ArchiSteamFarm/Core/Utilities.cs | 3 --- ArchiSteamFarm/Helpers/ArchiCryptoHelper.cs | 3 --- .../Helpers/CrossProcessFileBasedSemaphore.cs | 5 +---- ArchiSteamFarm/Helpers/SerializableFile.cs | 6 +----- ArchiSteamFarm/IPC/ArchiKestrel.cs | 19 +++--------------- .../IPC/Controllers/Api/ASFController.cs | 3 --- .../IPC/Controllers/Api/BotController.cs | 3 --- .../IPC/Controllers/Api/NLogController.cs | 3 --- .../Api/TwoFactorAuthenticationController.cs | 3 --- .../ApiAuthenticationMiddleware.cs | 6 +----- ArchiSteamFarm/IPC/Startup.cs | 15 ++------------ ArchiSteamFarm/IPC/WebUtilities.cs | 20 ++++++++++++++++++- ArchiSteamFarm/NLog/ArchiLogger.cs | 7 +------ ArchiSteamFarm/Steam/Bot.cs | 5 ----- ArchiSteamFarm/Steam/Cards/CardsFarmer.cs | 3 --- ArchiSteamFarm/Steam/Cards/Game.cs | 3 --- ArchiSteamFarm/Steam/Exchange/Trading.cs | 3 --- .../Steam/Integration/ArchiWebHandler.cs | 3 --- .../Steam/Integration/SteamChatMessage.cs | 3 --- .../Steam/Integration/SteamSaleEvent.cs | 3 --- ArchiSteamFarm/Steam/Interaction/Actions.cs | 3 --- ArchiSteamFarm/Steam/Interaction/Commands.cs | 3 --- .../Steam/Security/MobileAuthenticator.cs | 3 --- .../Steam/SteamKit2/ServerRecordEndPoint.cs | 3 --- ArchiSteamFarm/Steam/Storage/BotConfig.cs | 7 +------ ArchiSteamFarm/Steam/Storage/BotDatabase.cs | 6 +----- ArchiSteamFarm/Storage/GlobalConfig.cs | 6 +----- ArchiSteamFarm/Storage/GlobalDatabase.cs | 7 +------ .../Web/Responses/StreamResponse.cs | 3 --- ArchiSteamFarm/Web/WebBrowser.cs | 3 --- Directory.Build.props | 10 ++++++++++ 39 files changed, 43 insertions(+), 160 deletions(-) diff --git a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs index 0d1dd7be9..b6ece79e6 100644 --- a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs +++ b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Composition; diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/GlobalCache.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/GlobalCache.cs index 4bf36c58d..a0e5a1f8d 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/GlobalCache.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/GlobalCache.cs @@ -19,10 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -using File = JustArchiNET.Madness.FileMadness.File; -#endif using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs index 1b497c0fb..144396147 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperPlugin.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/ArchiSteamFarm.Tests/Bot.cs b/ArchiSteamFarm.Tests/Bot.cs index 8d25a40f3..6a9d44a8e 100644 --- a/ArchiSteamFarm.Tests/Bot.cs +++ b/ArchiSteamFarm.Tests/Bot.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Linq; diff --git a/ArchiSteamFarm/ArchiSteamFarm.csproj b/ArchiSteamFarm/ArchiSteamFarm.csproj index 9d24c791f..6b8fbf9b6 100644 --- a/ArchiSteamFarm/ArchiSteamFarm.csproj +++ b/ArchiSteamFarm/ArchiSteamFarm.csproj @@ -30,7 +30,6 @@ - diff --git a/ArchiSteamFarm/Core/ASF.cs b/ArchiSteamFarm/Core/ASF.cs index 83cd7c934..4cdcce963 100644 --- a/ArchiSteamFarm/Core/ASF.cs +++ b/ArchiSteamFarm/Core/ASF.cs @@ -19,12 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -using File = JustArchiNET.Madness.FileMadness.File; -using OperatingSystem = JustArchiNET.Madness.OperatingSystemMadness.OperatingSystem; -using Path = JustArchiNET.Madness.PathMadness.Path; -#endif using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/ArchiSteamFarm/Core/OS.cs b/ArchiSteamFarm/Core/OS.cs index 289d315da..daf93aace 100644 --- a/ArchiSteamFarm/Core/OS.cs +++ b/ArchiSteamFarm/Core/OS.cs @@ -19,17 +19,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -using OperatingSystem = JustArchiNET.Madness.OperatingSystemMadness.OperatingSystem; -#else -using System.Runtime.Versioning; -#endif using System; using System.Diagnostics; using System.Globalization; using System.IO; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using System.Security.Cryptography; using System.Security.Principal; using System.Text; diff --git a/ArchiSteamFarm/Core/Statistics.cs b/ArchiSteamFarm/Core/Statistics.cs index fcdb568be..768698c0b 100644 --- a/ArchiSteamFarm/Core/Statistics.cs +++ b/ArchiSteamFarm/Core/Statistics.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Collections.Immutable; diff --git a/ArchiSteamFarm/Core/Utilities.cs b/ArchiSteamFarm/Core/Utilities.cs index 974b909da..0a18b465c 100644 --- a/ArchiSteamFarm/Core/Utilities.cs +++ b/ArchiSteamFarm/Core/Utilities.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections; using System.Collections.Generic; diff --git a/ArchiSteamFarm/Helpers/ArchiCryptoHelper.cs b/ArchiSteamFarm/Helpers/ArchiCryptoHelper.cs index 602509d58..1473f93ca 100644 --- a/ArchiSteamFarm/Helpers/ArchiCryptoHelper.cs +++ b/ArchiSteamFarm/Helpers/ArchiCryptoHelper.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using OperatingSystem = JustArchiNET.Madness.OperatingSystemMadness.OperatingSystem; -#endif using System; using System.Collections.Generic; using System.Collections.Immutable; diff --git a/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs b/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs index 17bc71fe0..4f4783641 100644 --- a/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs +++ b/ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using OperatingSystem = JustArchiNET.Madness.OperatingSystemMadness.OperatingSystem; -#endif #if TARGET_GENERIC || TARGET_WINDOWS using System.Security.AccessControl; #endif @@ -187,7 +184,7 @@ namespace ArchiSteamFarm.Helpers { #if TARGET_GENERIC || !TARGET_WINDOWS if (OperatingSystem.IsFreeBSD() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS()) { - OS.UnixSetFileAccess(directoryPath, OS.EUnixPermission.Combined777); + OS.UnixSetFileAccess(directoryPath!, OS.EUnixPermission.Combined777); } #endif } diff --git a/ArchiSteamFarm/Helpers/SerializableFile.cs b/ArchiSteamFarm/Helpers/SerializableFile.cs index 717b621ba..84f516096 100644 --- a/ArchiSteamFarm/Helpers/SerializableFile.cs +++ b/ArchiSteamFarm/Helpers/SerializableFile.cs @@ -19,12 +19,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using File = JustArchiNET.Madness.FileMadness.File; -#else -using System.IO; -#endif using System; +using System.IO; using System.Threading; using System.Threading.Tasks; using ArchiSteamFarm.Core; diff --git a/ArchiSteamFarm/IPC/ArchiKestrel.cs b/ArchiSteamFarm/IPC/ArchiKestrel.cs index 371d305cf..ee8cdda19 100644 --- a/ArchiSteamFarm/IPC/ArchiKestrel.cs +++ b/ArchiSteamFarm/IPC/ArchiKestrel.cs @@ -20,10 +20,8 @@ // limitations under the License. #if NETFRAMEWORK -using JustArchiNET.Madness; -using File = JustArchiNET.Madness.FileMadness.File; -#else -using Microsoft.Extensions.Hosting; +using IHost = Microsoft.AspNetCore.Hosting.IWebHost; +using HostBuilder = Microsoft.AspNetCore.Hosting.WebHostBuilder; #endif using System; using System.IO; @@ -35,6 +33,7 @@ using ArchiSteamFarm.NLog; using ArchiSteamFarm.NLog.Targets; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -44,11 +43,7 @@ namespace ArchiSteamFarm.IPC { internal static class ArchiKestrel { internal static HistoryTarget? HistoryTarget { get; private set; } -#if NETFRAMEWORK - private static IWebHost? KestrelWebHost; -#else private static IHost? KestrelWebHost; -#endif internal static void OnNewHistoryTarget(HistoryTarget? historyTarget = null) { if (HistoryTarget != null) { @@ -70,11 +65,7 @@ namespace ArchiSteamFarm.IPC { ASF.ArchiLogger.LogGenericInfo(Strings.IPCStarting); // The order of dependency injection matters, pay attention to it -#if NETFRAMEWORK - WebHostBuilder builder = new(); -#else HostBuilder builder = new(); -#endif string customDirectory = Path.Combine(Directory.GetCurrentDirectory(), SharedInfo.WebsiteDirectory); string websiteDirectory = Directory.Exists(customDirectory) ? customDirectory : Path.Combine(AppContext.BaseDirectory, SharedInfo.WebsiteDirectory); @@ -144,11 +135,7 @@ namespace ArchiSteamFarm.IPC { Logging.InitHistoryLogger(); // Start the server -#if NETFRAMEWORK - IWebHost? kestrelWebHost = null; -#else IHost? kestrelWebHost = null; -#endif try { kestrelWebHost = builder.Build(); diff --git a/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs b/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs index a96939a9f..c68cab74e 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Globalization; diff --git a/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs b/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs index 255a3977e..7b56118aa 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/BotController.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs index c31429097..a96aaa235 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs b/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs index 0ab71d234..2fc7b2f2d 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/TwoFactorAuthenticationController.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Globalization; diff --git a/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs b/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs index f93013c67..73ad6f917 100644 --- a/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs +++ b/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs @@ -20,7 +20,7 @@ // limitations under the License. #if NETFRAMEWORK -using JustArchiNET.Madness; +using MvcNewtonsoftJsonOptions = Microsoft.AspNetCore.Mvc.MvcJsonOptions; #endif using System; using System.Collections.Concurrent; @@ -70,11 +70,7 @@ namespace ArchiSteamFarm.IPC.Integration { } [UsedImplicitly] -#if NETFRAMEWORK - public async Task InvokeAsync(HttpContext context, IOptions jsonOptions) { -#else public async Task InvokeAsync(HttpContext context, IOptions jsonOptions) { -#endif if (context == null) { throw new ArgumentNullException(nameof(context)); } diff --git a/ArchiSteamFarm/IPC/Startup.cs b/ArchiSteamFarm/IPC/Startup.cs index bf1b7d05c..7eefbf194 100644 --- a/ArchiSteamFarm/IPC/Startup.cs +++ b/ArchiSteamFarm/IPC/Startup.cs @@ -20,9 +20,10 @@ // limitations under the License. #if NETFRAMEWORK -using JustArchiNET.Madness; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Converters; +using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; +using IMvcBuilder = Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder; #endif using System; using System.Collections.Generic; @@ -57,11 +58,7 @@ namespace ArchiSteamFarm.IPC { public Startup(IConfiguration configuration) => Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); [UsedImplicitly] -#if NETFRAMEWORK - public void Configure(IApplicationBuilder app, IHostingEnvironment env) { -#else public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { -#endif if (app == null) { throw new ArgumentNullException(nameof(app)); } @@ -242,11 +239,7 @@ namespace ArchiSteamFarm.IPC { // Add support for localization services.AddLocalization(); -#if NETFRAMEWORK - services.Configure( -#else services.AddRequestLocalization( -#endif static options => { // We do not set the DefaultRequestCulture here, because it will default to Thread.CurrentThread.CurrentCulture in this case, which is set when loading GlobalConfig @@ -335,11 +328,7 @@ namespace ArchiSteamFarm.IPC { services.AddSwaggerGenNewtonsoftSupport(); // We need MVC for /Api, but we're going to use only a small subset of all available features -#if NETFRAMEWORK - IMvcCoreBuilder mvc = services.AddMvcCore(); -#else IMvcBuilder mvc = services.AddControllers(); -#endif // Add support for controllers declared in custom plugins if (PluginsCore.ActivePlugins?.Count > 0) { diff --git a/ArchiSteamFarm/IPC/WebUtilities.cs b/ArchiSteamFarm/IPC/WebUtilities.cs index 242c633f8..e76244605 100644 --- a/ArchiSteamFarm/IPC/WebUtilities.cs +++ b/ArchiSteamFarm/IPC/WebUtilities.cs @@ -20,7 +20,8 @@ // limitations under the License. #if NETFRAMEWORK -using JustArchiNET.Madness; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; #endif using System; using System.IO; @@ -32,6 +33,23 @@ using Newtonsoft.Json; namespace ArchiSteamFarm.IPC { internal static class WebUtilities { +#if NETFRAMEWORK + internal static IMvcCoreBuilder AddControllers(this IServiceCollection services) { + if (services == null) { + throw new ArgumentNullException(nameof(services)); + } + + return services.AddMvcCore(); + } + + internal static IServiceCollection AddRequestLocalization(this IServiceCollection services, Action action) { + if (services == null) { + throw new ArgumentNullException(nameof(services)); + } + + return services.Configure(action); + } +#endif internal static string? GetUnifiedName(this Type type) { if (type == null) { throw new ArgumentNullException(nameof(type)); diff --git a/ArchiSteamFarm/NLog/ArchiLogger.cs b/ArchiSteamFarm/NLog/ArchiLogger.cs index b8e0be1a2..4d77519b3 100644 --- a/ArchiSteamFarm/NLog/ArchiLogger.cs +++ b/ArchiSteamFarm/NLog/ArchiLogger.cs @@ -19,14 +19,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -using File = JustArchiNET.Madness.FileMadness.File; -#else -using File = System.IO.File; -#endif using System; using System.Globalization; +using System.IO; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 4b0caec77..5b62b54d0 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -19,11 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -using File = JustArchiNET.Madness.FileMadness.File; -using Path = JustArchiNET.Madness.PathMadness.Path; -#endif using System; using System.Collections; using System.Collections.Concurrent; diff --git a/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs b/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs index 596ed918a..041e52d71 100644 --- a/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs +++ b/ArchiSteamFarm/Steam/Cards/CardsFarmer.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/ArchiSteamFarm/Steam/Cards/Game.cs b/ArchiSteamFarm/Steam/Cards/Game.cs index 8e167cf15..3fbb57309 100644 --- a/ArchiSteamFarm/Steam/Cards/Game.cs +++ b/ArchiSteamFarm/Steam/Cards/Game.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using HashCode = JustArchiNET.Madness.HashCodeMadness.HashCode; -#endif using System; using Newtonsoft.Json; diff --git a/ArchiSteamFarm/Steam/Exchange/Trading.cs b/ArchiSteamFarm/Steam/Exchange/Trading.cs index 47e8e6619..e8cf29c73 100644 --- a/ArchiSteamFarm/Steam/Exchange/Trading.cs +++ b/ArchiSteamFarm/Steam/Exchange/Trading.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Globalization; diff --git a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs index 641b28662..1ed3fbb9f 100644 --- a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs +++ b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs b/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs index d2dc47f92..ac8be9d14 100644 --- a/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs +++ b/ArchiSteamFarm/Steam/Integration/SteamChatMessage.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Buffers; using System.Collections.Generic; diff --git a/ArchiSteamFarm/Steam/Integration/SteamSaleEvent.cs b/ArchiSteamFarm/Steam/Integration/SteamSaleEvent.cs index a9dde834f..a8ce4abb8 100644 --- a/ArchiSteamFarm/Steam/Integration/SteamSaleEvent.cs +++ b/ArchiSteamFarm/Steam/Integration/SteamSaleEvent.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Immutable; using System.Globalization; diff --git a/ArchiSteamFarm/Steam/Interaction/Actions.cs b/ArchiSteamFarm/Steam/Interaction/Actions.cs index 02ed69e08..dd0636a0f 100644 --- a/ArchiSteamFarm/Steam/Interaction/Actions.cs +++ b/ArchiSteamFarm/Steam/Interaction/Actions.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/ArchiSteamFarm/Steam/Interaction/Commands.cs b/ArchiSteamFarm/Steam/Interaction/Commands.cs index 0db24c6af..40d9bfdd6 100644 --- a/ArchiSteamFarm/Steam/Interaction/Commands.cs +++ b/ArchiSteamFarm/Steam/Interaction/Commands.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Collections.Generic; using System.Globalization; diff --git a/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs b/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs index 3c5db8734..56441532d 100644 --- a/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs +++ b/ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using String = JustArchiNET.Madness.StringMadness.String; -#endif using System; using System.Collections.Generic; using System.Collections.Immutable; diff --git a/ArchiSteamFarm/Steam/SteamKit2/ServerRecordEndPoint.cs b/ArchiSteamFarm/Steam/SteamKit2/ServerRecordEndPoint.cs index 319ba20af..5610c89e3 100644 --- a/ArchiSteamFarm/Steam/SteamKit2/ServerRecordEndPoint.cs +++ b/ArchiSteamFarm/Steam/SteamKit2/ServerRecordEndPoint.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using HashCode = JustArchiNET.Madness.HashCodeMadness.HashCode; -#endif using System; using System.ComponentModel; using Newtonsoft.Json; diff --git a/ArchiSteamFarm/Steam/Storage/BotConfig.cs b/ArchiSteamFarm/Steam/Storage/BotConfig.cs index 7d1fdfff9..2f0756cd0 100644 --- a/ArchiSteamFarm/Steam/Storage/BotConfig.cs +++ b/ArchiSteamFarm/Steam/Storage/BotConfig.cs @@ -19,18 +19,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -using File = JustArchiNET.Madness.FileMadness.File; -#else -using System.IO; -#endif using System; using System.Collections.Generic; using System.Collections.Immutable; using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.IO; using System.Linq; using System.Reflection; using System.Threading.Tasks; diff --git a/ArchiSteamFarm/Steam/Storage/BotDatabase.cs b/ArchiSteamFarm/Steam/Storage/BotDatabase.cs index 430c98dfb..237140551 100644 --- a/ArchiSteamFarm/Steam/Storage/BotDatabase.cs +++ b/ArchiSteamFarm/Steam/Storage/BotDatabase.cs @@ -19,15 +19,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using File = JustArchiNET.Madness.FileMadness.File; -#else -using System.IO; -#endif using System; using System.Collections; using System.Collections.Specialized; using System.Globalization; +using System.IO; using System.Linq; using System.Threading.Tasks; using ArchiSteamFarm.Collections; diff --git a/ArchiSteamFarm/Storage/GlobalConfig.cs b/ArchiSteamFarm/Storage/GlobalConfig.cs index 99f3ff736..f256e078b 100644 --- a/ArchiSteamFarm/Storage/GlobalConfig.cs +++ b/ArchiSteamFarm/Storage/GlobalConfig.cs @@ -19,17 +19,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using File = JustArchiNET.Madness.FileMadness.File; -#else -using System.IO; -#endif using System; using System.Collections.Generic; using System.Collections.Immutable; using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.IO; using System.Net; using System.Threading.Tasks; using ArchiSteamFarm.Core; diff --git a/ArchiSteamFarm/Storage/GlobalDatabase.cs b/ArchiSteamFarm/Storage/GlobalDatabase.cs index 910d410d1..944d269db 100644 --- a/ArchiSteamFarm/Storage/GlobalDatabase.cs +++ b/ArchiSteamFarm/Storage/GlobalDatabase.cs @@ -19,17 +19,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -using File = JustArchiNET.Madness.FileMadness.File; -#else -using System.IO; -#endif using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; +using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/ArchiSteamFarm/Web/Responses/StreamResponse.cs b/ArchiSteamFarm/Web/Responses/StreamResponse.cs index 1535fbd2d..d3785fcd9 100644 --- a/ArchiSteamFarm/Web/Responses/StreamResponse.cs +++ b/ArchiSteamFarm/Web/Responses/StreamResponse.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.IO; using System.Net.Http; diff --git a/ArchiSteamFarm/Web/WebBrowser.cs b/ArchiSteamFarm/Web/WebBrowser.cs index 30369e2cd..cefd3daf9 100644 --- a/ArchiSteamFarm/Web/WebBrowser.cs +++ b/ArchiSteamFarm/Web/WebBrowser.cs @@ -19,9 +19,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if NETFRAMEWORK -using JustArchiNET.Madness; -#endif using System; using System.Buffers; using System.Collections.Generic; diff --git a/Directory.Build.props b/Directory.Build.props index 3060bb723..3a602e3be 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -30,6 +30,16 @@ true + + + + + + + + + + $(DefineConstants);ASF_VARIANT_$(ASFVariant.Replace('-', '_').ToUpperInvariant())