diff --git a/ArchiSteamFarm.sln.DotSettings b/ArchiSteamFarm.sln.DotSettings index 391d1b97a..560e5be30 100644 --- a/ArchiSteamFarm.sln.DotSettings +++ b/ArchiSteamFarm.sln.DotSettings @@ -106,6 +106,7 @@ True END_OF_LINE 1 + 0 END_OF_LINE TOGETHER_SAME_LINE END_OF_LINE diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs index f5a60c440..fb314046d 100644 --- a/ArchiSteamFarm/ArchiHandler.cs +++ b/ArchiSteamFarm/ArchiHandler.cs @@ -41,7 +41,9 @@ namespace ArchiSteamFarm { internal DateTime LastPacketReceived { get; private set; } = DateTime.MinValue; - internal ArchiHandler(ArchiLogger archiLogger) => ArchiLogger = archiLogger ?? throw new ArgumentNullException(nameof(archiLogger)); + internal ArchiHandler(ArchiLogger archiLogger) { + ArchiLogger = archiLogger ?? throw new ArgumentNullException(nameof(archiLogger)); + } public override void HandleMsg(IPacketMsg packetMsg) { if (packetMsg == null) { diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index 10f8e41c3..c2d6dcca0 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -175,20 +175,21 @@ namespace ArchiSteamFarm { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { await Task.Run(() => { - using (dynamic iEconService = WebAPI.GetInterface(IEconService, steamApiKey)) { - iEconService.Timeout = Timeout; + using (dynamic iEconService = WebAPI.GetInterface(IEconService, steamApiKey)) { + iEconService.Timeout = Timeout; - try { - response = iEconService.DeclineTradeOffer( - tradeofferid: tradeID.ToString(), - method: WebRequestMethods.Http.Post, - secure: true - ); - } catch (Exception e) { - Bot.ArchiLogger.LogGenericWarningException(e); + try { + response = iEconService.DeclineTradeOffer( + tradeofferid: tradeID.ToString(), + method: WebRequestMethods.Http.Post, + secure: true + ); + } catch (Exception e) { + Bot.ArchiLogger.LogGenericWarningException(e); + } } - } - }).ConfigureAwait(false); + }) + .ConfigureAwait(false); } if (response == null) { @@ -228,21 +229,22 @@ namespace ArchiSteamFarm { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { await Task.Run(() => { - using (dynamic iEconService = WebAPI.GetInterface(IEconService, steamApiKey)) { - iEconService.Timeout = Timeout; + using (dynamic iEconService = WebAPI.GetInterface(IEconService, steamApiKey)) { + iEconService.Timeout = Timeout; - try { - response = iEconService.GetTradeOffers( - get_received_offers: 1, - active_only: 1, - get_descriptions: 1, - secure: true - ); - } catch (Exception e) { - Bot.ArchiLogger.LogGenericWarningException(e); + try { + response = iEconService.GetTradeOffers( + get_received_offers: 1, + active_only: 1, + get_descriptions: 1, + secure: true + ); + } catch (Exception e) { + Bot.ArchiLogger.LogGenericWarningException(e); + } } - } - }).ConfigureAwait(false); + }) + .ConfigureAwait(false); } if (response == null) { @@ -612,20 +614,21 @@ namespace ArchiSteamFarm { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { await Task.Run(() => { - using (dynamic iPlayerService = WebAPI.GetInterface(IPlayerService, steamApiKey)) { - iPlayerService.Timeout = Timeout; + using (dynamic iPlayerService = WebAPI.GetInterface(IPlayerService, steamApiKey)) { + iPlayerService.Timeout = Timeout; - try { - response = iPlayerService.GetOwnedGames( - steamid: steamID, - include_appinfo: 1, - secure: true - ); - } catch (Exception e) { - Bot.ArchiLogger.LogGenericWarningException(e); + try { + response = iPlayerService.GetOwnedGames( + steamid: steamID, + include_appinfo: 1, + secure: true + ); + } catch (Exception e) { + Bot.ArchiLogger.LogGenericWarningException(e); + } } - } - }).ConfigureAwait(false); + }) + .ConfigureAwait(false); } if (response == null) { @@ -651,19 +654,20 @@ namespace ArchiSteamFarm { KeyValue response = null; for (byte i = 0; (i < WebBrowser.MaxRetries) && (response == null); i++) { await Task.Run(() => { - using (dynamic iTwoFactorService = WebAPI.GetInterface(ITwoFactorService)) { - iTwoFactorService.Timeout = Timeout; + using (dynamic iTwoFactorService = WebAPI.GetInterface(ITwoFactorService)) { + iTwoFactorService.Timeout = Timeout; - try { - response = iTwoFactorService.QueryTime( - method: WebRequestMethods.Http.Post, - secure: true - ); - } catch (Exception e) { - Bot.ArchiLogger.LogGenericWarningException(e); + try { + response = iTwoFactorService.QueryTime( + method: WebRequestMethods.Http.Post, + secure: true + ); + } catch (Exception e) { + Bot.ArchiLogger.LogGenericWarningException(e); + } } - } - }).ConfigureAwait(false); + }) + .ConfigureAwait(false); } if (response != null) { @@ -806,9 +810,13 @@ namespace ArchiSteamFarm { } } - internal async Task HasValidApiKey() => !string.IsNullOrEmpty(await GetApiKey().ConfigureAwait(false)); + internal async Task HasValidApiKey() { + return !string.IsNullOrEmpty(await GetApiKey().ConfigureAwait(false)); + } - internal static void Init() => Timeout = Program.GlobalConfig.ConnectionTimeout * 1000; + internal static void Init() { + Timeout = Program.GlobalConfig.ConnectionTimeout * 1000; + } internal async Task Init(ulong steamID, EUniverse universe, string webAPIUserNonce, string parentalPin) { if ((steamID == 0) || (universe == EUniverse.Invalid) || string.IsNullOrEmpty(webAPIUserNonce) || string.IsNullOrEmpty(parentalPin)) { @@ -839,22 +847,23 @@ namespace ArchiSteamFarm { KeyValue authResult = null; await Task.Run(() => { - using (dynamic iSteamUserAuth = WebAPI.GetInterface(ISteamUserAuth)) { - iSteamUserAuth.Timeout = Timeout; + using (dynamic iSteamUserAuth = WebAPI.GetInterface(ISteamUserAuth)) { + iSteamUserAuth.Timeout = Timeout; - try { - authResult = iSteamUserAuth.AuthenticateUser( - steamid: steamID, - sessionkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedSessionKey, 0, cryptedSessionKey.Length)), - encrypted_loginkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedLoginKey, 0, cryptedLoginKey.Length)), - method: WebRequestMethods.Http.Post, - secure: true - ); - } catch (Exception e) { - Bot.ArchiLogger.LogGenericWarningException(e); + try { + authResult = iSteamUserAuth.AuthenticateUser( + steamid: steamID, + sessionkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedSessionKey, 0, cryptedSessionKey.Length)), + encrypted_loginkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedLoginKey, 0, cryptedLoginKey.Length)), + method: WebRequestMethods.Http.Post, + secure: true + ); + } catch (Exception e) { + Bot.ArchiLogger.LogGenericWarningException(e); + } } - } - }).ConfigureAwait(false); + }) + .ConfigureAwait(false); if (authResult == null) { return false; diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 211e15009..d21ed1ed6 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -56,6 +56,7 @@ namespace ArchiSteamFarm { private static readonly SemaphoreSlim GiftsSemaphore = new SemaphoreSlim(1); private static readonly SemaphoreSlim LoginSemaphore = new SemaphoreSlim(1); + internal readonly ArchiLogger ArchiLogger; internal readonly ArchiWebHandler ArchiWebHandler; internal readonly string BotName; @@ -80,7 +81,6 @@ namespace ArchiSteamFarm { private readonly Timer HeartBeatTimer; private readonly SemaphoreSlim InitializationSemaphore = new SemaphoreSlim(1); private readonly ConcurrentHashSet OwnedPackageIDs = new ConcurrentHashSet(); - private readonly Statistics Statistics; private readonly SteamApps SteamApps; private readonly SteamClient SteamClient; @@ -510,7 +510,9 @@ namespace ArchiSteamFarm { } } - internal void OnFarmingStopped() => ResetGamesPlayed(); + internal void OnFarmingStopped() { + ResetGamesPlayed(); + } internal async Task OnNewConfigLoaded(ASF.BotConfigEventArgs args) { if (args == null) { @@ -544,7 +546,9 @@ namespace ArchiSteamFarm { } } - internal void PlayGame(uint gameID, string gameName = null) => PlayGames(gameID.ToEnumerable(), gameName); + internal void PlayGame(uint gameID, string gameName = null) { + PlayGames(gameID.ToEnumerable(), gameName); + } internal void PlayGames(IEnumerable gameIDs, string gameName = null) { if (gameIDs == null) { @@ -842,7 +846,7 @@ namespace ArchiSteamFarm { Task.Run(() => Stop()).Forget(); } - Bots.TryRemove(BotName, out Bot _); + Bots.TryRemove(BotName, out _); } private void Disconnect() { @@ -921,7 +925,9 @@ namespace ArchiSteamFarm { return result; } - private ulong GetFirstSteamMasterID() => BotConfig.SteamUserPermissions.Where(kv => (kv.Key != 0) && (kv.Key != SteamID) && (kv.Value == BotConfig.EPermission.Master)).Select(kv => kv.Key).OrderBy(steamID => steamID).FirstOrDefault(); + private ulong GetFirstSteamMasterID() { + return BotConfig.SteamUserPermissions.Where(kv => (kv.Key != 0) && (kv.Key != SteamID) && (kv.Value == BotConfig.EPermission.Master)).Select(kv => kv.Key).OrderBy(steamID => steamID).FirstOrDefault(); + } private BotConfig.EPermission GetSteamUserPermission(ulong steamID) { if (steamID != 0) { @@ -1196,17 +1202,19 @@ namespace ArchiSteamFarm { private static async Task LimitGiftsRequestsAsync() { await GiftsSemaphore.WaitAsync().ConfigureAwait(false); Task.Run(async () => { - await Task.Delay(Program.GlobalConfig.GiftsLimiterDelay * 1000).ConfigureAwait(false); - GiftsSemaphore.Release(); - }).Forget(); + await Task.Delay(Program.GlobalConfig.GiftsLimiterDelay * 1000).ConfigureAwait(false); + GiftsSemaphore.Release(); + }) + .Forget(); } private static async Task LimitLoginRequestsAsync() { await LoginSemaphore.WaitAsync().ConfigureAwait(false); Task.Run(async () => { - await Task.Delay(Program.GlobalConfig.LoginLimiterDelay * 1000).ConfigureAwait(false); - LoginSemaphore.Release(); - }).Forget(); + await Task.Delay(Program.GlobalConfig.LoginLimiterDelay * 1000).ConfigureAwait(false); + LoginSemaphore.Release(); + }) + .Forget(); } private async Task MarkInventoryIfNeeded() { @@ -1674,9 +1682,10 @@ namespace ArchiSteamFarm { if (BotConfig.SteamMasterClanID != 0) { Task.Run(async () => { - await ArchiWebHandler.JoinGroup(BotConfig.SteamMasterClanID).ConfigureAwait(false); - JoinMasterChat(); - }).Forget(); + await ArchiWebHandler.JoinGroup(BotConfig.SteamMasterClanID).ConfigureAwait(false); + JoinMasterChat(); + }) + .Forget(); } Statistics?.OnLoggedOn().Forget(); @@ -2299,9 +2308,10 @@ namespace ArchiSteamFarm { // Schedule the task after some time so user can receive response Task.Run(async () => { - await Task.Delay(1000).ConfigureAwait(false); - await Program.Exit().ConfigureAwait(false); - }).Forget(); + await Task.Delay(1000).ConfigureAwait(false); + await Program.Exit().ConfigureAwait(false); + }) + .Forget(); return FormatStaticResponse(Strings.Done); } @@ -3161,9 +3171,10 @@ namespace ArchiSteamFarm { // Schedule the task after some time so user can receive response Task.Run(async () => { - await Task.Delay(1000).ConfigureAwait(false); - await Program.Restart().ConfigureAwait(false); - }).Forget(); + await Task.Delay(1000).ConfigureAwait(false); + await Program.Restart().ConfigureAwait(false); + }) + .Forget(); return FormatStaticResponse(Strings.Done); } diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index 025343f10..2ab7c68d2 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -95,7 +95,9 @@ namespace ArchiSteamFarm { } } - internal IEnumerable GetBlacklistedFromTradesSteamIDs() => BlacklistedFromTradesSteamIDs; + internal IEnumerable GetBlacklistedFromTradesSteamIDs() { + return BlacklistedFromTradesSteamIDs; + } internal bool IsBlacklistedFromTrades(ulong steamID) { if (steamID != 0) { diff --git a/ArchiSteamFarm/CMsgs/CMsgClientClanInviteAction.cs b/ArchiSteamFarm/CMsgs/CMsgClientClanInviteAction.cs index 0d341c27e..f57c0f1a9 100644 --- a/ArchiSteamFarm/CMsgs/CMsgClientClanInviteAction.cs +++ b/ArchiSteamFarm/CMsgs/CMsgClientClanInviteAction.cs @@ -42,7 +42,9 @@ namespace ArchiSteamFarm.CMsgs { AcceptInvite = binaryReader.ReadBoolean(); } - EMsg ISteamSerializableMessage.GetEMsg() => EMsg.ClientAcknowledgeClanInvite; + EMsg ISteamSerializableMessage.GetEMsg() { + return EMsg.ClientAcknowledgeClanInvite; + } void ISteamSerializable.Serialize(Stream stream) { if (stream == null) { diff --git a/ArchiSteamFarm/CardsFarmer.cs b/ArchiSteamFarm/CardsFarmer.cs index b7a967f05..c02c71f55 100755 --- a/ArchiSteamFarm/CardsFarmer.cs +++ b/ArchiSteamFarm/CardsFarmer.cs @@ -90,7 +90,9 @@ namespace ArchiSteamFarm { IdleFarmingTimer?.Dispose(); } - internal void OnDisconnected() => StopFarming().Forget(); + internal void OnDisconnected() { + StopFarming().Forget(); + } internal async Task OnNewGameAdded() { // If we're not farming yet, obviously it's worth it to make a check @@ -146,7 +148,9 @@ namespace ArchiSteamFarm { } } - internal void SetInitialState(bool paused) => StickyPause = Paused = paused; + internal void SetInitialState(bool paused) { + StickyPause = Paused = paused; + } internal async Task StartFarming() { if (NowFarming || Paused || !Bot.IsPlayingPossible) { @@ -844,9 +848,13 @@ namespace ArchiSteamFarm { return (game != null) && Equals(game); } - public override int GetHashCode() => (int) AppID; + public override int GetHashCode() { + return (int) AppID; + } - private bool Equals(Game other) => AppID == other.AppID; + private bool Equals(Game other) { + return AppID == other.AppID; + } } } } \ No newline at end of file diff --git a/ArchiSteamFarm/ConcurrentEnumerator.cs b/ArchiSteamFarm/ConcurrentEnumerator.cs index 034baade2..be3325995 100644 --- a/ArchiSteamFarm/ConcurrentEnumerator.cs +++ b/ArchiSteamFarm/ConcurrentEnumerator.cs @@ -45,8 +45,16 @@ namespace ArchiSteamFarm { Enumerator = collection.GetEnumerator(); } - public void Dispose() => Lock.Dispose(); - public bool MoveNext() => Enumerator.MoveNext(); - public void Reset() => Enumerator.Reset(); + public void Dispose() { + Lock.Dispose(); + } + + public bool MoveNext() { + return Enumerator.MoveNext(); + } + + public void Reset() { + Enumerator.Reset(); + } } } \ No newline at end of file diff --git a/ArchiSteamFarm/ConcurrentHashSet.cs b/ArchiSteamFarm/ConcurrentHashSet.cs index e451b27c3..981b20429 100644 --- a/ArchiSteamFarm/ConcurrentHashSet.cs +++ b/ArchiSteamFarm/ConcurrentHashSet.cs @@ -72,7 +72,9 @@ namespace ArchiSteamFarm { } } - public IEnumerator GetEnumerator() => new ConcurrentEnumerator(HashSet, Lock); + public IEnumerator GetEnumerator() { + return new ConcurrentEnumerator(HashSet, Lock); + } public void IntersectWith(IEnumerable other) { using (Lock.WriterLock()) { @@ -134,9 +136,13 @@ namespace ArchiSteamFarm { } } - void ICollection.Add(T item) => Add(item); + void ICollection.Add(T item) { + Add(item); + } - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() { + return GetEnumerator(); + } internal bool AddRange(IEnumerable items) { using (Lock.WriterLock()) { diff --git a/ArchiSteamFarm/GlobalDatabase.cs b/ArchiSteamFarm/GlobalDatabase.cs index 7ce85d382..e31b5844b 100644 --- a/ArchiSteamFarm/GlobalDatabase.cs +++ b/ArchiSteamFarm/GlobalDatabase.cs @@ -77,7 +77,9 @@ namespace ArchiSteamFarm { ServerListProvider.ServerListUpdated += OnServerListUpdated; } - public void Dispose() => ServerListProvider.ServerListUpdated -= OnServerListUpdated; + public void Dispose() { + ServerListProvider.ServerListUpdated -= OnServerListUpdated; + } internal static GlobalDatabase Load(string filePath) { if (string.IsNullOrEmpty(filePath)) { @@ -107,7 +109,9 @@ namespace ArchiSteamFarm { return globalDatabase; } - private void OnServerListUpdated(object sender, EventArgs e) => Save(); + private void OnServerListUpdated(object sender, EventArgs e) { + Save(); + } private void Save() { string json = JsonConvert.SerializeObject(this, CustomSerializerSettings); diff --git a/ArchiSteamFarm/IPAddressConverter.cs b/ArchiSteamFarm/IPAddressConverter.cs index f6ab83fe0..4669e76e8 100644 --- a/ArchiSteamFarm/IPAddressConverter.cs +++ b/ArchiSteamFarm/IPAddressConverter.cs @@ -29,7 +29,9 @@ using Newtonsoft.Json.Linq; namespace ArchiSteamFarm { internal sealed class IPAddressConverter : JsonConverter { - public override bool CanConvert(Type objectType) => objectType == typeof(IPAddress); + public override bool CanConvert(Type objectType) { + return objectType == typeof(IPAddress); + } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JToken token = JToken.Load(reader); diff --git a/ArchiSteamFarm/IPEndPointConverter.cs b/ArchiSteamFarm/IPEndPointConverter.cs index 8f89d2e28..890586762 100644 --- a/ArchiSteamFarm/IPEndPointConverter.cs +++ b/ArchiSteamFarm/IPEndPointConverter.cs @@ -29,7 +29,9 @@ using Newtonsoft.Json.Linq; namespace ArchiSteamFarm { internal sealed class IPEndPointConverter : JsonConverter { - public override bool CanConvert(Type objectType) => objectType == typeof(IPEndPoint); + public override bool CanConvert(Type objectType) { + return objectType == typeof(IPEndPoint); + } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JObject jo = JObject.Load(reader); diff --git a/ArchiSteamFarm/InMemoryServerListProvider.cs b/ArchiSteamFarm/InMemoryServerListProvider.cs index 9eecb58b5..a0858f406 100644 --- a/ArchiSteamFarm/InMemoryServerListProvider.cs +++ b/ArchiSteamFarm/InMemoryServerListProvider.cs @@ -34,7 +34,9 @@ namespace ArchiSteamFarm { [JsonProperty(Required = Required.DisallowNull)] private readonly ConcurrentHashSet Servers = new ConcurrentHashSet(); - public Task> FetchServerListAsync() => Task.FromResult>(Servers); + public Task> FetchServerListAsync() { + return Task.FromResult>(Servers); + } public Task UpdateServerListAsync(IEnumerable endPoints) { if (endPoints == null) { diff --git a/ArchiSteamFarm/JSON/Steam.cs b/ArchiSteamFarm/JSON/Steam.cs index a41a840de..c11188659 100644 --- a/ArchiSteamFarm/JSON/Steam.cs +++ b/ArchiSteamFarm/JSON/Steam.cs @@ -440,7 +440,7 @@ namespace ArchiSteamFarm.JSON { internal bool IsFairTypesExchange() { Dictionary> itemsToGivePerGame = new Dictionary>(); foreach (Item item in ItemsToGive) { - if (!itemsToGivePerGame.TryGetValue(item.RealAppID, out Dictionary itemsPerType)) { + if (!itemsToGivePerGame.TryGetValue(item.RealAppID, out Dictionary itemsPerType)) { itemsPerType = new Dictionary { [item.Type] = item.Amount }; itemsToGivePerGame[item.RealAppID] = itemsPerType; } else { @@ -489,7 +489,9 @@ namespace ArchiSteamFarm.JSON { return true; } - internal bool IsSteamCardsRequest() => ItemsToGive.All(item => (item.AppID == Item.SteamAppID) && (item.ContextID == Item.SteamCommunityContextID) && (item.Type == Item.EType.TradingCard)); + internal bool IsSteamCardsRequest() { + return ItemsToGive.All(item => (item.AppID == Item.SteamAppID) && (item.ContextID == Item.SteamCommunityContextID) && (item.Type == Item.EType.TradingCard)); + } [SuppressMessage("ReSharper", "UnusedMember.Global")] internal enum ETradeOfferState : byte { diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index 4daf95202..76c769210 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -68,7 +68,9 @@ namespace ArchiSteamFarm { private MobileAuthenticator() { } - public void Dispose() => ConfirmationsSemaphore.Dispose(); + public void Dispose() { + ConfirmationsSemaphore.Dispose(); + } internal void CorrectDeviceID(string deviceID) { if (string.IsNullOrEmpty(deviceID)) { @@ -246,7 +248,9 @@ namespace ArchiSteamFarm { } } - internal void Init(Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot)); + internal void Init(Bot bot) { + Bot = bot ?? throw new ArgumentNullException(nameof(bot)); + } internal static async Task OnTimeChanged() { await TimeSemaphore.WaitAsync().ConfigureAwait(false); diff --git a/ArchiSteamFarm/OS.cs b/ArchiSteamFarm/OS.cs index f429570fc..94d01e682 100644 --- a/ArchiSteamFarm/OS.cs +++ b/ArchiSteamFarm/OS.cs @@ -77,7 +77,9 @@ namespace ArchiSteamFarm { } } - private static async void OnTimeChanged(object sender, EventArgs e) => await MobileAuthenticator.OnTimeChanged().ConfigureAwait(false); + private static async void OnTimeChanged(object sender, EventArgs e) { + await MobileAuthenticator.OnTimeChanged().ConfigureAwait(false); + } private static class NativeMethods { internal const uint EnableQuickEditMode = 0x0040; diff --git a/ArchiSteamFarm/Program.cs b/ArchiSteamFarm/Program.cs index 599b36bf8..5bcdf2c18 100644 --- a/ArchiSteamFarm/Program.cs +++ b/ArchiSteamFarm/Program.cs @@ -446,18 +446,22 @@ namespace ArchiSteamFarm { ServiceName = SharedInfo.ServiceName; } - protected override void OnStart(string[] args) => Task.Run(async () => { - // Normally it'd make sense to use already provided string[] args parameter above - // However, that one doesn't seem to work when ASF is started as a service, it's always null - // Therefore, we will use Environment args in such case - string[] envArgs = Environment.GetCommandLineArgs(); - await Init(envArgs).ConfigureAwait(false); + protected override void OnStart(string[] args) { + Task.Run(async () => { + // Normally it'd make sense to use already provided string[] args parameter above + // However, that one doesn't seem to work when ASF is started as a service, it's always null + // Therefore, we will use Environment args in such case + string[] envArgs = Environment.GetCommandLineArgs(); + await Init(envArgs).ConfigureAwait(false); - ShutdownResetEvent.Wait(); - Stop(); - }); + ShutdownResetEvent.Wait(); + Stop(); + }); + } - protected override async void OnStop() => await Shutdown().ConfigureAwait(false); + protected override async void OnStop() { + await Shutdown().ConfigureAwait(false); + } } } } \ No newline at end of file diff --git a/ArchiSteamFarm/Statistics.cs b/ArchiSteamFarm/Statistics.cs index ecf71af06..3784bc5e3 100644 --- a/ArchiSteamFarm/Statistics.cs +++ b/ArchiSteamFarm/Statistics.cs @@ -48,9 +48,13 @@ namespace ArchiSteamFarm { private DateTime LastPersonaStateRequest = DateTime.MinValue; private bool ShouldSendHeartBeats; - internal Statistics(Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot)); + internal Statistics(Bot bot) { + Bot = bot ?? throw new ArgumentNullException(nameof(bot)); + } - public void Dispose() => Semaphore.Dispose(); + public void Dispose() { + Semaphore.Dispose(); + } internal async Task OnHeartBeat() { // Request persona update if needed @@ -85,7 +89,9 @@ namespace ArchiSteamFarm { } } - internal async Task OnLoggedOn() => await Bot.ArchiWebHandler.JoinGroup(SharedInfo.ASFGroupSteamID).ConfigureAwait(false); + internal async Task OnLoggedOn() { + await Bot.ArchiWebHandler.JoinGroup(SharedInfo.ASFGroupSteamID).ConfigureAwait(false); + } internal async Task OnPersonaState(SteamFriends.PersonaStateCallback callback) { if (callback == null) { diff --git a/ArchiSteamFarm/Trading.cs b/ArchiSteamFarm/Trading.cs index 91e84269c..de4e0a738 100644 --- a/ArchiSteamFarm/Trading.cs +++ b/ArchiSteamFarm/Trading.cs @@ -43,9 +43,13 @@ namespace ArchiSteamFarm { private bool ParsingScheduled; - internal Trading(Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot)); + internal Trading(Bot bot) { + Bot = bot ?? throw new ArgumentNullException(nameof(bot)); + } - public void Dispose() => TradesSemaphore.Dispose(); + public void Dispose() { + TradesSemaphore.Dispose(); + } internal async Task CheckTrades() { // We aim to have a maximum of 2 tasks, one already parsing, and one waiting in the queue @@ -74,12 +78,15 @@ namespace ArchiSteamFarm { internal static async Task LimitInventoryRequestsAsync() { await InventorySemaphore.WaitAsync().ConfigureAwait(false); Task.Run(async () => { - await Task.Delay(Program.GlobalConfig.InventoryLimiterDelay * 1000).ConfigureAwait(false); - InventorySemaphore.Release(); - }).Forget(); + await Task.Delay(Program.GlobalConfig.InventoryLimiterDelay * 1000).ConfigureAwait(false); + InventorySemaphore.Release(); + }) + .Forget(); } - internal void OnDisconnected() => IgnoredTrades.ClearAndTrim(); + internal void OnDisconnected() { + IgnoredTrades.ClearAndTrim(); + } private async Task ParseActiveTrades() { HashSet tradeOffers = await Bot.ArchiWebHandler.GetActiveTradeOffers().ConfigureAwait(false); diff --git a/ArchiSteamFarm/Utilities.cs b/ArchiSteamFarm/Utilities.cs index 83c39bf3f..bef3ff795 100644 --- a/ArchiSteamFarm/Utilities.cs +++ b/ArchiSteamFarm/Utilities.cs @@ -68,7 +68,9 @@ namespace ArchiSteamFarm { return cookies.Count != 0 ? (from Cookie cookie in cookies where cookie.Name.Equals(name) select cookie.Value).FirstOrDefault() : null; } - internal static uint GetUnixTime() => (uint) DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + internal static uint GetUnixTime() { + return (uint) DateTimeOffset.UtcNow.ToUnixTimeSeconds(); + } /* internal static int RandomNext(int maxWithout) { @@ -97,7 +99,7 @@ namespace ArchiSteamFarm { for (byte i = 0; i < text.Length; i += split) { string textPart = string.Join("", text.Skip(i).Take(split)); - if (!ulong.TryParse(textPart, NumberStyles.HexNumber, null, out ulong _)) { + if (!ulong.TryParse(textPart, NumberStyles.HexNumber, null, out _)) { return false; } } diff --git a/ArchiSteamFarm/WCF.cs b/ArchiSteamFarm/WCF.cs index 68bde4deb..d23c78f32 100644 --- a/ArchiSteamFarm/WCF.cs +++ b/ArchiSteamFarm/WCF.cs @@ -50,7 +50,9 @@ namespace ArchiSteamFarm { StopServer(); } - public string GetStatus() => Program.GlobalConfig.SteamOwnerID == 0 ? "{}" : Bot.GetAPIStatus(Bot.Bots); + public string GetStatus() { + return Program.GlobalConfig.SteamOwnerID == 0 ? "{}" : Bot.GetAPIStatus(Bot.Bots); + } public string HandleCommand(string input) { if (string.IsNullOrEmpty(input)) { diff --git a/ArchiSteamFarm/WebBrowser.cs b/ArchiSteamFarm/WebBrowser.cs index d44c45d7c..49d46bf37 100644 --- a/ArchiSteamFarm/WebBrowser.cs +++ b/ArchiSteamFarm/WebBrowser.cs @@ -305,7 +305,11 @@ namespace ArchiSteamFarm { } #if !__MonoCS__ - private static void InitNonMonoBehaviour() => ServicePointManager.ReusePort = true; + + private static void InitNonMonoBehaviour() { + ServicePointManager.ReusePort = true; + } + #endif private async Task UrlGetToBytes(string request, string referer = null) { diff --git a/ArchiSteamFarm/config/ASF.json b/ArchiSteamFarm/config/ASF.json index 0f797679c..9cdd15b21 100644 --- a/ArchiSteamFarm/config/ASF.json +++ b/ArchiSteamFarm/config/ASF.json @@ -1,24 +1,24 @@ { - "AutoRestart": true, - "AutoUpdates": true, - "Blacklist": [], - "ConnectionTimeout": 60, - "CurrentCulture": null, - "Debug": false, - "FarmingDelay": 15, - "GiftsLimiterDelay": 1, - "Headless": false, - "IdleFarmingPeriod": 3, - "InventoryLimiterDelay": 3, - "LoginLimiterDelay": 10, - "MaxFarmingTime": 10, - "MaxTradeHoldDuration": 15, - "OptimizationMode": 0, - "Statistics": true, - "SteamOwnerID": 0, - "SteamProtocol": 6, - "UpdateChannel": 1, - "WCFBinding": 0, - "WCFHost": "127.0.0.1", - "WCFPort": 1242 + "AutoRestart": true, + "AutoUpdates": true, + "Blacklist": [], + "ConnectionTimeout": 60, + "CurrentCulture": null, + "Debug": false, + "FarmingDelay": 15, + "GiftsLimiterDelay": 1, + "Headless": false, + "IdleFarmingPeriod": 3, + "InventoryLimiterDelay": 3, + "LoginLimiterDelay": 10, + "MaxFarmingTime": 10, + "MaxTradeHoldDuration": 15, + "OptimizationMode": 0, + "Statistics": true, + "SteamOwnerID": 0, + "SteamProtocol": 6, + "UpdateChannel": 1, + "WCFBinding": 0, + "WCFHost": "127.0.0.1", + "WCFPort": 1242 } \ No newline at end of file diff --git a/ArchiSteamFarm/config/example.json b/ArchiSteamFarm/config/example.json index 6ea3822a2..baaf8d778 100644 --- a/ArchiSteamFarm/config/example.json +++ b/ArchiSteamFarm/config/example.json @@ -1,31 +1,31 @@ { - "AcceptGifts": false, - "CardDropsRestricted": true, - "CustomGamePlayedWhileFarming": null, - "CustomGamePlayedWhileIdle": null, - "DismissInventoryNotifications": false, - "Enabled": false, - "FarmingOrder": 0, - "FarmOffline": false, - "GamesPlayedWhileIdle": [], - "HandleOfflineMessages": false, - "IsBotAccount": false, - "LootableTypes": [ - 1, - 3, - 5 - ], - "PasswordFormat": 0, - "Paused": false, - "RedeemingPreferences": 0, - "SendOnFarmingFinished": false, - "SendTradePeriod": 0, - "ShutdownOnFarmingFinished": false, - "SteamLogin": null, - "SteamMasterClanID": 0, - "SteamParentalPIN": "0", - "SteamPassword": null, - "SteamTradeToken": null, - "SteamUserPermissions": {}, - "TradingPreferences": 0 -} + "AcceptGifts": false, + "CardDropsRestricted": true, + "CustomGamePlayedWhileFarming": null, + "CustomGamePlayedWhileIdle": null, + "DismissInventoryNotifications": false, + "Enabled": false, + "FarmingOrder": 0, + "FarmOffline": false, + "GamesPlayedWhileIdle": [], + "HandleOfflineMessages": false, + "IsBotAccount": false, + "LootableTypes": [ + 1, + 3, + 5 + ], + "PasswordFormat": 0, + "Paused": false, + "RedeemingPreferences": 0, + "SendOnFarmingFinished": false, + "SendTradePeriod": 0, + "ShutdownOnFarmingFinished": false, + "SteamLogin": null, + "SteamMasterClanID": 0, + "SteamParentalPIN": "0", + "SteamPassword": null, + "SteamTradeToken": null, + "SteamUserPermissions": {}, + "TradingPreferences": 0 +} \ No newline at end of file diff --git a/ArchiSteamFarm/config/minimal.json b/ArchiSteamFarm/config/minimal.json index 9699bdba5..22e780aca 100644 --- a/ArchiSteamFarm/config/minimal.json +++ b/ArchiSteamFarm/config/minimal.json @@ -1,5 +1,5 @@ { - "Enabled": false, - "SteamLogin": null, - "SteamPassword": null -} + "Enabled": false, + "SteamLogin": null, + "SteamPassword": null +} \ No newline at end of file diff --git a/ArchiSteamFarm/packages.config b/ArchiSteamFarm/packages.config index bda25b0dc..4249e77fe 100644 --- a/ArchiSteamFarm/packages.config +++ b/ArchiSteamFarm/packages.config @@ -1,15 +1,16 @@  + - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/ConfigGenerator/ConfigPage.cs b/ConfigGenerator/ConfigPage.cs index 3171c186f..cb8f42407 100644 --- a/ConfigGenerator/ConfigPage.cs +++ b/ConfigGenerator/ConfigPage.cs @@ -39,6 +39,8 @@ namespace ConfigGenerator { Controls.Add(enhancedPropertyGrid); } - internal void RefreshText() => Text = Path.GetFileNameWithoutExtension(ASFConfig.FilePath); + internal void RefreshText() { + Text = Path.GetFileNameWithoutExtension(ASFConfig.FilePath); + } } } \ No newline at end of file diff --git a/ConfigGenerator/FlagEnumEditor.cs b/ConfigGenerator/FlagEnumEditor.cs index 93a8ddd75..d026565e6 100644 --- a/ConfigGenerator/FlagEnumEditor.cs +++ b/ConfigGenerator/FlagEnumEditor.cs @@ -68,7 +68,9 @@ namespace ConfigGenerator { } // Gets the current bit value corresponding to all checked items - private int GetCurrentValue() => (from object t in Items select t as FlagCheckedListBoxItem).Where((item, i) => (item != null) && GetItemChecked(i)).Aggregate(0, (current, item) => current | item.Value); + private int GetCurrentValue() { + return (from object t in Items select t as FlagCheckedListBoxItem).Where((item, i) => (item != null) && GetItemChecked(i)).Aggregate(0, (current, item) => current | item.Value); + } #region Component Designer generated code @@ -146,7 +148,9 @@ namespace ConfigGenerator { Caption = c; } - public override string ToString() => Caption; + public override string ToString() { + return Caption; + } } // UITypeEditor for flag enums @@ -175,6 +179,8 @@ namespace ConfigGenerator { return FlagEnumCb.EnumValue; } - public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) => UITypeEditorEditStyle.DropDown; + public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) { + return UITypeEditorEditStyle.DropDown; + } } } \ No newline at end of file diff --git a/ConfigGenerator/packages.config b/ConfigGenerator/packages.config index 2897ef632..4982963b5 100644 --- a/ConfigGenerator/packages.config +++ b/ConfigGenerator/packages.config @@ -1,8 +1,9 @@  + - - - - - + + + + + \ No newline at end of file diff --git a/GUI/BotStatusForm.cs b/GUI/BotStatusForm.cs index 60bf58641..ad422a2a7 100644 --- a/GUI/BotStatusForm.cs +++ b/GUI/BotStatusForm.cs @@ -40,6 +40,8 @@ namespace ArchiSteamFarm { AvatarPictureBox.LoadAsync(); } - private void AvatarPictureBox_LoadCompleted(object sender, AsyncCompletedEventArgs e) => MainForm.UpdateBotAvatar(Bot.BotName, AvatarPictureBox.Image); + private void AvatarPictureBox_LoadCompleted(object sender, AsyncCompletedEventArgs e) { + MainForm.UpdateBotAvatar(Bot.BotName, AvatarPictureBox.Image); + } } } \ No newline at end of file diff --git a/GUI/MainForm.cs b/GUI/MainForm.cs index 52ab8a940..5cef4b172 100644 --- a/GUI/MainForm.cs +++ b/GUI/MainForm.cs @@ -57,7 +57,9 @@ namespace ArchiSteamFarm { BotStatusForm.BotForms[PreviouslySelectedBotName].Visible = true; } - private async void MainForm_FormClosed(object sender, FormClosedEventArgs e) => await Program.InitShutdownSequence().ConfigureAwait(false); + private async void MainForm_FormClosed(object sender, FormClosedEventArgs e) { + await Program.InitShutdownSequence().ConfigureAwait(false); + } private async void MainForm_Load(object sender, EventArgs e) { BotListView.LargeImageList = BotListView.SmallImageList = AvatarImageList; diff --git a/GUI/Program.cs b/GUI/Program.cs index 79c5fe342..980b0f987 100644 --- a/GUI/Program.cs +++ b/GUI/Program.cs @@ -29,7 +29,9 @@ namespace ArchiSteamFarm { Application.Exit(); } - internal static string GetUserInput(ASF.EUserInputType userInputType, string botName = SharedInfo.ASF, string extraInformation = null) => null; // TODO + internal static string GetUserInput(ASF.EUserInputType userInputType, string botName = SharedInfo.ASF, string extraInformation = null) { + return null; + } internal static async Task InitASF() { ASF.ArchiLogger.LogGenericInfo("ASF V" + SharedInfo.Version); diff --git a/GUI/packages.config b/GUI/packages.config index 95f0f49d6..4f7360db2 100644 --- a/GUI/packages.config +++ b/GUI/packages.config @@ -1,16 +1,17 @@  + - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file