From 811ea46523c63367be86cd51ab730c528f4ddbd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Domeradzki?= Date: Thu, 4 Jul 2024 01:33:45 +0200 Subject: [PATCH] Remove deprecated functionality, bump --- .../Plugins/Interfaces/IBotTradeOffer.cs | 46 ------------------- ArchiSteamFarm/Plugins/PluginsCore.cs | 20 +------- Directory.Build.props | 2 +- 3 files changed, 2 insertions(+), 66 deletions(-) delete mode 100644 ArchiSteamFarm/Plugins/Interfaces/IBotTradeOffer.cs diff --git a/ArchiSteamFarm/Plugins/Interfaces/IBotTradeOffer.cs b/ArchiSteamFarm/Plugins/Interfaces/IBotTradeOffer.cs deleted file mode 100644 index 27dcb06af..000000000 --- a/ArchiSteamFarm/Plugins/Interfaces/IBotTradeOffer.cs +++ /dev/null @@ -1,46 +0,0 @@ -// ---------------------------------------------------------------------------------------------- -// _ _ _ ____ _ _____ -// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ -// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ -// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | -// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| -// ---------------------------------------------------------------------------------------------- -// | -// Copyright 2015-2024 Ɓ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.Threading.Tasks; -using ArchiSteamFarm.Steam; -using ArchiSteamFarm.Steam.Data; -using JetBrains.Annotations; - -namespace ArchiSteamFarm.Plugins.Interfaces; - -/// -/// -/// Implementing this interface allows your plugin to implement custom logic for accepting trades that ASF isn't willing to handle itself. -/// -[PublicAPI] -[Obsolete($"Use {nameof(IBotTradeOffer2)} interface instead, this one will be removed in the next version")] -public interface IBotTradeOffer : IPlugin { - /// - /// ASF will call this method for unhandled (ignored and rejected) trade offers received by the bot. - /// - /// Bot object related to this callback. - /// Trade offer related to this callback. - /// True if the trade offer should be accepted as part of this plugin, false otherwise. - Task OnBotTradeOffer(Bot bot, TradeOffer tradeOffer); -} diff --git a/ArchiSteamFarm/Plugins/PluginsCore.cs b/ArchiSteamFarm/Plugins/PluginsCore.cs index cadea74d4..2efbbb411 100644 --- a/ArchiSteamFarm/Plugins/PluginsCore.cs +++ b/ArchiSteamFarm/Plugins/PluginsCore.cs @@ -249,12 +249,6 @@ public static class PluginsCore { await plugin.OnLoaded().ConfigureAwait(false); ASF.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.PluginLoaded, plugin.Name)); - -#pragma warning disable CS0618 // TODO: Pending removal - if (plugin is IBotTradeOffer) { - ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningDeprecated, $"{nameof(IBotTradeOffer)} ({plugin.Name})", nameof(IBotTradeOffer2))); - } -#pragma warning restore CS0618 // TODO: Pending removal } catch (Exception e) { ASF.ArchiLogger.LogGenericException(e); invalidPlugins.Add(plugin); @@ -608,19 +602,7 @@ public static class PluginsCore { return false; } -#pragma warning disable CS0618 // TODO: Pending removal - IList oldResponses; - - try { - oldResponses = await Utilities.InParallel(ActivePlugins.OfType().Select(plugin => plugin.OnBotTradeOffer(bot, tradeOffer))).ConfigureAwait(false); - } catch (Exception e) { - ASF.ArchiLogger.LogGenericException(e); - - return false; - } -#pragma warning restore CS0618 // TODO: Pending removal - - return responses.Any(static response => response) || oldResponses.Any(static response => response); + return responses.Any(static response => response); } internal static async Task OnBotTradeOfferResults(Bot bot, IReadOnlyCollection tradeResults) { diff --git a/Directory.Build.props b/Directory.Build.props index 7eaad96f8..b614a499f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 6.0.4.5 + 6.0.5.0