mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Latest Rider cleanups
This commit is contained in:
parent
944df1cfc8
commit
4f598d5c8f
54 changed files with 197 additions and 567 deletions
|
@ -6,6 +6,7 @@ root = true
|
|||
|
||||
[*]
|
||||
charset = utf-8
|
||||
#file_header_template = · _ _ _ ____ _ _____\n / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___\n / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \\n / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |\n/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|\n\nCopyright 2015-2021 Łukasz "JustArchi" Domeradzki\nContact: JustArchi@JustArchi.net\n\nLicensed under the Apache License, Version 2.0 (the "License")\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
|
|
@ -35,9 +35,7 @@ internal static class CatAPI {
|
|||
private const string URL = "https://aws.random.cat";
|
||||
|
||||
internal static async Task<string?> GetRandomCatURL(WebBrowser webBrowser) {
|
||||
if (webBrowser == null) {
|
||||
throw new ArgumentNullException(nameof(webBrowser));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(webBrowser);
|
||||
|
||||
Uri request = new($"{URL}/meow");
|
||||
|
||||
|
|
|
@ -141,9 +141,7 @@ internal sealed class GlobalCache : SerializableFile {
|
|||
throw new ArgumentOutOfRangeException(nameof(currentChangeNumber));
|
||||
}
|
||||
|
||||
if (appChanges == null) {
|
||||
throw new ArgumentNullException(nameof(appChanges));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(appChanges);
|
||||
|
||||
if (currentChangeNumber <= LastChangeNumber) {
|
||||
return;
|
||||
|
@ -181,9 +179,7 @@ internal sealed class GlobalCache : SerializableFile {
|
|||
internal bool ShouldRefreshDepotKey(uint depotID) => !DepotKeys.ContainsKey(depotID);
|
||||
|
||||
internal void UpdateAppChangeNumbers(IReadOnlyCollection<KeyValuePair<uint, uint>> appChangeNumbers) {
|
||||
if (appChangeNumbers == null) {
|
||||
throw new ArgumentNullException(nameof(appChangeNumbers));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(appChangeNumbers);
|
||||
|
||||
bool save = false;
|
||||
|
||||
|
@ -202,13 +198,9 @@ internal sealed class GlobalCache : SerializableFile {
|
|||
}
|
||||
|
||||
internal void UpdateAppTokens(IReadOnlyCollection<KeyValuePair<uint, ulong>> appTokens, IReadOnlyCollection<uint> publicAppIDs) {
|
||||
if (appTokens == null) {
|
||||
throw new ArgumentNullException(nameof(appTokens));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(appTokens);
|
||||
|
||||
if (publicAppIDs == null) {
|
||||
throw new ArgumentNullException(nameof(publicAppIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(publicAppIDs);
|
||||
|
||||
bool save = false;
|
||||
|
||||
|
@ -236,9 +228,7 @@ internal sealed class GlobalCache : SerializableFile {
|
|||
}
|
||||
|
||||
internal void UpdateDepotKeys(ICollection<SteamApps.DepotKeyCallback> depotKeyResults) {
|
||||
if (depotKeyResults == null) {
|
||||
throw new ArgumentNullException(nameof(depotKeyResults));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(depotKeyResults);
|
||||
|
||||
bool save = false;
|
||||
|
||||
|
@ -269,9 +259,7 @@ internal sealed class GlobalCache : SerializableFile {
|
|||
}
|
||||
|
||||
internal void UpdatePackageTokens(IReadOnlyCollection<KeyValuePair<uint, ulong>> packageTokens) {
|
||||
if (packageTokens == null) {
|
||||
throw new ArgumentNullException(nameof(packageTokens));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(packageTokens);
|
||||
|
||||
bool save = false;
|
||||
|
||||
|
@ -290,17 +278,11 @@ internal sealed class GlobalCache : SerializableFile {
|
|||
}
|
||||
|
||||
internal void UpdateSubmittedData(IReadOnlyDictionary<uint, ulong> apps, IReadOnlyDictionary<uint, ulong> packages, IReadOnlyDictionary<uint, string> depots) {
|
||||
if (apps == null) {
|
||||
throw new ArgumentNullException(nameof(apps));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(apps);
|
||||
|
||||
if (packages == null) {
|
||||
throw new ArgumentNullException(nameof(packages));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(packages);
|
||||
|
||||
if (depots == null) {
|
||||
throw new ArgumentNullException(nameof(depots));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(depots);
|
||||
|
||||
foreach ((uint appID, ulong token) in apps) {
|
||||
SubmittedApps[appID] = token;
|
||||
|
|
|
@ -58,17 +58,11 @@ internal sealed class RequestData {
|
|||
throw new ArgumentOutOfRangeException(nameof(steamID));
|
||||
}
|
||||
|
||||
if (apps == null) {
|
||||
throw new ArgumentNullException(nameof(apps));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(apps);
|
||||
|
||||
if (accessTokens == null) {
|
||||
throw new ArgumentNullException(nameof(accessTokens));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(accessTokens);
|
||||
|
||||
if (depots == null) {
|
||||
throw new ArgumentNullException(nameof(depots));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(depots);
|
||||
|
||||
SteamID = steamID;
|
||||
|
||||
|
|
|
@ -145,9 +145,7 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotS
|
|||
}
|
||||
|
||||
public async Task OnBotDestroy(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if (BotSubscriptions.TryRemove(bot, out IDisposable? subscription)) {
|
||||
subscription.Dispose();
|
||||
|
@ -161,9 +159,7 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotS
|
|||
}
|
||||
|
||||
public async Task OnBotInit(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if (Config is not { Enabled: true }) {
|
||||
return;
|
||||
|
@ -180,13 +176,9 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotS
|
|||
}
|
||||
|
||||
public Task OnBotSteamCallbacksInit(Bot bot, CallbackManager callbackManager) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if (callbackManager == null) {
|
||||
throw new ArgumentNullException(nameof(callbackManager));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callbackManager);
|
||||
|
||||
if (BotSubscriptions.TryRemove(bot, out IDisposable? subscription)) {
|
||||
subscription.Dispose();
|
||||
|
@ -218,13 +210,9 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotS
|
|||
throw new ArgumentOutOfRangeException(nameof(currentChangeNumber));
|
||||
}
|
||||
|
||||
if (appChanges == null) {
|
||||
throw new ArgumentNullException(nameof(appChanges));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(appChanges);
|
||||
|
||||
if (packageChanges == null) {
|
||||
throw new ArgumentNullException(nameof(packageChanges));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(packageChanges);
|
||||
|
||||
if (Config is not { Enabled: true }) {
|
||||
return Task.CompletedTask;
|
||||
|
@ -266,13 +254,9 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotS
|
|||
}
|
||||
|
||||
private static async void OnLicenseList(Bot bot, SteamApps.LicenseListCallback callback) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (Config is not { Enabled: true }) {
|
||||
return;
|
||||
|
@ -290,9 +274,7 @@ internal sealed class SteamTokenDumperPlugin : OfficialPlugin, IASF, IBot, IBotS
|
|||
}
|
||||
|
||||
private static async Task Refresh(Bot bot, IReadOnlyCollection<uint>? packageIDs = null) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if (Config is not { Enabled: true }) {
|
||||
return;
|
||||
|
|
|
@ -485,13 +485,9 @@ public sealed class Bot {
|
|||
}
|
||||
|
||||
private static void AssertResultMatchesExpectation(IReadOnlyDictionary<(uint RealAppID, ulong ContextID, ulong ClassID), uint> expectedResult, IReadOnlyCollection<Asset> itemsToSend) {
|
||||
if (expectedResult == null) {
|
||||
throw new ArgumentNullException(nameof(expectedResult));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(expectedResult);
|
||||
|
||||
if (itemsToSend == null) {
|
||||
throw new ArgumentNullException(nameof(itemsToSend));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(itemsToSend);
|
||||
|
||||
Dictionary<(uint RealAppID, ulong ContextID, ulong ClassID), long> realResult = itemsToSend.GroupBy(static asset => (asset.RealAppID, asset.ContextID, asset.ClassID)).ToDictionary(static group => group.Key, static group => group.Sum(static asset => asset.Amount));
|
||||
Assert.AreEqual(expectedResult.Count, realResult.Count);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -34,9 +34,7 @@ internal sealed class ConcurrentEnumerator<T> : IEnumerator<T> {
|
|||
object? IEnumerator.Current => Current;
|
||||
|
||||
internal ConcurrentEnumerator(IReadOnlyCollection<T> collection, IDisposable lockObject) {
|
||||
if (collection == null) {
|
||||
throw new ArgumentNullException(nameof(collection));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(collection);
|
||||
|
||||
LockObject = lockObject ?? throw new ArgumentNullException(nameof(lockObject));
|
||||
Enumerator = collection.GetEnumerator();
|
||||
|
|
|
@ -39,9 +39,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ISet<T> where
|
|||
public ConcurrentHashSet() => BackingCollection = new ConcurrentDictionary<T, bool>();
|
||||
|
||||
public ConcurrentHashSet(IEqualityComparer<T> comparer) {
|
||||
if (comparer == null) {
|
||||
throw new ArgumentNullException(nameof(comparer));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(comparer);
|
||||
|
||||
BackingCollection = new ConcurrentDictionary<T, bool>(comparer);
|
||||
}
|
||||
|
@ -71,9 +69,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ISet<T> where
|
|||
public void CopyTo(T[] array, int arrayIndex) => BackingCollection.Keys.CopyTo(array, arrayIndex);
|
||||
|
||||
public void ExceptWith(IEnumerable<T> other) {
|
||||
if (other == null) {
|
||||
throw new ArgumentNullException(nameof(other));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(other);
|
||||
|
||||
foreach (T item in other) {
|
||||
Remove(item);
|
||||
|
@ -151,9 +147,7 @@ public sealed class ConcurrentHashSet<T> : IReadOnlyCollection<T>, ISet<T> where
|
|||
}
|
||||
|
||||
public void UnionWith(IEnumerable<T> other) {
|
||||
if (other == null) {
|
||||
throw new ArgumentNullException(nameof(other));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(other);
|
||||
|
||||
foreach (T otherElement in other) {
|
||||
Add(otherElement);
|
||||
|
|
|
@ -485,13 +485,9 @@ public static class ASF {
|
|||
private static async void OnAutoUpdatesTimer(object? state = null) => await UpdateAndRestart().ConfigureAwait(false);
|
||||
|
||||
private static async void OnChanged(object sender, FileSystemEventArgs e) {
|
||||
if (sender == null) {
|
||||
throw new ArgumentNullException(nameof(sender));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(sender);
|
||||
|
||||
if (e == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
if (string.IsNullOrEmpty(e.Name)) {
|
||||
throw new InvalidOperationException(nameof(e.Name));
|
||||
|
@ -571,13 +567,9 @@ public static class ASF {
|
|||
}
|
||||
|
||||
private static async void OnCreated(object sender, FileSystemEventArgs e) {
|
||||
if (sender == null) {
|
||||
throw new ArgumentNullException(nameof(sender));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(sender);
|
||||
|
||||
if (e == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
if (string.IsNullOrEmpty(e.Name)) {
|
||||
throw new InvalidOperationException(nameof(e.Name));
|
||||
|
@ -713,13 +705,9 @@ public static class ASF {
|
|||
}
|
||||
|
||||
private static async void OnDeleted(object sender, FileSystemEventArgs e) {
|
||||
if (sender == null) {
|
||||
throw new ArgumentNullException(nameof(sender));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(sender);
|
||||
|
||||
if (e == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
if (string.IsNullOrEmpty(e.Name)) {
|
||||
throw new InvalidOperationException(nameof(e.Name));
|
||||
|
@ -837,13 +825,9 @@ public static class ASF {
|
|||
}
|
||||
|
||||
private static async void OnRenamed(object sender, RenamedEventArgs e) {
|
||||
if (sender == null) {
|
||||
throw new ArgumentNullException(nameof(sender));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(sender);
|
||||
|
||||
if (e == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
if (string.IsNullOrEmpty(e.OldName)) {
|
||||
throw new InvalidOperationException(nameof(e.OldName));
|
||||
|
@ -953,9 +937,7 @@ public static class ASF {
|
|||
}
|
||||
|
||||
private static bool UpdateFromArchive(ZipArchive archive, string targetDirectory) {
|
||||
if (archive == null) {
|
||||
throw new ArgumentNullException(nameof(archive));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(archive);
|
||||
|
||||
if (string.IsNullOrEmpty(targetDirectory)) {
|
||||
throw new ArgumentNullException(nameof(targetDirectory));
|
||||
|
|
|
@ -41,9 +41,7 @@ internal static class ArchiNet {
|
|||
private static Uri URL => new("https://asf.JustArchi.net");
|
||||
|
||||
internal static async Task<HttpStatusCode?> AnnounceForListing(Bot bot, IReadOnlyCollection<Asset> inventory, IReadOnlyCollection<Asset.EType> acceptedMatchableTypes, string tradeToken, string? nickname = null, string? avatarHash = null) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((inventory == null) || (inventory.Count == 0)) {
|
||||
throw new ArgumentNullException(nameof(inventory));
|
||||
|
@ -105,9 +103,7 @@ internal static class ArchiNet {
|
|||
}
|
||||
|
||||
internal static async Task<ImmutableHashSet<ListedUser>?> GetListedUsers(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
Uri request = new(URL, "/Api/Bots");
|
||||
|
||||
|
@ -117,9 +113,7 @@ internal static class ArchiNet {
|
|||
}
|
||||
|
||||
internal static async Task<HttpStatusCode?> HeartBeatForListing(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
Uri request = new(URL, "/Api/HeartBeat");
|
||||
|
||||
|
|
|
@ -342,9 +342,7 @@ internal sealed class Statistics : IAsyncDisposable {
|
|||
throw new ArgumentNullException(nameof(acceptedMatchableTypes));
|
||||
}
|
||||
|
||||
if (triedSteamIDs == null) {
|
||||
throw new ArgumentNullException(nameof(triedSteamIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(triedSteamIDs);
|
||||
|
||||
HashSet<Asset> ourInventory;
|
||||
|
||||
|
|
|
@ -51,9 +51,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static string GetArgsAsText(string[] args, byte argsToSkip, string delimiter) {
|
||||
if (args == null) {
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(args);
|
||||
|
||||
if (args.Length <= argsToSkip) {
|
||||
throw new InvalidOperationException($"{nameof(args.Length)} && {nameof(argsToSkip)}");
|
||||
|
@ -79,9 +77,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static string? GetCookieValue(this CookieContainer cookieContainer, Uri uri, string name) {
|
||||
if (cookieContainer == null) {
|
||||
throw new ArgumentNullException(nameof(cookieContainer));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(cookieContainer);
|
||||
|
||||
if (uri == null) {
|
||||
throw new ArgumentNullException(nameof(uri));
|
||||
|
@ -105,9 +101,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static async void InBackground(Action action, bool longRunning = false) {
|
||||
if (action == null) {
|
||||
throw new ArgumentNullException(nameof(action));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(action);
|
||||
|
||||
TaskCreationOptions options = TaskCreationOptions.DenyChildAttach;
|
||||
|
||||
|
@ -120,9 +114,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static async void InBackground<T>(Func<T> function, bool longRunning = false) {
|
||||
if (function == null) {
|
||||
throw new ArgumentNullException(nameof(function));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(function);
|
||||
|
||||
TaskCreationOptions options = TaskCreationOptions.DenyChildAttach;
|
||||
|
||||
|
@ -135,9 +127,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static async Task<IList<T>> InParallel<T>(IEnumerable<Task<T>> tasks) {
|
||||
if (tasks == null) {
|
||||
throw new ArgumentNullException(nameof(tasks));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(tasks);
|
||||
|
||||
IList<T> results;
|
||||
|
||||
|
@ -161,9 +151,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static async Task InParallel(IEnumerable<Task> tasks) {
|
||||
if (tasks == null) {
|
||||
throw new ArgumentNullException(nameof(tasks));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(tasks);
|
||||
|
||||
switch (ASF.GlobalConfig?.OptimizationMode) {
|
||||
case GlobalConfig.EOptimizationMode.MinMemoryUsage:
|
||||
|
@ -208,9 +196,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static IEnumerable<IElement> SelectNodes(this IDocument document, string xpath) {
|
||||
if (document == null) {
|
||||
throw new ArgumentNullException(nameof(document));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(document);
|
||||
|
||||
return document.Body.SelectNodes(xpath).OfType<IElement>();
|
||||
}
|
||||
|
@ -220,9 +206,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static IElement? SelectSingleNode(this IDocument document, string xpath) {
|
||||
if (document == null) {
|
||||
throw new ArgumentNullException(nameof(document));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(document);
|
||||
|
||||
return (IElement?) document.Body.SelectSingleNode(xpath);
|
||||
}
|
||||
|
@ -237,9 +221,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static Task<T> ToLongRunningTask<T>(this AsyncJob<T> job) where T : CallbackMsg {
|
||||
if (job == null) {
|
||||
throw new ArgumentNullException(nameof(job));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(job);
|
||||
|
||||
job.Timeout = TimeSpan.FromSeconds(TimeoutForLongRunningTasksInSeconds);
|
||||
|
||||
|
@ -248,9 +230,7 @@ public static class Utilities {
|
|||
|
||||
[PublicAPI]
|
||||
public static Task<AsyncJobMultiple<T>.ResultSet> ToLongRunningTask<T>(this AsyncJobMultiple<T> job) where T : CallbackMsg {
|
||||
if (job == null) {
|
||||
throw new ArgumentNullException(nameof(job));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(job);
|
||||
|
||||
job.Timeout = TimeSpan.FromSeconds(TimeoutForLongRunningTasksInSeconds);
|
||||
|
||||
|
@ -311,9 +291,7 @@ public static class Utilities {
|
|||
}
|
||||
|
||||
internal static void WarnAboutIncompleteTranslation(ResourceManager resourceManager) {
|
||||
if (resourceManager == null) {
|
||||
throw new ArgumentNullException(nameof(resourceManager));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(resourceManager);
|
||||
|
||||
// Skip translation progress for English and invariant (such as "C") cultures
|
||||
switch (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName) {
|
||||
|
|
|
@ -46,9 +46,7 @@ public sealed class ASFController : ArchiController {
|
|||
[ProducesResponseType(typeof(GenericResponse<string>), (int) HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
|
||||
public ActionResult<GenericResponse> ASFEncryptPost([FromBody] ASFEncryptRequest request) {
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (string.IsNullOrEmpty(request.StringToEncrypt)) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.StringToEncrypt))));
|
||||
|
@ -84,9 +82,7 @@ public sealed class ASFController : ArchiController {
|
|||
[ProducesResponseType(typeof(GenericResponse<string>), (int) HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
|
||||
public ActionResult<GenericResponse> ASFHashPost([FromBody] ASFHashRequest request) {
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (string.IsNullOrEmpty(request.StringToHash)) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.StringToHash))));
|
||||
|
@ -105,9 +101,7 @@ public sealed class ASFController : ArchiController {
|
|||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
|
||||
public async Task<ActionResult<GenericResponse>> ASFPost([FromBody] ASFRequest request) {
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (ASF.GlobalConfig == null) {
|
||||
throw new InvalidOperationException(nameof(ASF.GlobalConfig));
|
||||
|
|
|
@ -94,9 +94,7 @@ public sealed class BotController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botNames));
|
||||
}
|
||||
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (Bot.Bots == null) {
|
||||
throw new InvalidOperationException(nameof(Bot.Bots));
|
||||
|
@ -220,9 +218,7 @@ public sealed class BotController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botNames));
|
||||
}
|
||||
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (request.GamesToRedeemInBackground.Count == 0) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.GamesToRedeemInBackground))));
|
||||
|
@ -263,9 +259,7 @@ public sealed class BotController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botNames));
|
||||
}
|
||||
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if ((request.Type == ASF.EUserInputType.None) || !Enum.IsDefined(typeof(ASF.EUserInputType), request.Type) || string.IsNullOrEmpty(request.Value)) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, $"{nameof(request.Type)} || {nameof(request.Value)}")));
|
||||
|
@ -294,9 +288,7 @@ public sealed class BotController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botNames));
|
||||
}
|
||||
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
HashSet<Bot>? bots = Bot.GetBots(botNames);
|
||||
|
||||
|
@ -325,9 +317,7 @@ public sealed class BotController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botNames));
|
||||
}
|
||||
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (request.KeysToRedeem.Count == 0) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.KeysToRedeem))));
|
||||
|
@ -369,9 +359,7 @@ public sealed class BotController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botName));
|
||||
}
|
||||
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (Bot.Bots == null) {
|
||||
throw new InvalidOperationException(nameof(Bot.Bots));
|
||||
|
|
|
@ -48,9 +48,7 @@ public sealed class CommandController : ArchiController {
|
|||
[ProducesResponseType(typeof(GenericResponse<string>), (int) HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
|
||||
public async Task<ActionResult<GenericResponse>> CommandPost([FromBody] CommandRequest request) {
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (string.IsNullOrEmpty(request.Command)) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.Command))));
|
||||
|
|
|
@ -112,9 +112,7 @@ public sealed class NLogController : ArchiController {
|
|||
}
|
||||
|
||||
internal static async void OnNewHistoryEntry(object? sender, HistoryTarget.NewHistoryEntryArgs newHistoryEntryArgs) {
|
||||
if (newHistoryEntryArgs == null) {
|
||||
throw new ArgumentNullException(nameof(newHistoryEntryArgs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(newHistoryEntryArgs);
|
||||
|
||||
if (ActiveLogWebSockets.IsEmpty) {
|
||||
return;
|
||||
|
@ -126,17 +124,13 @@ public sealed class NLogController : ArchiController {
|
|||
}
|
||||
|
||||
private static async Task PostLoggedJsonUpdate(WebSocket webSocket, string json, SemaphoreSlim sendSemaphore, CancellationToken cancellationToken) {
|
||||
if (webSocket == null) {
|
||||
throw new ArgumentNullException(nameof(webSocket));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(webSocket);
|
||||
|
||||
if (string.IsNullOrEmpty(json)) {
|
||||
throw new ArgumentNullException(nameof(json));
|
||||
}
|
||||
|
||||
if (sendSemaphore == null) {
|
||||
throw new ArgumentNullException(nameof(sendSemaphore));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(sendSemaphore);
|
||||
|
||||
if (cancellationToken.IsCancellationRequested || (webSocket.State != WebSocketState.Open)) {
|
||||
return;
|
||||
|
@ -170,17 +164,13 @@ public sealed class NLogController : ArchiController {
|
|||
}
|
||||
|
||||
private static async Task PostLoggedMessageUpdate(WebSocket webSocket, string loggedMessage, SemaphoreSlim sendSemaphore, CancellationToken cancellationToken) {
|
||||
if (webSocket == null) {
|
||||
throw new ArgumentNullException(nameof(webSocket));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(webSocket);
|
||||
|
||||
if (string.IsNullOrEmpty(loggedMessage)) {
|
||||
throw new ArgumentNullException(nameof(loggedMessage));
|
||||
}
|
||||
|
||||
if (sendSemaphore == null) {
|
||||
throw new ArgumentNullException(nameof(sendSemaphore));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(sendSemaphore);
|
||||
|
||||
if (cancellationToken.IsCancellationRequested || (webSocket.State != WebSocketState.Open)) {
|
||||
return;
|
||||
|
|
|
@ -79,9 +79,7 @@ public sealed class StorageController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(value);
|
||||
|
||||
if (ASF.GlobalDatabase == null) {
|
||||
throw new InvalidOperationException(nameof(ASF.GlobalDatabase));
|
||||
|
|
|
@ -49,9 +49,7 @@ public sealed class TwoFactorAuthenticationController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botNames));
|
||||
}
|
||||
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
|
||||
if (request.AcceptedType.HasValue && ((request.AcceptedType.Value == Confirmation.EType.Unknown) || !Enum.IsDefined(typeof(Confirmation.EType), request.AcceptedType.Value))) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(request.AcceptedType))));
|
||||
|
@ -116,9 +114,7 @@ public sealed class TwoFactorAuthenticationController : ArchiController {
|
|||
throw new ArgumentNullException(nameof(botNames));
|
||||
}
|
||||
|
||||
if (authenticator == null) {
|
||||
throw new ArgumentNullException(nameof(authenticator));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(authenticator);
|
||||
|
||||
HashSet<Bot>? bots = Bot.GetBots(botNames);
|
||||
|
||||
|
|
|
@ -59,9 +59,7 @@ internal sealed class ApiAuthenticationMiddleware {
|
|||
public ApiAuthenticationMiddleware(RequestDelegate next, IOptions<ForwardedHeadersOptions> forwardedHeadersOptions) {
|
||||
Next = next ?? throw new ArgumentNullException(nameof(next));
|
||||
|
||||
if (forwardedHeadersOptions == null) {
|
||||
throw new ArgumentNullException(nameof(forwardedHeadersOptions));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(forwardedHeadersOptions);
|
||||
|
||||
ForwardedHeadersOptions = forwardedHeadersOptions.Value ?? throw new InvalidOperationException(nameof(forwardedHeadersOptions));
|
||||
|
||||
|
@ -72,13 +70,9 @@ internal sealed class ApiAuthenticationMiddleware {
|
|||
|
||||
[UsedImplicitly]
|
||||
public async Task InvokeAsync(HttpContext context, IOptions<MvcNewtonsoftJsonOptions> jsonOptions) {
|
||||
if (context == null) {
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
|
||||
if (jsonOptions == null) {
|
||||
throw new ArgumentNullException(nameof(jsonOptions));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(jsonOptions);
|
||||
|
||||
(HttpStatusCode statusCode, bool permanent) = await GetAuthenticationStatus(context).ConfigureAwait(false);
|
||||
|
||||
|
@ -98,9 +92,7 @@ internal sealed class ApiAuthenticationMiddleware {
|
|||
private static void ClearFailedAuthorizations(object? state = null) => FailedAuthorizations.Clear();
|
||||
|
||||
private async Task<(HttpStatusCode StatusCode, bool Permanent)> GetAuthenticationStatus(HttpContext context) {
|
||||
if (context == null) {
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
|
||||
IPAddress? clientIP = context.Connection.RemoteIpAddress;
|
||||
|
||||
|
|
|
@ -30,13 +30,9 @@ namespace ArchiSteamFarm.IPC.Integration;
|
|||
[UsedImplicitly]
|
||||
internal sealed class CustomAttributesSchemaFilter : ISchemaFilter {
|
||||
public void Apply(OpenApiSchema schema, SchemaFilterContext context) {
|
||||
if (schema == null) {
|
||||
throw new ArgumentNullException(nameof(schema));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
|
||||
if (context == null) {
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
|
||||
ICustomAttributeProvider attributesProvider;
|
||||
|
||||
|
|
|
@ -32,13 +32,9 @@ namespace ArchiSteamFarm.IPC.Integration;
|
|||
[UsedImplicitly]
|
||||
internal sealed class EnumSchemaFilter : ISchemaFilter {
|
||||
public void Apply(OpenApiSchema schema, SchemaFilterContext context) {
|
||||
if (schema == null) {
|
||||
throw new ArgumentNullException(nameof(schema));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
|
||||
if (context == null) {
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
|
||||
if (context.Type is not { IsEnum: true }) {
|
||||
return;
|
||||
|
@ -91,9 +87,7 @@ internal sealed class EnumSchemaFilter : ISchemaFilter {
|
|||
}
|
||||
|
||||
private static bool TryCast<T>(object value, out T typedValue) where T : struct {
|
||||
if (value == null) {
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(value);
|
||||
|
||||
try {
|
||||
typedValue = (T) Convert.ChangeType(value, typeof(T), CultureInfo.InvariantCulture);
|
||||
|
|
|
@ -45,9 +45,7 @@ internal sealed class LocalizationMiddleware {
|
|||
|
||||
[UsedImplicitly]
|
||||
public async Task InvokeAsync(HttpContext context) {
|
||||
if (context == null) {
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(context);
|
||||
|
||||
RequestHeaders headers = context.Request.GetTypedHeaders();
|
||||
|
||||
|
|
|
@ -41,9 +41,7 @@ public sealed class SwaggerItemsMinMaxAttribute : CustomSwaggerAttribute {
|
|||
private decimal? BackingMinimum;
|
||||
|
||||
public override void Apply(OpenApiSchema schema) {
|
||||
if (schema == null) {
|
||||
throw new ArgumentNullException(nameof(schema));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
|
||||
if (schema.Items == null) {
|
||||
throw new InvalidOperationException(nameof(schema.Items));
|
||||
|
|
|
@ -34,9 +34,7 @@ public sealed class SwaggerSteamIdentifierAttribute : CustomSwaggerAttribute {
|
|||
public EUniverse Universe { get; set; } = EUniverse.Public;
|
||||
|
||||
public override void Apply(OpenApiSchema schema) {
|
||||
if (schema == null) {
|
||||
throw new ArgumentNullException(nameof(schema));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
|
||||
schema.Minimum = new SteamID(MinimumAccountID, Universe, AccountType);
|
||||
schema.Maximum = new SteamID(MaximumAccountID, Universe, AccountType);
|
||||
|
|
|
@ -34,9 +34,7 @@ public sealed class SwaggerValidValuesAttribute : CustomSwaggerAttribute {
|
|||
public string[]? ValidStringValues { get; set; }
|
||||
|
||||
public override void Apply(OpenApiSchema schema) {
|
||||
if (schema == null) {
|
||||
throw new ArgumentNullException(nameof(schema));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
|
||||
OpenApiArray validValues = new();
|
||||
|
||||
|
|
|
@ -59,9 +59,7 @@ public sealed class TwoFactorAuthenticationConfirmationsRequest {
|
|||
public ImmutableHashSet<string> SAcceptedCreatorIDs {
|
||||
get => AcceptedCreatorIDs.Select(static creatorID => creatorID.ToString(CultureInfo.InvariantCulture)).ToImmutableHashSet();
|
||||
set {
|
||||
if (value == null) {
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(value);
|
||||
|
||||
HashSet<ulong> acceptedCreatorIDs = new();
|
||||
|
||||
|
|
|
@ -56,9 +56,7 @@ public sealed class GitHubReleaseResponse {
|
|||
public string Version { get; private set; }
|
||||
|
||||
internal GitHubReleaseResponse(GitHub.ReleaseResponse releaseResponse) {
|
||||
if (releaseResponse == null) {
|
||||
throw new ArgumentNullException(nameof(releaseResponse));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(releaseResponse);
|
||||
|
||||
ChangelogHTML = releaseResponse.ChangelogHTML ?? "";
|
||||
ReleasedAt = releaseResponse.PublishedAt;
|
||||
|
|
|
@ -62,13 +62,9 @@ internal sealed class Startup {
|
|||
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "PathString is a primitive, it's unlikely to be trimmed to the best of our knowledge")]
|
||||
[UsedImplicitly]
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
|
||||
if (app == null) {
|
||||
throw new ArgumentNullException(nameof(app));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(app);
|
||||
|
||||
if (env == null) {
|
||||
throw new ArgumentNullException(nameof(env));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(env);
|
||||
|
||||
// The order of dependency injection is super important, doing things in wrong order will break everything
|
||||
// https://docs.microsoft.com/aspnet/core/fundamentals/middleware
|
||||
|
@ -189,9 +185,7 @@ internal sealed class Startup {
|
|||
|
||||
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "HashSet<string> isn't a primitive, but we widely use the required features everywhere and it's unlikely to be trimmed to the best of our knowledge")]
|
||||
public void ConfigureServices(IServiceCollection services) {
|
||||
if (services == null) {
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(services);
|
||||
|
||||
// The order of dependency injection is super important, doing things in wrong order will break everything
|
||||
// Order in Configure() method is a good start
|
||||
|
|
|
@ -76,9 +76,7 @@ internal static class WebUtilities {
|
|||
#endif
|
||||
|
||||
internal static string? GetUnifiedName(this Type type) {
|
||||
if (type == null) {
|
||||
throw new ArgumentNullException(nameof(type));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(type);
|
||||
|
||||
return type.GenericTypeArguments.Length == 0 ? type.FullName : $"{type.Namespace}.{type.Name}{string.Join("", type.GenericTypeArguments.Select(static innerType => $"[{innerType.GetUnifiedName()}]"))}";
|
||||
}
|
||||
|
@ -106,9 +104,7 @@ internal static class WebUtilities {
|
|||
}
|
||||
|
||||
internal static async Task WriteJsonAsync<TValue>(this HttpResponse response, TValue? value, JsonSerializerSettings? jsonSerializerSettings = null) {
|
||||
if (response == null) {
|
||||
throw new ArgumentNullException(nameof(response));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(response);
|
||||
|
||||
JsonSerializer serializer = JsonSerializer.CreateDefault(jsonSerializerSettings);
|
||||
|
||||
|
|
|
@ -55,9 +55,7 @@ public sealed class ArchiLogger {
|
|||
|
||||
[PublicAPI]
|
||||
public void LogGenericDebuggingException(Exception exception, [CallerMemberName] string? previousMethodName = null) {
|
||||
if (exception == null) {
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(exception);
|
||||
|
||||
if (!Debugging.IsUserDebugging) {
|
||||
return;
|
||||
|
@ -77,9 +75,7 @@ public sealed class ArchiLogger {
|
|||
|
||||
[PublicAPI]
|
||||
public void LogGenericException(Exception exception, [CallerMemberName] string? previousMethodName = null) {
|
||||
if (exception == null) {
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(exception);
|
||||
|
||||
Logger.Error(exception, $"{previousMethodName}()");
|
||||
}
|
||||
|
@ -113,9 +109,7 @@ public sealed class ArchiLogger {
|
|||
|
||||
[PublicAPI]
|
||||
public void LogGenericWarningException(Exception exception, [CallerMemberName] string? previousMethodName = null) {
|
||||
if (exception == null) {
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(exception);
|
||||
|
||||
Logger.Warn(exception, $"{previousMethodName}()");
|
||||
}
|
||||
|
@ -164,9 +158,7 @@ public sealed class ArchiLogger {
|
|||
}
|
||||
|
||||
internal async Task LogFatalException(Exception exception, [CallerMemberName] string? previousMethodName = null) {
|
||||
if (exception == null) {
|
||||
throw new ArgumentNullException(nameof(exception));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(exception);
|
||||
|
||||
Logger.Fatal(exception, $"{previousMethodName}()");
|
||||
|
||||
|
|
|
@ -406,9 +406,7 @@ internal static class Logging {
|
|||
}
|
||||
|
||||
private static void OnConfigurationChanged(object? sender, LoggingConfigurationChangedEventArgs e) {
|
||||
if (e == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
InitConsoleLoggers();
|
||||
|
||||
|
|
|
@ -63,9 +63,7 @@ internal sealed class HistoryTarget : TargetWithLayout {
|
|||
internal HistoryTarget(string name) : this() => Name = name;
|
||||
|
||||
protected override void Write(LogEventInfo logEvent) {
|
||||
if (logEvent == null) {
|
||||
throw new ArgumentNullException(nameof(logEvent));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(logEvent);
|
||||
|
||||
base.Write(logEvent);
|
||||
|
||||
|
|
|
@ -59,9 +59,7 @@ internal sealed class SteamTarget : AsyncTaskTarget {
|
|||
public SteamTarget() => Layout = "${level:uppercase=true}|${logger}|${message}";
|
||||
|
||||
protected override async Task WriteAsyncTask(LogEventInfo logEvent, CancellationToken cancellationToken) {
|
||||
if (logEvent == null) {
|
||||
throw new ArgumentNullException(nameof(logEvent));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(logEvent);
|
||||
|
||||
base.Write(logEvent);
|
||||
|
||||
|
|
|
@ -267,9 +267,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task<string?> OnBotCommand(Bot bot, ulong steamID, string message, string[] args) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
||||
throw new ArgumentOutOfRangeException(nameof(steamID));
|
||||
|
@ -301,9 +299,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotDestroy(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -317,9 +313,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotDisconnected(Bot bot, EResult reason) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -333,9 +327,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotFarmingFinished(Bot bot, bool farmedSomething) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -349,9 +341,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotFarmingStarted(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -365,9 +355,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotFarmingStopped(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -381,9 +369,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task<bool> OnBotFriendRequest(Bot bot, ulong steamID) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsValid) {
|
||||
throw new ArgumentOutOfRangeException(nameof(steamID));
|
||||
|
@ -407,9 +393,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotInit(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -423,9 +407,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotInitModules(Bot bot, IReadOnlyDictionary<string, JToken>? additionalConfigProperties = null) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -439,9 +421,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotLoggedOn(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -455,9 +435,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task<string?> OnBotMessage(Bot bot, ulong steamID, string message) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
||||
throw new ArgumentOutOfRangeException(nameof(steamID));
|
||||
|
@ -485,13 +463,9 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotSteamCallbacksInit(Bot bot, CallbackManager callbackManager) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if (callbackManager == null) {
|
||||
throw new ArgumentNullException(nameof(callbackManager));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callbackManager);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
@ -505,9 +479,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task<HashSet<ClientMsgHandler>?> OnBotSteamHandlersInit(Bot bot) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return null;
|
||||
|
@ -527,13 +499,9 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task<bool> OnBotTradeOffer(Bot bot, TradeOffer tradeOffer) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if (tradeOffer == null) {
|
||||
throw new ArgumentNullException(nameof(tradeOffer));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(tradeOffer);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return false;
|
||||
|
@ -553,9 +521,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotTradeOfferResults(Bot bot, IReadOnlyCollection<ParseTradeResult> tradeResults) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((tradeResults == null) || (tradeResults.Count == 0)) {
|
||||
throw new ArgumentNullException(nameof(tradeResults));
|
||||
|
@ -573,9 +539,7 @@ internal static class PluginsCore {
|
|||
}
|
||||
|
||||
internal static async Task OnBotUserNotifications(Bot bot, IReadOnlyCollection<UserNotificationsCallback.EUserNotification> newNotifications) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((newNotifications == null) || (newNotifications.Count == 0)) {
|
||||
throw new ArgumentNullException(nameof(newNotifications));
|
||||
|
@ -597,13 +561,9 @@ internal static class PluginsCore {
|
|||
throw new ArgumentOutOfRangeException(nameof(currentChangeNumber));
|
||||
}
|
||||
|
||||
if (appChanges == null) {
|
||||
throw new ArgumentNullException(nameof(appChanges));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(appChanges);
|
||||
|
||||
if (packageChanges == null) {
|
||||
throw new ArgumentNullException(nameof(packageChanges));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(packageChanges);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
|
|
|
@ -445,9 +445,7 @@ internal static class Program {
|
|||
}
|
||||
|
||||
private static async Task<int> Main(string[] args) {
|
||||
if (args == null) {
|
||||
throw new ArgumentNullException(nameof(args));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(args);
|
||||
|
||||
// Initialize
|
||||
await Init(args.Length > 0 ? args : null).ConfigureAwait(false);
|
||||
|
@ -460,9 +458,7 @@ internal static class Program {
|
|||
|
||||
#if !NETFRAMEWORK
|
||||
private static async void OnPosixSignal(PosixSignalContext signal) {
|
||||
if (signal == null) {
|
||||
throw new ArgumentNullException(nameof(signal));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(signal);
|
||||
|
||||
switch (signal.Signal) {
|
||||
case PosixSignal.SIGINT:
|
||||
|
@ -480,9 +476,7 @@ internal static class Program {
|
|||
private static async void OnProcessExit(object? sender, EventArgs e) => await Shutdown().ConfigureAwait(false);
|
||||
|
||||
private static async void OnUnhandledException(object? sender, UnhandledExceptionEventArgs e) {
|
||||
if (e == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
if (e.ExceptionObject == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
|
@ -493,9 +487,7 @@ internal static class Program {
|
|||
}
|
||||
|
||||
private static async void OnUnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e) {
|
||||
if (e == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(e);
|
||||
|
||||
if (e.Exception == null) {
|
||||
throw new ArgumentNullException(nameof(e));
|
||||
|
|
|
@ -1270,9 +1270,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
internal async Task IdleGame(Game game) {
|
||||
if (game == null) {
|
||||
throw new ArgumentNullException(nameof(game));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(game);
|
||||
|
||||
string? gameName = null;
|
||||
|
||||
|
@ -1709,9 +1707,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
internal bool TryImportAuthenticator(MobileAuthenticator authenticator) {
|
||||
if (authenticator == null) {
|
||||
throw new ArgumentNullException(nameof(authenticator));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(authenticator);
|
||||
|
||||
if (HasMobileAuthenticator) {
|
||||
return false;
|
||||
|
@ -1872,9 +1868,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private HashSet<uint>? GetPossiblyCompletedBadgeAppIDs(IDocument badgePage) {
|
||||
if (badgePage == null) {
|
||||
throw new ArgumentNullException(nameof(badgePage));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(badgePage);
|
||||
|
||||
// We select badges that are ready to craft, as well as those that are already crafted to a maximum level, as those will not display with a craft button
|
||||
// Level 5 is maximum level for card badges according to https://steamcommunity.com/tradingcards/faq
|
||||
|
@ -2211,9 +2205,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnConnected(SteamClient.ConnectedCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
HeartBeatFailures = 0;
|
||||
ReconnectOnUserInitiated = false;
|
||||
|
@ -2335,9 +2327,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnDisconnected(SteamClient.DisconnectedCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (ASF.LoginRateLimitingSemaphore == null) {
|
||||
throw new InvalidOperationException(nameof(ASF.LoginRateLimitingSemaphore));
|
||||
|
@ -2411,9 +2401,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnFriendsList(SteamFriends.FriendsListCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (callback.FriendList == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
|
@ -2492,9 +2480,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnGuestPassList(SteamApps.GuestPassListCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (callback.GuestPasses == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
|
@ -2514,9 +2500,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async Task OnIncomingChatMessage(CChatRoom_IncomingChatMessage_Notification notification) {
|
||||
if (notification == null) {
|
||||
throw new ArgumentNullException(nameof(notification));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(notification);
|
||||
|
||||
if ((notification.chat_group_id == 0) || (notification.chat_id == 0) || (notification.steamid_sender == 0)) {
|
||||
ArchiLogger.LogNullError($"{nameof(notification.chat_group_id)} || {nameof(notification.chat_id)} || {nameof(notification.steamid_sender)}");
|
||||
|
@ -2556,9 +2540,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async Task OnIncomingMessage(CFriendMessages_IncomingMessage_Notification notification) {
|
||||
if (notification == null) {
|
||||
throw new ArgumentNullException(nameof(notification));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(notification);
|
||||
|
||||
if (notification.steamid_friend == 0) {
|
||||
ArchiLogger.LogNullError(nameof(notification.steamid_friend));
|
||||
|
@ -2614,9 +2596,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnLicenseList(SteamApps.LicenseListCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (callback.LicenseList == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
|
@ -2673,9 +2653,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private void OnLoggedOff(SteamUser.LoggedOffCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
LastLogOnResult = callback.Result;
|
||||
|
||||
|
@ -2707,9 +2685,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnLoggedOn(SteamUser.LoggedOnCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
// Always reset one-time-only access tokens when we get OnLoggedOn() response
|
||||
AuthCode = TwoFactorCode = null;
|
||||
|
@ -2935,9 +2911,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private void OnLoginKey(SteamUser.LoginKeyCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (string.IsNullOrEmpty(callback.LoginKey)) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
|
@ -2958,9 +2932,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnMachineAuth(SteamUser.UpdateMachineAuthCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
string sentryFilePath = GetFilePath(EFileType.SentryFile);
|
||||
|
||||
|
@ -3021,9 +2993,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private void OnPersonaState(SteamFriends.PersonaStateCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (callback.FriendID != SteamID) {
|
||||
return;
|
||||
|
@ -3050,9 +3020,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnPlayingSessionState(ArchiHandler.PlayingSessionStateCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (callback.PlayingBlocked == PlayingBlocked) {
|
||||
return; // No status update, we're not interested
|
||||
|
@ -3065,9 +3033,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
private async void OnSendItemsTimer(object? state = null) => await Actions.SendInventory(filterFunction: item => BotConfig.LootableTypes.Contains(item.Type)).ConfigureAwait(false);
|
||||
|
||||
private async void OnServiceMethod(SteamUnifiedMessages.ServiceMethodNotification notification) {
|
||||
if (notification == null) {
|
||||
throw new ArgumentNullException(nameof(notification));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(notification);
|
||||
|
||||
switch (notification.MethodName) {
|
||||
case "ChatRoomClient.NotifyIncomingChatMessage#1":
|
||||
|
@ -3082,9 +3048,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async void OnSharedLibraryLockStatus(ArchiHandler.SharedLibraryLockStatusCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
// Ignore no status updates
|
||||
if (LibraryLocked) {
|
||||
|
@ -3105,9 +3069,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private void OnUserNotifications(UserNotificationsCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
if (callback.Notifications == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
|
@ -3158,17 +3120,13 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private void OnVanityURLChangedCallback(SteamUser.VanityURLChangedCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
ArchiWebHandler.OnVanityURLChanged(callback.VanityURL);
|
||||
}
|
||||
|
||||
private void OnWalletUpdate(SteamUser.WalletInfoCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
WalletBalance = callback.LongBalance;
|
||||
WalletCurrency = callback.Currency;
|
||||
|
@ -3492,9 +3450,7 @@ public sealed class Bot : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private (bool IsSteamParentalEnabled, string? SteamParentalCode) ValidateSteamParental(ParentalSettings settings, string? steamParentalCode = null) {
|
||||
if (settings == null) {
|
||||
throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
|
||||
if (!settings.is_enabled) {
|
||||
return (false, null);
|
||||
|
|
|
@ -394,13 +394,9 @@ public sealed class CardsFarmer : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async Task CheckPage(IDocument htmlDocument, ISet<uint> parsedAppIDs) {
|
||||
if (htmlDocument == null) {
|
||||
throw new ArgumentNullException(nameof(htmlDocument));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(htmlDocument);
|
||||
|
||||
if (parsedAppIDs == null) {
|
||||
throw new ArgumentNullException(nameof(parsedAppIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(parsedAppIDs);
|
||||
|
||||
IEnumerable<IElement> htmlNodes = htmlDocument.SelectNodes("//div[@class='badge_row_inner']");
|
||||
|
||||
|
@ -716,9 +712,7 @@ public sealed class CardsFarmer : IAsyncDisposable {
|
|||
throw new ArgumentOutOfRangeException(nameof(page));
|
||||
}
|
||||
|
||||
if (parsedAppIDs == null) {
|
||||
throw new ArgumentNullException(nameof(parsedAppIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(parsedAppIDs);
|
||||
|
||||
using IDocument? htmlDocument = await Bot.ArchiWebHandler.GetBadgePage(page).ConfigureAwait(false);
|
||||
|
||||
|
@ -829,9 +823,7 @@ public sealed class CardsFarmer : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async Task<bool> FarmCards(Game game) {
|
||||
if (game == null) {
|
||||
throw new ArgumentNullException(nameof(game));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(game);
|
||||
|
||||
if (game.AppID != game.PlayableAppID) {
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningIdlingGameMismatch, game.AppID, game.GameName, game.PlayableAppID));
|
||||
|
@ -936,9 +928,7 @@ public sealed class CardsFarmer : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async Task<bool> FarmSolo(Game game) {
|
||||
if (game == null) {
|
||||
throw new ArgumentNullException(nameof(game));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(game);
|
||||
|
||||
CurrentGamesFarming.Add(game);
|
||||
|
||||
|
@ -1076,9 +1066,7 @@ public sealed class CardsFarmer : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async Task<bool> IsPlayableGame(Game game) {
|
||||
if (game == null) {
|
||||
throw new ArgumentNullException(nameof(game));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(game);
|
||||
|
||||
(uint playableAppID, DateTime ignoredUntil, bool ignoredGlobally) = await Bot.GetAppDataForIdling(game.AppID, game.HoursPlayed).ConfigureAwait(false);
|
||||
|
||||
|
@ -1097,9 +1085,7 @@ public sealed class CardsFarmer : IAsyncDisposable {
|
|||
}
|
||||
|
||||
private async Task<bool?> ShouldFarm(Game game) {
|
||||
if (game == null) {
|
||||
throw new ArgumentNullException(nameof(game));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(game);
|
||||
|
||||
ushort? cardsRemaining = await GetCardsRemaining(game.AppID).ConfigureAwait(false);
|
||||
|
||||
|
|
|
@ -292,13 +292,9 @@ public sealed class Trading : IDisposable {
|
|||
}
|
||||
|
||||
internal static bool IsEmptyForMatching(IReadOnlyDictionary<(uint RealAppID, Asset.EType Type, Asset.ERarity Rarity), Dictionary<ulong, uint>> fullState, IReadOnlyDictionary<(uint RealAppID, Asset.EType Type, Asset.ERarity Rarity), Dictionary<ulong, uint>> tradableState) {
|
||||
if (fullState == null) {
|
||||
throw new ArgumentNullException(nameof(fullState));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(fullState);
|
||||
|
||||
if (tradableState == null) {
|
||||
throw new ArgumentNullException(nameof(tradableState));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(tradableState);
|
||||
|
||||
foreach (((uint RealAppID, Asset.EType Type, Asset.ERarity Rarity) set, IReadOnlyDictionary<ulong, uint> state) in tradableState) {
|
||||
if (!fullState.TryGetValue(set, out Dictionary<ulong, uint>? fullSet) || (fullSet.Count == 0)) {
|
||||
|
@ -315,13 +311,9 @@ public sealed class Trading : IDisposable {
|
|||
}
|
||||
|
||||
internal static bool IsEmptyForMatching(IReadOnlyDictionary<ulong, uint> fullSet, IReadOnlyDictionary<ulong, uint> tradableSet) {
|
||||
if (fullSet == null) {
|
||||
throw new ArgumentNullException(nameof(fullSet));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(fullSet);
|
||||
|
||||
if (tradableSet == null) {
|
||||
throw new ArgumentNullException(nameof(tradableSet));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(tradableSet);
|
||||
|
||||
foreach ((ulong classID, uint amount) in tradableSet) {
|
||||
switch (amount) {
|
||||
|
@ -446,9 +438,7 @@ public sealed class Trading : IDisposable {
|
|||
}
|
||||
|
||||
private async Task<(ParseTradeResult? TradeResult, bool RequiresMobileConfirmation)> ParseTrade(TradeOffer tradeOffer) {
|
||||
if (tradeOffer == null) {
|
||||
throw new ArgumentNullException(nameof(tradeOffer));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(tradeOffer);
|
||||
|
||||
if (tradeOffer.State != ETradeOfferState.Active) {
|
||||
Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, tradeOffer.State));
|
||||
|
@ -527,9 +517,7 @@ public sealed class Trading : IDisposable {
|
|||
}
|
||||
|
||||
private async Task<ParseTradeResult.EResult> ShouldAcceptTrade(TradeOffer tradeOffer) {
|
||||
if (tradeOffer == null) {
|
||||
throw new ArgumentNullException(nameof(tradeOffer));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(tradeOffer);
|
||||
|
||||
if (ASF.GlobalConfig == null) {
|
||||
throw new InvalidOperationException(nameof(ASF.GlobalConfig));
|
||||
|
|
|
@ -48,9 +48,7 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
|||
internal DateTime LastPacketReceived { get; private set; }
|
||||
|
||||
internal ArchiHandler(ArchiLogger archiLogger, SteamUnifiedMessages steamUnifiedMessages) {
|
||||
if (steamUnifiedMessages == null) {
|
||||
throw new ArgumentNullException(nameof(steamUnifiedMessages));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(steamUnifiedMessages);
|
||||
|
||||
ArchiLogger = archiLogger ?? throw new ArgumentNullException(nameof(archiLogger));
|
||||
UnifiedChatRoomService = steamUnifiedMessages.CreateService<IChatRoom>();
|
||||
|
@ -132,9 +130,7 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
|||
}
|
||||
|
||||
public override void HandleMsg(IPacketMsg packetMsg) {
|
||||
if (packetMsg == null) {
|
||||
throw new ArgumentNullException(nameof(packetMsg));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(packetMsg);
|
||||
|
||||
if (Client == null) {
|
||||
throw new InvalidOperationException(nameof(Client));
|
||||
|
@ -499,9 +495,7 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
|||
}
|
||||
|
||||
internal async Task PlayGames(IReadOnlyCollection<uint> gameIDs, string? gameName = null) {
|
||||
if (gameIDs == null) {
|
||||
throw new ArgumentNullException(nameof(gameIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(gameIDs);
|
||||
|
||||
if (Client == null) {
|
||||
throw new InvalidOperationException(nameof(Client));
|
||||
|
@ -777,9 +771,7 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
|||
throw new ArgumentNullException(nameof(jobID));
|
||||
}
|
||||
|
||||
if (msg == null) {
|
||||
throw new ArgumentNullException(nameof(msg));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(msg);
|
||||
|
||||
JobID = jobID;
|
||||
PlayingBlocked = msg.playing_blocked;
|
||||
|
@ -794,9 +786,7 @@ public sealed class ArchiHandler : ClientMsgHandler {
|
|||
throw new ArgumentNullException(nameof(jobID));
|
||||
}
|
||||
|
||||
if (msg == null) {
|
||||
throw new ArgumentNullException(nameof(msg));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(msg);
|
||||
|
||||
JobID = jobID;
|
||||
|
||||
|
|
|
@ -1163,9 +1163,7 @@ public sealed class ArchiWebHandler : IDisposable {
|
|||
throw new ArgumentNullException(nameof(service));
|
||||
}
|
||||
|
||||
if (function == null) {
|
||||
throw new ArgumentNullException(nameof(function));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(function);
|
||||
|
||||
if (ASF.RateLimitingSemaphore == null) {
|
||||
throw new InvalidOperationException(nameof(ASF.RateLimitingSemaphore));
|
||||
|
@ -1325,9 +1323,7 @@ public sealed class ArchiWebHandler : IDisposable {
|
|||
}
|
||||
|
||||
internal async Task<bool> ChangePrivacySettings(UserPrivacy userPrivacy) {
|
||||
if (userPrivacy == null) {
|
||||
throw new ArgumentNullException(nameof(userPrivacy));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(userPrivacy);
|
||||
|
||||
string? profileURL = await GetAbsoluteProfileURL().ConfigureAwait(false);
|
||||
|
||||
|
@ -2485,17 +2481,13 @@ public sealed class ArchiWebHandler : IDisposable {
|
|||
}
|
||||
|
||||
private static bool ParseItems(IReadOnlyDictionary<(uint AppID, ulong ClassID, ulong InstanceID), InventoryResponse.Description> descriptions, IReadOnlyCollection<KeyValue> input, ICollection<Asset> output) {
|
||||
if (descriptions == null) {
|
||||
throw new ArgumentNullException(nameof(descriptions));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(descriptions);
|
||||
|
||||
if ((input == null) || (input.Count == 0)) {
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
throw new ArgumentNullException(nameof(output));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(output);
|
||||
|
||||
foreach (KeyValue item in input) {
|
||||
uint appID = item["appid"].AsUnsignedInteger();
|
||||
|
|
|
@ -32,9 +32,7 @@ internal sealed class CMsgClientAcknowledgeClanInvite : ISteamSerializableMessag
|
|||
internal ulong ClanID { private get; set; }
|
||||
|
||||
void ISteamSerializable.Deserialize(Stream stream) {
|
||||
if (stream == null) {
|
||||
throw new ArgumentNullException(nameof(stream));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
|
||||
using BinaryReader binaryReader = new(stream, Encoding.UTF8, true);
|
||||
|
||||
|
@ -45,9 +43,7 @@ internal sealed class CMsgClientAcknowledgeClanInvite : ISteamSerializableMessag
|
|||
EMsg ISteamSerializableMessage.GetEMsg() => EMsg.ClientAcknowledgeClanInvite;
|
||||
|
||||
void ISteamSerializable.Serialize(Stream stream) {
|
||||
if (stream == null) {
|
||||
throw new ArgumentNullException(nameof(stream));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(stream);
|
||||
|
||||
using BinaryWriter binaryWriter = new(stream, Encoding.UTF8, true);
|
||||
|
||||
|
|
|
@ -38,9 +38,7 @@ public sealed class UserNotificationsCallback : CallbackMsg {
|
|||
throw new ArgumentNullException(nameof(jobID));
|
||||
}
|
||||
|
||||
if (msg == null) {
|
||||
throw new ArgumentNullException(nameof(msg));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(msg);
|
||||
|
||||
JobID = jobID;
|
||||
|
||||
|
@ -82,9 +80,7 @@ public sealed class UserNotificationsCallback : CallbackMsg {
|
|||
throw new ArgumentNullException(nameof(jobID));
|
||||
}
|
||||
|
||||
if (msg == null) {
|
||||
throw new ArgumentNullException(nameof(msg));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(msg);
|
||||
|
||||
JobID = jobID;
|
||||
Notifications = new Dictionary<EUserNotification, uint>(1) { { EUserNotification.Items, msg.count_new_items } };
|
||||
|
@ -95,9 +91,7 @@ public sealed class UserNotificationsCallback : CallbackMsg {
|
|||
throw new ArgumentNullException(nameof(jobID));
|
||||
}
|
||||
|
||||
if (msg == null) {
|
||||
throw new ArgumentNullException(nameof(msg));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(msg);
|
||||
|
||||
JobID = jobID;
|
||||
Notifications = new Dictionary<EUserNotification, uint>(1) { { EUserNotification.Comments, msg.count_new_comments + msg.count_new_comments_owner + msg.count_new_comments_subscriptions } };
|
||||
|
|
|
@ -29,9 +29,7 @@ namespace ArchiSteamFarm.Steam.Integration;
|
|||
|
||||
internal static class SteamUtilities {
|
||||
internal static Dictionary<uint, string>? ParseItems(this SteamApps.PurchaseResponseCallback callback) {
|
||||
if (callback == null) {
|
||||
throw new ArgumentNullException(nameof(callback));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(callback);
|
||||
|
||||
List<KeyValue> lineItems = callback.PurchaseReceiptInfo["lineitems"].Children;
|
||||
|
||||
|
|
|
@ -223,9 +223,7 @@ public sealed class Actions : IAsyncDisposable {
|
|||
|
||||
[PublicAPI]
|
||||
public async Task<(bool Success, string Message)> Play(IReadOnlyCollection<uint> gameIDs, string? gameName = null) {
|
||||
if (gameIDs == null) {
|
||||
throw new ArgumentNullException(nameof(gameIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(gameIDs);
|
||||
|
||||
if (!Bot.IsConnectedAndLoggedOn) {
|
||||
return (false, Strings.BotNotConnected);
|
||||
|
|
|
@ -869,9 +869,7 @@ public sealed class Commands {
|
|||
throw new ArgumentOutOfRangeException(nameof(contextID));
|
||||
}
|
||||
|
||||
if (targetBot == null) {
|
||||
throw new ArgumentNullException(nameof(targetBot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(targetBot);
|
||||
|
||||
if (!Bot.HasAccess(steamID, BotConfig.EAccess.Master)) {
|
||||
return null;
|
||||
|
@ -2131,9 +2129,7 @@ public sealed class Commands {
|
|||
throw new ArgumentOutOfRangeException(nameof(steamID));
|
||||
}
|
||||
|
||||
if (gameIDs == null) {
|
||||
throw new ArgumentNullException(nameof(gameIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(gameIDs);
|
||||
|
||||
if (gameIDs.Count > ArchiHandler.MaxGamesPlayedConcurrently) {
|
||||
throw new ArgumentOutOfRangeException(nameof(gameIDs));
|
||||
|
@ -3176,9 +3172,7 @@ public sealed class Commands {
|
|||
throw new ArgumentNullException(nameof(realAppIDs));
|
||||
}
|
||||
|
||||
if (targetBot == null) {
|
||||
throw new ArgumentNullException(nameof(targetBot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(targetBot);
|
||||
|
||||
if (!Bot.HasAccess(steamID, BotConfig.EAccess.Master)) {
|
||||
return null;
|
||||
|
|
|
@ -36,9 +36,7 @@ internal sealed class InMemoryServerListProvider : IServerListProvider {
|
|||
public Task<IEnumerable<ServerRecord>> FetchServerListAsync() => Task.FromResult(ServerRecords.Where(static server => !string.IsNullOrEmpty(server.Host) && (server.Port > 0) && (server.ProtocolTypes > 0)).Select(static server => ServerRecord.CreateServer(server.Host, server.Port, server.ProtocolTypes)));
|
||||
|
||||
public Task UpdateServerListAsync(IEnumerable<ServerRecord> endpoints) {
|
||||
if (endpoints == null) {
|
||||
throw new ArgumentNullException(nameof(endpoints));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(endpoints);
|
||||
|
||||
HashSet<ServerRecordEndPoint> newServerRecords = endpoints.Select(static endpoint => new ServerRecordEndPoint(endpoint.GetHost(), (ushort) endpoint.GetPort(), endpoint.ProtocolTypes)).ToHashSet();
|
||||
|
||||
|
|
|
@ -402,9 +402,7 @@ public sealed class BotConfig {
|
|||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
|
||||
if (botConfig == null) {
|
||||
throw new ArgumentNullException(nameof(botConfig));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(botConfig);
|
||||
|
||||
string json = JsonConvert.SerializeObject(botConfig, Formatting.Indented);
|
||||
|
||||
|
|
|
@ -541,9 +541,7 @@ public sealed class GlobalConfig {
|
|||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
|
||||
if (globalConfig == null) {
|
||||
throw new ArgumentNullException(nameof(globalConfig));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(globalConfig);
|
||||
|
||||
string json = JsonConvert.SerializeObject(globalConfig, Formatting.Indented);
|
||||
|
||||
|
|
|
@ -137,9 +137,7 @@ public sealed class GlobalDatabase : SerializableFile {
|
|||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(value);
|
||||
|
||||
if (value.Type == JTokenType.Null) {
|
||||
DeleteFromJsonStorage(key);
|
||||
|
@ -233,9 +231,7 @@ public sealed class GlobalDatabase : SerializableFile {
|
|||
throw new ArgumentOutOfRangeException(nameof(appID));
|
||||
}
|
||||
|
||||
if (packageIDs == null) {
|
||||
throw new ArgumentNullException(nameof(packageIDs));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(packageIDs);
|
||||
|
||||
HashSet<uint> result = new();
|
||||
|
||||
|
@ -300,9 +296,7 @@ public sealed class GlobalDatabase : SerializableFile {
|
|||
}
|
||||
|
||||
internal async Task RefreshPackages(Bot bot, IReadOnlyDictionary<uint, uint> packages) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
if ((packages == null) || (packages.Count == 0)) {
|
||||
throw new ArgumentNullException(nameof(packages));
|
||||
|
|
|
@ -33,18 +33,14 @@ public class BasicResponse {
|
|||
internal readonly Uri FinalUri;
|
||||
|
||||
internal BasicResponse(HttpResponseMessage httpResponseMessage) {
|
||||
if (httpResponseMessage == null) {
|
||||
throw new ArgumentNullException(nameof(httpResponseMessage));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(httpResponseMessage);
|
||||
|
||||
FinalUri = httpResponseMessage.Headers.Location ?? httpResponseMessage.RequestMessage?.RequestUri ?? throw new InvalidOperationException();
|
||||
StatusCode = httpResponseMessage.StatusCode;
|
||||
}
|
||||
|
||||
internal BasicResponse(BasicResponse basicResponse) {
|
||||
if (basicResponse == null) {
|
||||
throw new ArgumentNullException(nameof(basicResponse));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(basicResponse);
|
||||
|
||||
FinalUri = basicResponse.FinalUri;
|
||||
StatusCode = basicResponse.StatusCode;
|
||||
|
|
|
@ -32,9 +32,7 @@ public sealed class BinaryResponse : BasicResponse {
|
|||
private readonly byte[] Bytes;
|
||||
|
||||
public BinaryResponse(BasicResponse basicResponse, byte[] bytes) : base(basicResponse) {
|
||||
if (basicResponse == null) {
|
||||
throw new ArgumentNullException(nameof(basicResponse));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(basicResponse);
|
||||
|
||||
Bytes = bytes ?? throw new ArgumentNullException(nameof(bytes));
|
||||
}
|
||||
|
|
|
@ -33,9 +33,7 @@ public sealed class HtmlDocumentResponse : BasicResponse, IDisposable {
|
|||
public IDocument Content { get; }
|
||||
|
||||
private HtmlDocumentResponse(BasicResponse basicResponse, IDocument content) : base(basicResponse) {
|
||||
if (basicResponse == null) {
|
||||
throw new ArgumentNullException(nameof(basicResponse));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(basicResponse);
|
||||
|
||||
Content = content ?? throw new ArgumentNullException(nameof(content));
|
||||
}
|
||||
|
@ -44,9 +42,7 @@ public sealed class HtmlDocumentResponse : BasicResponse, IDisposable {
|
|||
|
||||
[PublicAPI]
|
||||
public static async Task<HtmlDocumentResponse?> Create(StreamResponse streamResponse) {
|
||||
if (streamResponse == null) {
|
||||
throw new ArgumentNullException(nameof(streamResponse));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(streamResponse);
|
||||
|
||||
IBrowsingContext context = BrowsingContext.New();
|
||||
|
||||
|
|
|
@ -29,9 +29,7 @@ public sealed class ObjectResponse<T> : BasicResponse {
|
|||
public T Content { get; }
|
||||
|
||||
public ObjectResponse(BasicResponse basicResponse, T content) : base(basicResponse) {
|
||||
if (basicResponse == null) {
|
||||
throw new ArgumentNullException(nameof(basicResponse));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(basicResponse);
|
||||
|
||||
Content = content ?? throw new ArgumentNullException(nameof(content));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue