mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-15 08:00:40 +00:00
* Start working on nullable checks help me * Update GlobalConfig.cs * Finish initial fixup round * nullability code review
This commit is contained in:
committed by
GitHub
parent
e5f64ec9dd
commit
9fc1ea65a5
@@ -29,7 +29,6 @@ using System.Threading.Tasks;
|
||||
using ArchiSteamFarm.Collections;
|
||||
using ArchiSteamFarm.Helpers;
|
||||
using ArchiSteamFarm.Localization;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
using SteamKit2;
|
||||
|
||||
@@ -58,7 +57,7 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
private readonly ConcurrentHashSet<uint> IdlingPriorityAppIDs = new ConcurrentHashSet<uint>();
|
||||
|
||||
internal string LoginKey {
|
||||
internal string? LoginKey {
|
||||
get => BackingLoginKey;
|
||||
|
||||
set {
|
||||
@@ -71,7 +70,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
internal MobileAuthenticator MobileAuthenticator {
|
||||
internal MobileAuthenticator? MobileAuthenticator {
|
||||
get => BackingMobileAuthenticator;
|
||||
|
||||
set {
|
||||
@@ -85,12 +84,12 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
[JsonProperty(PropertyName = "_" + nameof(LoginKey))]
|
||||
private string BackingLoginKey;
|
||||
private string? BackingLoginKey;
|
||||
|
||||
[JsonProperty(PropertyName = "_" + nameof(MobileAuthenticator))]
|
||||
private MobileAuthenticator BackingMobileAuthenticator;
|
||||
private MobileAuthenticator? BackingMobileAuthenticator;
|
||||
|
||||
private BotDatabase([NotNull] string filePath) {
|
||||
private BotDatabase(string filePath) {
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
@@ -109,9 +108,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void AddBlacklistedFromTradesSteamIDs(IReadOnlyCollection<ulong> steamIDs) {
|
||||
if ((steamIDs == null) || (steamIDs.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(steamIDs));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(steamIDs));
|
||||
}
|
||||
|
||||
if (BlacklistedFromTradesSteamIDs.AddRange(steamIDs)) {
|
||||
@@ -121,9 +118,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void AddGamesToRedeemInBackground(IOrderedDictionary games) {
|
||||
if ((games == null) || (games.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(games));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(games));
|
||||
}
|
||||
|
||||
bool save = false;
|
||||
@@ -142,9 +137,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void AddIdlingBlacklistedAppIDs(IReadOnlyCollection<uint> appIDs) {
|
||||
if ((appIDs == null) || (appIDs.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appIDs));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(appIDs));
|
||||
}
|
||||
|
||||
if (IdlingBlacklistedAppIDs.AddRange(appIDs)) {
|
||||
@@ -154,9 +147,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void AddIdlingPriorityAppIDs(IReadOnlyCollection<uint> appIDs) {
|
||||
if ((appIDs == null) || (appIDs.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appIDs));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(appIDs));
|
||||
}
|
||||
|
||||
if (IdlingPriorityAppIDs.AddRange(appIDs)) {
|
||||
@@ -164,12 +155,9 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
[ItemCanBeNull]
|
||||
internal static async Task<BotDatabase> CreateOrLoad(string filePath) {
|
||||
internal static async Task<BotDatabase?> CreateOrLoad(string filePath) {
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(filePath));
|
||||
|
||||
return null;
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
|
||||
if (!File.Exists(filePath)) {
|
||||
@@ -207,10 +195,10 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal IReadOnlyCollection<ulong> GetBlacklistedFromTradesSteamIDs() => BlacklistedFromTradesSteamIDs;
|
||||
|
||||
internal (string Key, string Name) GetGameToRedeemInBackground() {
|
||||
internal (string? Key, string? Name) GetGameToRedeemInBackground() {
|
||||
lock (GamesToRedeemInBackground) {
|
||||
foreach (DictionaryEntry game in GamesToRedeemInBackground) {
|
||||
return (game.Key as string, game.Value as string);
|
||||
foreach (DictionaryEntry? game in GamesToRedeemInBackground) {
|
||||
return (game?.Key as string, game?.Value as string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,9 +210,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal bool IsBlacklistedFromIdling(uint appID) {
|
||||
if (appID == 0) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appID));
|
||||
|
||||
return false;
|
||||
throw new ArgumentNullException(nameof(appID));
|
||||
}
|
||||
|
||||
return IdlingBlacklistedAppIDs.Contains(appID);
|
||||
@@ -232,9 +218,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal bool IsBlacklistedFromTrades(ulong steamID) {
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(steamID));
|
||||
|
||||
return false;
|
||||
throw new ArgumentNullException(nameof(steamID));
|
||||
}
|
||||
|
||||
return BlacklistedFromTradesSteamIDs.Contains(steamID);
|
||||
@@ -242,9 +226,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal bool IsPriorityIdling(uint appID) {
|
||||
if (appID == 0) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appID));
|
||||
|
||||
return false;
|
||||
throw new ArgumentNullException(nameof(appID));
|
||||
}
|
||||
|
||||
return IdlingPriorityAppIDs.Contains(appID);
|
||||
@@ -252,9 +234,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void RemoveBlacklistedFromTradesSteamIDs(IReadOnlyCollection<ulong> steamIDs) {
|
||||
if ((steamIDs == null) || (steamIDs.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(steamIDs));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(steamIDs));
|
||||
}
|
||||
|
||||
if (BlacklistedFromTradesSteamIDs.RemoveRange(steamIDs)) {
|
||||
@@ -264,9 +244,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void RemoveGameToRedeemInBackground(string key) {
|
||||
if (string.IsNullOrEmpty(key)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(key));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
lock (GamesToRedeemInBackground) {
|
||||
@@ -282,9 +260,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void RemoveIdlingBlacklistedAppIDs(IReadOnlyCollection<uint> appIDs) {
|
||||
if ((appIDs == null) || (appIDs.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appIDs));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(appIDs));
|
||||
}
|
||||
|
||||
if (IdlingBlacklistedAppIDs.RemoveRange(appIDs)) {
|
||||
@@ -294,9 +270,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal void RemoveIdlingPriorityAppIDs(IReadOnlyCollection<uint> appIDs) {
|
||||
if ((appIDs == null) || (appIDs.Count == 0)) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(appIDs));
|
||||
|
||||
return;
|
||||
throw new ArgumentNullException(nameof(appIDs));
|
||||
}
|
||||
|
||||
if (IdlingPriorityAppIDs.RemoveRange(appIDs)) {
|
||||
|
||||
Reference in New Issue
Block a user