mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 17:10:13 +00:00
Move DismissInventoryNotifications to BotBehaviour
Also stage 2 of all deprecated properties until now.
This commit is contained in:
@@ -2367,7 +2367,7 @@ namespace ArchiSteamFarm {
|
||||
if (newItems) {
|
||||
Utilities.InBackground(CardsFarmer.OnNewItemsNotification);
|
||||
|
||||
if (BotConfig.DismissInventoryNotifications) {
|
||||
if (BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.DismissInventoryNotifications)) {
|
||||
Utilities.InBackground(ArchiWebHandler.MarkInventory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,18 +42,12 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly bool AutoSteamSaleEvent;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly EBotBehaviour BotBehaviour = EBotBehaviour.None;
|
||||
|
||||
[JsonProperty]
|
||||
internal readonly string CustomGamePlayedWhileFarming;
|
||||
|
||||
[JsonProperty]
|
||||
internal readonly string CustomGamePlayedWhileIdle;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly bool DismissInventoryNotifications;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly bool Enabled;
|
||||
|
||||
@@ -115,6 +109,9 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly bool UseLoginKeys = true;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal EBotBehaviour BotBehaviour { get; private set; } = EBotBehaviour.None;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal EPersonaState OnlineStatus { get; private set; } = EPersonaState.Online;
|
||||
|
||||
@@ -133,12 +130,12 @@ namespace ArchiSteamFarm {
|
||||
private bool ShouldSerializeSensitiveDetails = true;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
private bool FarmOffline {
|
||||
private bool DismissInventoryNotifications {
|
||||
set {
|
||||
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(FarmOffline), nameof(OnlineStatus)));
|
||||
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(DismissInventoryNotifications), nameof(BotBehaviour)));
|
||||
|
||||
if (value) {
|
||||
OnlineStatus = EPersonaState.Offline;
|
||||
BotBehaviour |= EBotBehaviour.DismissInventoryNotifications;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +241,8 @@ namespace ArchiSteamFarm {
|
||||
None = 0,
|
||||
RejectInvalidFriendInvites = 1,
|
||||
RejectInvalidTrades = 2,
|
||||
RejectInvalidGroupInvites = 4
|
||||
RejectInvalidGroupInvites = 4,
|
||||
DismissInventoryNotifications = 8
|
||||
}
|
||||
|
||||
internal enum EFarmingOrder : byte {
|
||||
|
||||
@@ -44,9 +44,6 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly bool AutoRestart = true;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly byte BackgroundGCPeriod;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal readonly HashSet<uint> Blacklist = new HashSet<uint>();
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
// _ _ _ ____ _ _____
|
||||
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
||||
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
||||
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
||||
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
|
||||
//
|
||||
// Copyright 2015-2018 Łukasz "JustArchi" Domeradzki
|
||||
// Contact: JustArchi@JustArchi.net
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Runtime;
|
||||
using System.Threading;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class Hacks {
|
||||
private static Timer GarbageCollectionTimer;
|
||||
private static Timer GarbageCompactionTimer;
|
||||
|
||||
internal static void EnableBackgroundGC(byte period) {
|
||||
if (period == 0) {
|
||||
ASF.ArchiLogger.LogNullError(nameof(period));
|
||||
return;
|
||||
}
|
||||
|
||||
if (GarbageCollectionTimer == null) {
|
||||
GarbageCollectionTimer = new Timer(
|
||||
e => GC.Collect(),
|
||||
null,
|
||||
TimeSpan.FromSeconds(period), // Delay
|
||||
TimeSpan.FromSeconds(period) // Period
|
||||
);
|
||||
}
|
||||
|
||||
if (GarbageCompactionTimer == null) {
|
||||
GarbageCompactionTimer = new Timer(
|
||||
e => GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce,
|
||||
null,
|
||||
TimeSpan.FromMinutes(period), // Delay
|
||||
TimeSpan.FromMinutes(period) // Period
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,11 +254,6 @@ namespace ArchiSteamFarm {
|
||||
ASF.ArchiLogger.LogGenericDebug(SharedInfo.GlobalConfigFileName + ": " + JsonConvert.SerializeObject(GlobalConfig, Formatting.Indented));
|
||||
}
|
||||
|
||||
if (GlobalConfig.BackgroundGCPeriod > 0) {
|
||||
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(GlobalConfig.BackgroundGCPeriod), "COMPlus_GCLatencyLevel=0"));
|
||||
Hacks.EnableBackgroundGC(GlobalConfig.BackgroundGCPeriod);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(GlobalConfig.CurrentCulture)) {
|
||||
try {
|
||||
// GetCultureInfo() would be better but we can't use it for specifying neutral cultures such as "en"
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"BotBehaviour": 0,
|
||||
"CustomGamePlayedWhileFarming": null,
|
||||
"CustomGamePlayedWhileIdle": null,
|
||||
"DismissInventoryNotifications": false,
|
||||
"Enabled": false,
|
||||
"FarmingOrder": 0,
|
||||
"GamesPlayedWhileIdle": [],
|
||||
|
||||
Reference in New Issue
Block a user