Use newer syntax for Enum.IsDefined()

This commit is contained in:
Archi 2022-01-23 01:37:43 +01:00
parent 4258fed873
commit dae6f9d328
No known key found for this signature in database
GPG key ID: 6B138B4C64555AEA
22 changed files with 143 additions and 142 deletions

View file

@ -96,7 +96,7 @@ public static class ASF {
}
internal static string GetFilePath(EFileType fileType) {
if (!Enum.IsDefined(typeof(EFileType), fileType)) {
if (!Enum.IsDefined(fileType)) {
throw new InvalidEnumArgumentException(nameof(fileType), (int) fileType, typeof(EFileType));
}

View file

@ -121,7 +121,7 @@ internal static class OS {
}
internal static void Init(GlobalConfig.EOptimizationMode optimizationMode) {
if (!Enum.IsDefined(typeof(GlobalConfig.EOptimizationMode), optimizationMode)) {
if (!Enum.IsDefined(optimizationMode)) {
throw new ArgumentNullException(nameof(optimizationMode));
}

View file

@ -48,7 +48,7 @@ public sealed class ArchiCacheable<T> : IDisposable {
[PublicAPI]
public async Task<(bool Success, T? Result)> GetValue(EFallback fallback = EFallback.DefaultForType) {
if (!Enum.IsDefined(typeof(EFallback), fallback)) {
if (!Enum.IsDefined(fallback)) {
throw new InvalidEnumArgumentException(nameof(fallback), (int) fallback, typeof(EFallback));
}

View file

@ -60,7 +60,7 @@ public static class ArchiCryptoHelper {
private static byte[] EncryptionKey = Encoding.UTF8.GetBytes(nameof(ArchiSteamFarm));
internal static async Task<string?> Decrypt(ECryptoMethod cryptoMethod, string encryptedString) {
if (!Enum.IsDefined(typeof(ECryptoMethod), cryptoMethod)) {
if (!Enum.IsDefined(cryptoMethod)) {
throw new InvalidEnumArgumentException(nameof(cryptoMethod), (int) cryptoMethod, typeof(ECryptoMethod));
}
@ -79,7 +79,7 @@ public static class ArchiCryptoHelper {
}
internal static string? Encrypt(ECryptoMethod cryptoMethod, string decryptedString) {
if (!Enum.IsDefined(typeof(ECryptoMethod), cryptoMethod)) {
if (!Enum.IsDefined(cryptoMethod)) {
throw new InvalidEnumArgumentException(nameof(cryptoMethod), (int) cryptoMethod, typeof(ECryptoMethod));
}
@ -98,7 +98,7 @@ public static class ArchiCryptoHelper {
}
internal static string Hash(EHashingMethod hashingMethod, string stringToHash) {
if (!Enum.IsDefined(typeof(EHashingMethod), hashingMethod)) {
if (!Enum.IsDefined(hashingMethod)) {
throw new InvalidEnumArgumentException(nameof(hashingMethod), (int) hashingMethod, typeof(EHashingMethod));
}
@ -129,7 +129,7 @@ public static class ArchiCryptoHelper {
throw new ArgumentOutOfRangeException(nameof(hashLength));
}
if (!Enum.IsDefined(typeof(EHashingMethod), hashingMethod)) {
if (!Enum.IsDefined(hashingMethod)) {
throw new InvalidEnumArgumentException(nameof(hashingMethod), (int) hashingMethod, typeof(EHashingMethod));
}
@ -163,7 +163,7 @@ public static class ArchiCryptoHelper {
throw new ArgumentNullException(nameof(salt));
}
if (!Enum.IsDefined(typeof(EHashingMethod), hashingMethod)) {
if (!Enum.IsDefined(hashingMethod)) {
throw new InvalidEnumArgumentException(nameof(hashingMethod), (int) hashingMethod, typeof(EHashingMethod));
}

View file

@ -261,7 +261,7 @@ public sealed class BotController : ArchiController {
ArgumentNullException.ThrowIfNull(request);
if ((request.Type == ASF.EUserInputType.None) || !Enum.IsDefined(typeof(ASF.EUserInputType), request.Type) || string.IsNullOrEmpty(request.Value)) {
if ((request.Type == ASF.EUserInputType.None) || !Enum.IsDefined(request.Type) || string.IsNullOrEmpty(request.Value)) {
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, $"{nameof(request.Type)} || {nameof(request.Value)}")));
}

View file

@ -51,7 +51,7 @@ public sealed class TwoFactorAuthenticationController : ArchiController {
ArgumentNullException.ThrowIfNull(request);
if (request.AcceptedType.HasValue && ((request.AcceptedType.Value == Confirmation.EType.Unknown) || !Enum.IsDefined(typeof(Confirmation.EType), request.AcceptedType.Value))) {
if (request.AcceptedType.HasValue && ((request.AcceptedType.Value == Confirmation.EType.Unknown) || !Enum.IsDefined(request.AcceptedType.Value))) {
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(request.AcceptedType))));
}

View file

@ -73,7 +73,7 @@ internal static class Logging {
}
internal static async Task<string?> GetUserInput(ASF.EUserInputType userInputType, string botName = SharedInfo.ASF) {
if ((userInputType == ASF.EUserInputType.None) || !Enum.IsDefined(typeof(ASF.EUserInputType), userInputType)) {
if ((userInputType == ASF.EUserInputType.None) || !Enum.IsDefined(userInputType)) {
throw new InvalidEnumArgumentException(nameof(userInputType), (int) userInputType, typeof(ASF.EUserInputType));
}

View file

@ -271,7 +271,7 @@ internal static class PluginsCore {
internal static async Task<string?> OnBotCommand(Bot bot, EAccess access, string message, string[] args, ulong steamID = 0) {
ArgumentNullException.ThrowIfNull(bot);
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}

View file

@ -555,7 +555,7 @@ public sealed class Bot : IAsyncDisposable {
throw new ArgumentNullException(nameof(botName));
}
if (!Enum.IsDefined(typeof(EFileType), fileType)) {
if (!Enum.IsDefined(fileType)) {
throw new InvalidEnumArgumentException(nameof(fileType), (int) fileType, typeof(EFileType));
}
@ -575,7 +575,7 @@ public sealed class Bot : IAsyncDisposable {
[PublicAPI]
public string GetFilePath(EFileType fileType) {
if (!Enum.IsDefined(typeof(EFileType), fileType)) {
if (!Enum.IsDefined(fileType)) {
throw new InvalidEnumArgumentException(nameof(fileType), (int) fileType, typeof(EFileType));
}
@ -764,7 +764,7 @@ public sealed class Bot : IAsyncDisposable {
throw new ArgumentOutOfRangeException(nameof(steamID));
}
if ((access == BotConfig.EAccess.None) || !Enum.IsDefined(typeof(BotConfig.EAccess), access)) {
if ((access == BotConfig.EAccess.None) || !Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(BotConfig.EAccess));
}
@ -875,7 +875,7 @@ public sealed class Bot : IAsyncDisposable {
[PublicAPI]
public bool SetUserInput(ASF.EUserInputType inputType, string inputValue) {
if ((inputType == ASF.EUserInputType.None) || !Enum.IsDefined(typeof(ASF.EUserInputType), inputType)) {
if ((inputType == ASF.EUserInputType.None) || !Enum.IsDefined(inputType)) {
throw new InvalidEnumArgumentException(nameof(inputType), (int) inputType, typeof(ASF.EUserInputType));
}

View file

@ -58,7 +58,7 @@ public sealed class TradeOffer {
throw new ArgumentOutOfRangeException(nameof(otherSteamID3));
}
if (!Enum.IsDefined(typeof(ETradeOfferState), state)) {
if (!Enum.IsDefined(state)) {
throw new InvalidEnumArgumentException(nameof(state), (int) state, typeof(ETradeOfferState));
}

View file

@ -65,27 +65,27 @@ internal sealed class UserPrivacy {
// Constructed from privacy change request
internal PrivacySettings(ArchiHandler.EPrivacySetting profile, ArchiHandler.EPrivacySetting ownedGames, ArchiHandler.EPrivacySetting playtime, ArchiHandler.EPrivacySetting friendsList, ArchiHandler.EPrivacySetting inventory, ArchiHandler.EPrivacySetting inventoryGifts) {
if ((profile == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(typeof(ArchiHandler.EPrivacySetting), profile)) {
if ((profile == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(profile)) {
throw new InvalidEnumArgumentException(nameof(profile), (int) profile, typeof(ArchiHandler.EPrivacySetting));
}
if ((ownedGames == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(typeof(ArchiHandler.EPrivacySetting), ownedGames)) {
if ((ownedGames == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(ownedGames)) {
throw new InvalidEnumArgumentException(nameof(ownedGames), (int) ownedGames, typeof(ArchiHandler.EPrivacySetting));
}
if ((playtime == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(typeof(ArchiHandler.EPrivacySetting), playtime)) {
if ((playtime == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(playtime)) {
throw new InvalidEnumArgumentException(nameof(playtime), (int) playtime, typeof(ArchiHandler.EPrivacySetting));
}
if ((friendsList == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(typeof(ArchiHandler.EPrivacySetting), friendsList)) {
if ((friendsList == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(friendsList)) {
throw new InvalidEnumArgumentException(nameof(friendsList), (int) friendsList, typeof(ArchiHandler.EPrivacySetting));
}
if ((inventory == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(typeof(ArchiHandler.EPrivacySetting), inventory)) {
if ((inventory == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(inventory)) {
throw new InvalidEnumArgumentException(nameof(inventory), (int) inventory, typeof(ArchiHandler.EPrivacySetting));
}
if ((inventoryGifts == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(typeof(ArchiHandler.EPrivacySetting), inventoryGifts)) {
if ((inventoryGifts == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(inventoryGifts)) {
throw new InvalidEnumArgumentException(nameof(inventoryGifts), (int) inventoryGifts, typeof(ArchiHandler.EPrivacySetting));
}

View file

@ -43,7 +43,7 @@ public sealed class ParseTradeResult {
throw new ArgumentOutOfRangeException(nameof(tradeOfferID));
}
if ((result == EResult.Unknown) || !Enum.IsDefined(typeof(EResult), result)) {
if ((result == EResult.Unknown) || !Enum.IsDefined(result)) {
throw new InvalidEnumArgumentException(nameof(result), (int) result, typeof(EResult));
}

View file

@ -730,7 +730,7 @@ public sealed class ArchiHandler : ClientMsgHandler {
}
internal void SetCurrentMode(EUserInterfaceMode userInterfaceMode, byte chatMode = 2) {
if (!Enum.IsDefined(typeof(EUserInterfaceMode), userInterfaceMode)) {
if (!Enum.IsDefined(userInterfaceMode)) {
throw new InvalidEnumArgumentException(nameof(userInterfaceMode), (int) userInterfaceMode, typeof(EUserInterfaceMode));
}

View file

@ -727,7 +727,7 @@ public sealed class ArchiWebHandler : IDisposable {
throw new ArgumentNullException(nameof(request));
}
if (!Enum.IsDefined(typeof(ESession), session)) {
if (!Enum.IsDefined(session)) {
throw new InvalidEnumArgumentException(nameof(session), (int) session, typeof(ESession));
}
@ -841,7 +841,7 @@ public sealed class ArchiWebHandler : IDisposable {
throw new ArgumentNullException(nameof(request));
}
if (!Enum.IsDefined(typeof(ESession), session)) {
if (!Enum.IsDefined(session)) {
throw new InvalidEnumArgumentException(nameof(session), (int) session, typeof(ESession));
}
@ -955,7 +955,7 @@ public sealed class ArchiWebHandler : IDisposable {
throw new ArgumentNullException(nameof(request));
}
if (!Enum.IsDefined(typeof(ESession), session)) {
if (!Enum.IsDefined(session)) {
throw new InvalidEnumArgumentException(nameof(session), (int) session, typeof(ESession));
}
@ -1071,7 +1071,7 @@ public sealed class ArchiWebHandler : IDisposable {
throw new ArgumentNullException(nameof(request));
}
if (!Enum.IsDefined(typeof(ESession), session)) {
if (!Enum.IsDefined(session)) {
throw new InvalidEnumArgumentException(nameof(session), (int) session, typeof(ESession));
}
@ -1579,7 +1579,7 @@ public sealed class ArchiWebHandler : IDisposable {
foreach (KeyValue trade in response["trade_offers_received"].Children) {
ETradeOfferState state = trade["trade_offer_state"].AsEnum<ETradeOfferState>();
if (!Enum.IsDefined(typeof(ETradeOfferState), state)) {
if (!Enum.IsDefined(state)) {
Bot.ArchiLogger.LogNullError(nameof(state));
return null;
@ -2121,7 +2121,7 @@ public sealed class ArchiWebHandler : IDisposable {
throw new ArgumentOutOfRangeException(nameof(steamID));
}
if ((universe == EUniverse.Invalid) || !Enum.IsDefined(typeof(EUniverse), universe)) {
if ((universe == EUniverse.Invalid) || !Enum.IsDefined(universe)) {
throw new InvalidEnumArgumentException(nameof(universe), (int) universe, typeof(EUniverse));
}

View file

@ -70,7 +70,7 @@ public sealed class Actions : IAsyncDisposable {
[PublicAPI]
public static string? Encrypt(ArchiCryptoHelper.ECryptoMethod cryptoMethod, string stringToEncrypt) {
if (!Enum.IsDefined(typeof(ArchiCryptoHelper.ECryptoMethod), cryptoMethod)) {
if (!Enum.IsDefined(cryptoMethod)) {
throw new InvalidEnumArgumentException(nameof(cryptoMethod), (int) cryptoMethod, typeof(ArchiCryptoHelper.ECryptoMethod));
}
@ -178,7 +178,7 @@ public sealed class Actions : IAsyncDisposable {
[PublicAPI]
public static string Hash(ArchiCryptoHelper.EHashingMethod hashingMethod, string stringToHash) {
if (!Enum.IsDefined(typeof(ArchiCryptoHelper.EHashingMethod), hashingMethod)) {
if (!Enum.IsDefined(hashingMethod)) {
throw new InvalidEnumArgumentException(nameof(hashingMethod), (int) hashingMethod, typeof(ArchiCryptoHelper.EHashingMethod));
}

View file

@ -95,7 +95,7 @@ public sealed class Commands {
[PublicAPI]
public async Task<string?> Response(EAccess access, string message, ulong steamID = 0) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -517,7 +517,7 @@ public sealed class Commands {
}
private async Task<string?> Response2FA(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -531,7 +531,7 @@ public sealed class Commands {
}
private static async Task<string?> Response2FA(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -553,7 +553,7 @@ public sealed class Commands {
}
private async Task<string?> Response2FAConfirm(EAccess access, bool confirm) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -575,7 +575,7 @@ public sealed class Commands {
}
private static async Task<string?> Response2FAConfirm(EAccess access, string botNames, bool confirm) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -597,7 +597,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseAddLicense(EAccess access, string query) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -669,7 +669,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseAddLicense(EAccess access, string botNames, string query) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -695,7 +695,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseAdvancedLoot(EAccess access, string targetAppID, string targetContextID) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -729,7 +729,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseAdvancedLoot(EAccess access, string botNames, string appID, string contextID) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -759,7 +759,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseAdvancedRedeem(EAccess access, string options, string keys, ulong steamID = 0) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -844,7 +844,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseAdvancedRedeem(EAccess access, string botNames, string options, string keys, ulong steamID = 0) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -874,7 +874,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseAdvancedTransfer(EAccess access, uint appID, ulong contextID, Bot targetBot) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -906,7 +906,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseAdvancedTransfer(EAccess access, string targetAppID, string targetContextID, string botNameTo) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -940,7 +940,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseAdvancedTransfer(EAccess access, string botNames, string targetAppID, string targetContextID, string botNameTo) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -988,7 +988,7 @@ public sealed class Commands {
}
private string? ResponseBackgroundGamesRedeemer(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1002,7 +1002,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseBackgroundGamesRedeemer(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1024,7 +1024,7 @@ public sealed class Commands {
}
private static string? ResponseEncrypt(EAccess access, string cryptoMethodText, string stringToEncrypt) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1050,7 +1050,7 @@ public sealed class Commands {
}
private static string? ResponseExit(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1064,7 +1064,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseFarm(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1086,7 +1086,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseFarm(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1108,7 +1108,7 @@ public sealed class Commands {
}
private string? ResponseFarmingBlacklist(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1116,7 +1116,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseFarmingBlacklist(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1138,7 +1138,7 @@ public sealed class Commands {
}
private string? ResponseFarmingBlacklistAdd(EAccess access, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1183,7 +1183,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseFarmingBlacklistAdd(EAccess access, string botNames, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1209,7 +1209,7 @@ public sealed class Commands {
}
private string? ResponseFarmingBlacklistRemove(EAccess access, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1249,7 +1249,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseFarmingBlacklistRemove(EAccess access, string botNames, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1275,7 +1275,7 @@ public sealed class Commands {
}
private string? ResponseFarmingQueue(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1283,7 +1283,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseFarmingQueue(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1305,7 +1305,7 @@ public sealed class Commands {
}
private string? ResponseFarmingQueueAdd(EAccess access, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1357,7 +1357,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseFarmingQueueAdd(EAccess access, string botNames, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1383,7 +1383,7 @@ public sealed class Commands {
}
private string? ResponseFarmingQueueRemove(EAccess access, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1428,7 +1428,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseFarmingQueueRemove(EAccess access, string botNames, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1454,7 +1454,7 @@ public sealed class Commands {
}
private static string? ResponseHash(EAccess access, string hashingMethodText, string stringToHash) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1480,7 +1480,7 @@ public sealed class Commands {
}
private string? ResponseHelp(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1488,7 +1488,7 @@ public sealed class Commands {
}
private string? ResponseInput(EAccess access, string propertyName, string inputValue) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1510,7 +1510,7 @@ public sealed class Commands {
return FormatBotResponse(Strings.ErrorFunctionOnlyInHeadlessMode);
}
if (!Enum.TryParse(propertyName, true, out ASF.EUserInputType inputType) || (inputType == ASF.EUserInputType.None) || !Enum.IsDefined(typeof(ASF.EUserInputType), inputType)) {
if (!Enum.TryParse(propertyName, true, out ASF.EUserInputType inputType) || (inputType == ASF.EUserInputType.None) || !Enum.IsDefined(inputType)) {
return FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(inputType)));
}
@ -1520,7 +1520,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseInput(EAccess access, string botNames, string propertyName, string inputValue) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1550,7 +1550,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseLevel(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1568,7 +1568,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseLevel(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1590,7 +1590,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseLoot(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1612,7 +1612,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseLoot(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1634,7 +1634,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseLootByRealAppIDs(EAccess access, string realAppIDsText, bool exclude = false) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1676,7 +1676,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseLootByRealAppIDs(EAccess access, string botNames, string realAppIDsText, bool exclude = false) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1702,7 +1702,7 @@ public sealed class Commands {
}
private string? ResponseMatchActivelyBlacklist(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1710,7 +1710,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseMatchActivelyBlacklist(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1732,7 +1732,7 @@ public sealed class Commands {
}
private string? ResponseMatchActivelyBlacklistAdd(EAccess access, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1764,7 +1764,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseMatchActivelyBlacklistAdd(EAccess access, string botNames, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1790,7 +1790,7 @@ public sealed class Commands {
}
private string? ResponseMatchActivelyBlacklistRemove(EAccess access, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1822,7 +1822,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseMatchActivelyBlacklistRemove(EAccess access, string botNames, string targetAppIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1848,7 +1848,7 @@ public sealed class Commands {
}
private string? ResponseNickname(EAccess access, string nickname) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1870,7 +1870,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseNickname(EAccess access, string botNames, string nickname) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -1896,7 +1896,7 @@ public sealed class Commands {
}
private async Task<(string? Response, Dictionary<string, string>? OwnedGames)> ResponseOwns(EAccess access, string query) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2048,7 +2048,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseOwns(EAccess access, string botNames, string query) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2096,7 +2096,7 @@ public sealed class Commands {
}
private async Task<string?> ResponsePause(EAccess access, bool permanent, string? resumeInSecondsText = null) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2120,7 +2120,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponsePause(EAccess access, string botNames, bool permanent, string? resumeInSecondsText = null) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2142,7 +2142,7 @@ public sealed class Commands {
}
private async Task<string?> ResponsePlay(EAccess access, IReadOnlyCollection<uint> gameIDs, string? gameName = null) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2166,7 +2166,7 @@ public sealed class Commands {
}
private async Task<string?> ResponsePlay(EAccess access, string targetGameIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2213,7 +2213,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponsePlay(EAccess access, string botNames, string targetGameIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2239,7 +2239,7 @@ public sealed class Commands {
}
private async Task<string?> ResponsePointsBalance(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2257,7 +2257,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponsePointsBalance(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2279,7 +2279,7 @@ public sealed class Commands {
}
private async Task<string?> ResponsePrivacy(EAccess access, string privacySettingsText) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2317,7 +2317,7 @@ public sealed class Commands {
// Converting digits to enum
for (byte index = 0; index < privacySettingsArgs.Length; index++) {
if (!Enum.TryParse(privacySettingsArgs[index], true, out ArchiHandler.EPrivacySetting privacySetting) || (privacySetting == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(typeof(ArchiHandler.EPrivacySetting), privacySetting)) {
if (!Enum.TryParse(privacySettingsArgs[index], true, out ArchiHandler.EPrivacySetting privacySetting) || (privacySetting == ArchiHandler.EPrivacySetting.Unknown) || !Enum.IsDefined(privacySetting)) {
return FormatBotResponse(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(privacySettingsArgs)));
}
@ -2413,7 +2413,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponsePrivacy(EAccess access, string botNames, string privacySettingsText) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2439,7 +2439,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseRedeem(EAccess access, string keysText, ulong steamID = 0, ERedeemFlags redeemFlags = ERedeemFlags.None) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2698,7 +2698,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseRedeem(EAccess access, string botNames, string keysText, ulong steamID = 0, ERedeemFlags redeemFlags = ERedeemFlags.None) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2724,7 +2724,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseReset(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2742,7 +2742,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseReset(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2764,7 +2764,7 @@ public sealed class Commands {
}
private static string? ResponseRestart(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2778,7 +2778,7 @@ public sealed class Commands {
}
private string? ResponseResume(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2792,7 +2792,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseResume(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2814,7 +2814,7 @@ public sealed class Commands {
}
private string? ResponseStart(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2828,7 +2828,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseStart(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2850,7 +2850,7 @@ public sealed class Commands {
}
private string? ResponseStats(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2865,7 +2865,7 @@ public sealed class Commands {
}
private (string? Response, Bot Bot) ResponseStatus(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2907,7 +2907,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseStatus(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2937,7 +2937,7 @@ public sealed class Commands {
}
private string? ResponseStop(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2951,7 +2951,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseStop(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2973,7 +2973,7 @@ public sealed class Commands {
}
private string? ResponseTradingBlacklist(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -2981,7 +2981,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseTradingBlacklist(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3003,7 +3003,7 @@ public sealed class Commands {
}
private string? ResponseTradingBlacklistAdd(EAccess access, string targetSteamIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3035,7 +3035,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseTradingBlacklistAdd(EAccess access, string botNames, string targetSteamIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3061,7 +3061,7 @@ public sealed class Commands {
}
private string? ResponseTradingBlacklistRemove(EAccess access, string targetSteamIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3093,7 +3093,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseTradingBlacklistRemove(EAccess access, string botNames, string targetSteamIDs) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3119,7 +3119,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseTransfer(EAccess access, string botNameTo) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3159,7 +3159,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseTransfer(EAccess access, string botNames, string botNameTo) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3185,7 +3185,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseTransferByRealAppIDs(EAccess access, IReadOnlyCollection<uint> realAppIDs, Bot targetBot, bool exclude = false) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3221,7 +3221,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseTransferByRealAppIDs(EAccess access, string realAppIDsText, string botNameTo, bool exclude = false) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3263,7 +3263,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseTransferByRealAppIDs(EAccess access, string botNames, string realAppIDsText, string botNameTo, bool exclude = false) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3315,7 +3315,7 @@ public sealed class Commands {
}
private string? ResponseUnknown(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3323,7 +3323,7 @@ public sealed class Commands {
}
private async Task<string?> ResponseUnpackBoosters(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3359,7 +3359,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseUnpackBoosters(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3381,7 +3381,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseUpdate(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3395,7 +3395,7 @@ public sealed class Commands {
}
private string? ResponseVersion(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3403,7 +3403,7 @@ public sealed class Commands {
}
private string? ResponseWalletBalance(EAccess access) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}
@ -3415,7 +3415,7 @@ public sealed class Commands {
}
private static async Task<string?> ResponseWalletBalance(EAccess access, string botNames) {
if (!Enum.IsDefined(typeof(EAccess), access)) {
if (!Enum.IsDefined(access)) {
throw new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));
}

View file

@ -43,7 +43,7 @@ public sealed class Confirmation {
ID = id > 0 ? id : throw new ArgumentOutOfRangeException(nameof(id));
Key = key > 0 ? key : throw new ArgumentOutOfRangeException(nameof(key));
Creator = creator > 0 ? creator : throw new ArgumentOutOfRangeException(nameof(creator));
Type = Enum.IsDefined(typeof(EType), type) ? type : throw new InvalidEnumArgumentException(nameof(type), (int) type, typeof(EType));
Type = Enum.IsDefined(type) ? type : throw new InvalidEnumArgumentException(nameof(type), (int) type, typeof(EType));
}
// REF: Internal documentation

View file

@ -182,7 +182,7 @@ public sealed class MobileAuthenticator : IDisposable {
return null;
}
if (!Enum.IsDefined(typeof(Confirmation.EType), type)) {
if (!Enum.IsDefined(type)) {
Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(type), type));
return null;

View file

@ -414,7 +414,7 @@ public sealed class BotConfig {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(BotBehaviour), BotBehaviour));
}
foreach (EFarmingOrder farmingOrder in FarmingOrders.Where(static farmingOrder => !Enum.IsDefined(typeof(EFarmingOrder), farmingOrder))) {
foreach (EFarmingOrder farmingOrder in FarmingOrders.Where(static farmingOrder => !Enum.IsDefined(farmingOrder))) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(FarmingOrders), farmingOrder));
}
@ -426,14 +426,14 @@ public sealed class BotConfig {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(GamesPlayedWhileIdle), $"{nameof(GamesPlayedWhileIdle.Count)} {GamesPlayedWhileIdle.Count} > {ArchiHandler.MaxGamesPlayedConcurrently}"));
}
foreach (Asset.EType lootableType in LootableTypes.Where(static lootableType => !Enum.IsDefined(typeof(Asset.EType), lootableType))) {
foreach (Asset.EType lootableType in LootableTypes.Where(static lootableType => !Enum.IsDefined(lootableType))) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(LootableTypes), lootableType));
}
HashSet<Asset.EType>? completeTypesToSendValidTypes = null;
foreach (Asset.EType completableType in CompleteTypesToSend) {
if (!Enum.IsDefined(typeof(Asset.EType), completableType)) {
if (!Enum.IsDefined(completableType)) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(CompleteTypesToSend), completableType));
}
@ -452,15 +452,15 @@ public sealed class BotConfig {
}
}
foreach (Asset.EType matchableType in MatchableTypes.Where(static matchableType => !Enum.IsDefined(typeof(Asset.EType), matchableType))) {
foreach (Asset.EType matchableType in MatchableTypes.Where(static matchableType => !Enum.IsDefined(matchableType))) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(MatchableTypes), matchableType));
}
if (!Enum.IsDefined(typeof(EPersonaState), OnlineStatus)) {
if (!Enum.IsDefined(OnlineStatus)) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(OnlineStatus), OnlineStatus));
}
if (!Enum.IsDefined(typeof(ArchiCryptoHelper.ECryptoMethod), PasswordFormat)) {
if (!Enum.IsDefined(PasswordFormat)) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(PasswordFormat), PasswordFormat));
}
@ -485,7 +485,7 @@ public sealed class BotConfig {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(SteamUserPermissions), steamID));
}
if (!Enum.IsDefined(typeof(EAccess), permission)) {
if (!Enum.IsDefined(permission)) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(SteamUserPermissions), permission));
}
}
@ -494,7 +494,7 @@ public sealed class BotConfig {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(TradingPreferences), TradingPreferences));
}
return !Enum.IsDefined(typeof(ArchiHandler.EUserInterfaceMode), UserInterfaceMode) ? (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(UserInterfaceMode), UserInterfaceMode)) : (true, null);
return !Enum.IsDefined(UserInterfaceMode) ? (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(UserInterfaceMode), UserInterfaceMode)) : (true, null);
}
internal async Task<string?> GetDecryptedSteamPassword() {

View file

@ -441,7 +441,7 @@ public sealed class GlobalConfig {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(FarmingDelay), FarmingDelay));
}
if (!Enum.IsDefined(typeof(ArchiCryptoHelper.EHashingMethod), IPCPasswordFormat)) {
if (!Enum.IsDefined(IPCPasswordFormat)) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(IPCPasswordFormat), IPCPasswordFormat));
}
@ -449,7 +449,7 @@ public sealed class GlobalConfig {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(MaxFarmingTime), MaxFarmingTime));
}
if (!Enum.IsDefined(typeof(EOptimizationMode), OptimizationMode)) {
if (!Enum.IsDefined(OptimizationMode)) {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(OptimizationMode), OptimizationMode));
}
@ -465,7 +465,7 @@ public sealed class GlobalConfig {
return (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(SteamProtocols), SteamProtocols));
}
return Enum.IsDefined(typeof(EUpdateChannel), UpdateChannel) ? (true, null) : (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(UpdateChannel), UpdateChannel));
return Enum.IsDefined(UpdateChannel) ? (true, null) : (false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorConfigPropertyInvalid, nameof(UpdateChannel), UpdateChannel));
}
internal static async Task<(GlobalConfig? GlobalConfig, string? LatestJson)> Load(string filePath) {

View file

@ -35,6 +35,7 @@
<Using Include="JustArchiNET.Madness" />
<Using Include="JustArchiNET.Madness.ArgumentNullExceptionMadness.ArgumentNullException" Alias="ArgumentNullException" />
<Using Include="JustArchiNET.Madness.ConvertMadness.Convert" Alias="Convert" />
<Using Include="JustArchiNET.Madness.EnumMadness.Enum" Alias="Enum" />
<Using Include="JustArchiNET.Madness.EnvironmentMadness.Environment" Alias="Environment" />
<Using Include="JustArchiNET.Madness.FileMadness.File" Alias="File" />
<Using Include="JustArchiNET.Madness.HashCodeMadness.HashCode" Alias="HashCode" />

View file

@ -27,7 +27,7 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageVersion Include="JustArchiNET.Madness" Version="3.1.1" />
<PackageVersion Include="JustArchiNET.Madness" Version="3.2.1" />
<PackageVersion Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.HttpOverrides" Version="2.2.0" />