From 4102f59f5afdcf447ee1c7bf4250dfd485936d35 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Tue, 16 Mar 2021 11:07:45 +0100 Subject: [PATCH] Code cleanup --- ArchiSteamFarm/Commands.cs | 12 ++---------- ArchiSteamFarm/IPC/ArchiKestrel.cs | 8 ++------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/ArchiSteamFarm/Commands.cs b/ArchiSteamFarm/Commands.cs index 898bbc544..1ec184f28 100644 --- a/ArchiSteamFarm/Commands.cs +++ b/ArchiSteamFarm/Commands.cs @@ -1884,11 +1884,7 @@ namespace ArchiSteamFarm { appIDs.Add(appID); } - if (!Bot.BotDatabase.IdlingBlacklistedAppIDs.AddRange(appIDs)) { - return FormatBotResponse(Strings.NothingFound); - } - - return FormatBotResponse(Strings.Done); + return FormatBotResponse(Bot.BotDatabase.IdlingBlacklistedAppIDs.AddRange(appIDs) ? Strings.Done : Strings.NothingFound); } private static async Task ResponseMatchActivelyBlacklistAdd(ulong steamID, string botNames, string targetAppIDs) { @@ -1946,11 +1942,7 @@ namespace ArchiSteamFarm { appIDs.Add(appID); } - if (!Bot.BotDatabase.IdlingBlacklistedAppIDs.RemoveRange(appIDs)) { - return FormatBotResponse(Strings.NothingFound); - } - - return FormatBotResponse(Strings.Done); + return FormatBotResponse(Bot.BotDatabase.IdlingBlacklistedAppIDs.RemoveRange(appIDs) ? Strings.Done : Strings.NothingFound); } private static async Task ResponseMatchActivelyBlacklistRemove(ulong steamID, string botNames, string targetAppIDs) { diff --git a/ArchiSteamFarm/IPC/ArchiKestrel.cs b/ArchiSteamFarm/IPC/ArchiKestrel.cs index b302a8b02..d24c859af 100644 --- a/ArchiSteamFarm/IPC/ArchiKestrel.cs +++ b/ArchiSteamFarm/IPC/ArchiKestrel.cs @@ -39,7 +39,6 @@ using Microsoft.Extensions.Hosting; namespace ArchiSteamFarm.IPC { internal static class ArchiKestrel { internal static HistoryTarget? HistoryTarget { get; private set; } - internal static string WebsiteDirectory { get; private set; } = Path.Combine(AppContext.BaseDirectory, SharedInfo.WebsiteDirectory); #if NETFRAMEWORK private static IWebHost? KestrelWebHost; @@ -74,10 +73,7 @@ namespace ArchiSteamFarm.IPC { #endif string customDirectory = Path.Combine(Directory.GetCurrentDirectory(), SharedInfo.WebsiteDirectory); - - if (Directory.Exists(customDirectory)) { - WebsiteDirectory = customDirectory; - } + string websiteDirectory = Directory.Exists(customDirectory) ? customDirectory : Path.Combine(AppContext.BaseDirectory, SharedInfo.WebsiteDirectory); // Set default content root builder.UseContentRoot(SharedInfo.HomeDirectory); @@ -116,7 +112,7 @@ namespace ArchiSteamFarm.IPC { builder.ConfigureWebHostDefaults( webBuilder => { // Set default web root - webBuilder.UseWebRoot(WebsiteDirectory); + webBuilder.UseWebRoot(websiteDirectory); // Now conditionally initialize settings that are not possible to override if (customConfigExists) {