mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-02-05 20:45:23 +00:00
Don't initialize SteamDirectory when we have > 0 servers saved
This commit is contained in:
@@ -28,6 +28,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -37,7 +38,6 @@ using ArchiSteamFarm.JSON;
|
|||||||
using ArchiSteamFarm.Localization;
|
using ArchiSteamFarm.Localization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SteamKit2;
|
using SteamKit2;
|
||||||
using SteamKit2.Discovery;
|
|
||||||
using SteamKit2.Internal;
|
using SteamKit2.Internal;
|
||||||
|
|
||||||
namespace ArchiSteamFarm {
|
namespace ArchiSteamFarm {
|
||||||
@@ -426,7 +426,7 @@ namespace ArchiSteamFarm {
|
|||||||
return appID;
|
return appID;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static async Task InitializeCMs(uint cellID, IServerListProvider serverListProvider) {
|
internal static async Task InitializeCMs(uint cellID, InMemoryServerListProvider serverListProvider) {
|
||||||
if (serverListProvider == null) {
|
if (serverListProvider == null) {
|
||||||
ASF.ArchiLogger.LogNullError(nameof(serverListProvider));
|
ASF.ArchiLogger.LogNullError(nameof(serverListProvider));
|
||||||
return;
|
return;
|
||||||
@@ -435,8 +435,9 @@ namespace ArchiSteamFarm {
|
|||||||
CMClient.Servers.CellID = cellID;
|
CMClient.Servers.CellID = cellID;
|
||||||
CMClient.Servers.ServerListProvider = serverListProvider;
|
CMClient.Servers.ServerListProvider = serverListProvider;
|
||||||
|
|
||||||
// Normally we wouldn't need to do this, but there is a case where our list might be invalid or outdated
|
// Ensure that we ask for a list of servers if we don't have any saved servers available
|
||||||
// Ensure that we always ask once for list of up-to-date servers, even if we have list saved
|
IEnumerable<IPEndPoint> servers = await serverListProvider.FetchServerListAsync().ConfigureAwait(false);
|
||||||
|
if (servers?.Any() != true) {
|
||||||
ASF.ArchiLogger.LogGenericInfo(string.Format(Strings.Initializing, nameof(SteamDirectory)));
|
ASF.ArchiLogger.LogGenericInfo(string.Format(Strings.Initializing, nameof(SteamDirectory)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -446,6 +447,7 @@ namespace ArchiSteamFarm {
|
|||||||
ASF.ArchiLogger.LogGenericWarning(Strings.BotSteamDirectoryInitializationFailed);
|
ASF.ArchiLogger.LogGenericWarning(Strings.BotSteamDirectoryInitializationFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal async Task LootIfNeeded() {
|
internal async Task LootIfNeeded() {
|
||||||
if (!BotConfig.SendOnFarmingFinished || (BotConfig.SteamMasterID == 0) || !IsConnectedAndLoggedOn || (BotConfig.SteamMasterID == SteamClient.SteamID)) {
|
if (!BotConfig.SendOnFarmingFinished || (BotConfig.SteamMasterID == 0) || !IsConnectedAndLoggedOn || (BotConfig.SteamMasterID == SteamClient.SteamID)) {
|
||||||
@@ -1493,6 +1495,7 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
if ((callback.CellID != 0) && (Program.GlobalDatabase.CellID != callback.CellID)) {
|
if ((callback.CellID != 0) && (Program.GlobalDatabase.CellID != callback.CellID)) {
|
||||||
Program.GlobalDatabase.CellID = callback.CellID;
|
Program.GlobalDatabase.CellID = callback.CellID;
|
||||||
|
CMClient.Servers.CellID = callback.CellID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HasMobileAuthenticator) {
|
if (!HasMobileAuthenticator) {
|
||||||
|
|||||||
Reference in New Issue
Block a user