R# cleanup

This commit is contained in:
JustArchi
2020-03-05 21:05:40 +01:00
parent 4483a30df8
commit 847c78b650
6 changed files with 33 additions and 29 deletions

View File

@@ -537,6 +537,7 @@ limitations under the License.</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CustomTools/CustomToolsData/@EntryValue"></s:String>
<s:Boolean x:Key="/Default/Environment/InlayHintsOptions/ShowInlayHints/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/ParameterNameHintsOptions/ShowParameterNameHints/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=Antivirus/@EntryIndexedValue">LIVE_MONITOR</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=AutoRecoverer/@EntryIndexedValue">LIVE_MONITOR</s:String>

View File

@@ -233,24 +233,6 @@ namespace ArchiSteamFarm {
return (true, Strings.BotAutomaticIdlingNowResumed);
}
[Obsolete]
[PublicAPI]
public async Task<(bool Success, string Message)> SendTradeOffer(uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, ulong targetSteamID = 0, string tradeToken = null, IReadOnlyCollection<uint> wantedRealAppIDs = null, IReadOnlyCollection<uint> unwantedRealAppIDs = null, IReadOnlyCollection<Steam.Asset.EType> wantedTypes = null) {
if ((appID == 0) || (contextID == 0)) {
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));
return (false, string.Format(Strings.ErrorObjectIsNull, nameof(appID) + " || " + nameof(contextID)));
}
if ((wantedRealAppIDs?.Count == 0) || (unwantedRealAppIDs?.Count == 0) || (wantedTypes?.Count == 0)) {
Bot.ArchiLogger.LogNullError(nameof(wantedRealAppIDs) + " || " + nameof(unwantedRealAppIDs) + " || " + nameof(wantedTypes));
return (false, string.Format(Strings.ErrorObjectIsNull, nameof(wantedRealAppIDs) + " || " + nameof(unwantedRealAppIDs) + " || " + nameof(wantedTypes)));
}
return await SendInventory(appID, contextID, targetSteamID, tradeToken, item => (wantedRealAppIDs?.Contains(item.RealAppID) != false) && (unwantedRealAppIDs?.Contains(item.RealAppID) != true) && (wantedTypes?.Contains(item.Type) != false)).ConfigureAwait(false);
}
[PublicAPI]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
public async Task<(bool Success, string Message)> SendInventory(uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, ulong targetSteamID = 0, string tradeToken = null, Func<Steam.Asset, bool> filterFunction = null) {
@@ -344,6 +326,24 @@ namespace ArchiSteamFarm {
return (true, Strings.BotLootingSuccess);
}
[Obsolete]
[PublicAPI]
public async Task<(bool Success, string Message)> SendTradeOffer(uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, ulong targetSteamID = 0, string tradeToken = null, IReadOnlyCollection<uint> wantedRealAppIDs = null, IReadOnlyCollection<uint> unwantedRealAppIDs = null, IReadOnlyCollection<Steam.Asset.EType> wantedTypes = null) {
if ((appID == 0) || (contextID == 0)) {
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));
return (false, string.Format(Strings.ErrorObjectIsNull, nameof(appID) + " || " + nameof(contextID)));
}
if ((wantedRealAppIDs?.Count == 0) || (unwantedRealAppIDs?.Count == 0) || (wantedTypes?.Count == 0)) {
Bot.ArchiLogger.LogNullError(nameof(wantedRealAppIDs) + " || " + nameof(unwantedRealAppIDs) + " || " + nameof(wantedTypes));
return (false, string.Format(Strings.ErrorObjectIsNull, nameof(wantedRealAppIDs) + " || " + nameof(unwantedRealAppIDs) + " || " + nameof(wantedTypes)));
}
return await SendInventory(appID, contextID, targetSteamID, tradeToken, item => (wantedRealAppIDs?.Contains(item.RealAppID) != false) && (unwantedRealAppIDs?.Contains(item.RealAppID) != true) && (wantedTypes?.Contains(item.Type) != false)).ConfigureAwait(false);
}
[PublicAPI]
public (bool Success, string Message) Start() {
if (Bot.KeepRunning) {

View File

@@ -454,7 +454,7 @@ namespace ArchiSteamFarm {
return permission switch {
BotConfig.EPermission.FamilySharing when SteamFamilySharingIDs.Contains(steamID) => true,
_ => BotConfig.SteamUserPermissions.TryGetValue(steamID, out BotConfig.EPermission realPermission) && (realPermission >= permission),
_ => BotConfig.SteamUserPermissions.TryGetValue(steamID, out BotConfig.EPermission realPermission) && (realPermission >= permission)
};
}

View File

@@ -23,6 +23,7 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Net;
@@ -97,7 +98,7 @@ namespace ArchiSteamFarm {
private bool PermanentlyPaused;
private bool ShouldResumeFarming = true;
internal CardsFarmer([NotNull] Bot bot) {
internal CardsFarmer([JetBrains.Annotations.NotNull] Bot bot) {
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
if (ASF.GlobalConfig.IdleFarmingPeriod > 0) {
@@ -370,6 +371,7 @@ namespace ArchiSteamFarm {
await StartFarming().ConfigureAwait(false);
}
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
private async Task CheckPage(HtmlDocument htmlDocument, ISet<uint> parsedAppIDs) {
if ((htmlDocument == null) || (parsedAppIDs == null)) {
Bot.ArchiLogger.LogNullError(nameof(htmlDocument) + " || " + nameof(parsedAppIDs));
@@ -1240,7 +1242,7 @@ namespace ArchiSteamFarm {
internal uint PlayableAppID { get; set; }
internal Game(uint appID, [NotNull] string gameName, float hoursPlayed, ushort cardsRemaining, byte badgeLevel) {
internal Game(uint appID, [JetBrains.Annotations.NotNull] string gameName, float hoursPlayed, ushort cardsRemaining, byte badgeLevel) {
if ((appID == 0) || string.IsNullOrEmpty(gameName) || (hoursPlayed < 0) || (cardsRemaining == 0)) {
throw new ArgumentOutOfRangeException(nameof(appID) + " || " + nameof(gameName) + " || " + nameof(hoursPlayed) + " || " + nameof(cardsRemaining));
}

View File

@@ -44,8 +44,10 @@ namespace ArchiSteamFarm.IPC {
public Startup([NotNull] IConfiguration configuration) => Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
#if NETFRAMEWORK
[UsedImplicitly]
public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
#else
[UsedImplicitly]
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
#endif
if ((app == null) || (env == null)) {

View File

@@ -488,9 +488,8 @@ namespace ArchiSteamFarm.Json {
[JsonProperty(PropertyName = "appid", Required = Required.Always)]
internal readonly uint AppID;
internal ulong ClassID { get; private set; }
internal ulong InstanceID { get; private set; }
internal bool Marketable { get; private set; }
[JsonProperty(PropertyName = "tags", Required = Required.DisallowNull)]
internal readonly ImmutableHashSet<Tag> Tags;
internal Asset.ERarity Rarity {
get {
@@ -545,11 +544,6 @@ namespace ArchiSteamFarm.Json {
}
}
[JsonProperty(PropertyName = "tags", Required = Required.DisallowNull)]
internal readonly ImmutableHashSet<Tag> Tags;
internal bool Tradable { get; private set; }
internal Asset.EType Type {
get {
Asset.EType type = Asset.EType.Unknown;
@@ -612,6 +606,11 @@ namespace ArchiSteamFarm.Json {
}
}
internal ulong ClassID { get; private set; }
internal ulong InstanceID { get; private set; }
internal bool Marketable { get; private set; }
internal bool Tradable { get; private set; }
#pragma warning disable IDE0051
[JsonProperty(PropertyName = "classid", Required = Required.Always)]
private string ClassIDText {