4
4
using System . Globalization ;
5
5
using System . Linq ;
6
6
using System . Reflection ;
7
- using System . Text ;
8
7
using System . Threading . Tasks ;
9
8
using AngleSharp . Dom ;
10
9
using ArchiSteamFarm . Core ;
@@ -23,10 +22,6 @@ namespace GameRemover;
23
22
[ UsedImplicitly ]
24
23
public class GameRemoverPlugin : IBotCommand2
25
24
{
26
- private static readonly CompositeFormat ErrorIsInvalid = CompositeFormat . Parse ( Strings . ErrorIsInvalid ) ;
27
- private static readonly CompositeFormat ErrorObjectIsNull = CompositeFormat . Parse ( Strings . ErrorObjectIsNull ) ;
28
- private static readonly CompositeFormat BotNotFound = CompositeFormat . Parse ( Strings . BotNotFound ) ;
29
-
30
25
public Task OnLoaded ( )
31
26
{
32
27
ASF . ArchiLogger . LogGenericInfo ( $ "{ Name } by ezhevita | Support & source code: https://github.com/ezhevita/{ Name } ") ;
@@ -64,7 +59,7 @@ public Task OnLoaded()
64
59
{
65
60
if ( ! uint . TryParse ( appIDText , out var appID ) || ( appID == 0 ) || ! appIDs . Add ( appID ) )
66
61
{
67
- return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , ErrorIsInvalid , appIDText ) ) ;
62
+ return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsInvalid , appIDText ) ) ;
68
63
}
69
64
}
70
65
@@ -75,18 +70,18 @@ public Task OnLoaded()
75
70
using var responseDeleteGamePage = ( await bot . ArchiWebHandler . UrlGetToHtmlDocumentWithSession ( uriDeleteGamePage ) . ConfigureAwait ( false ) ) ? . Content ;
76
71
if ( responseDeleteGamePage == null )
77
72
{
78
- return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , ErrorObjectIsNull , nameof ( responseDeleteGamePage ) ) ) ;
73
+ return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorObjectIsNull , nameof ( responseDeleteGamePage ) ) ) ;
79
74
}
80
75
81
76
var node = responseDeleteGamePage . SelectSingleNode < IElement > ( "//input[@id='packageid']" ) ;
82
77
if ( node == null )
83
78
{
84
- return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , ErrorObjectIsNull , nameof ( node ) ) ) ;
79
+ return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorObjectIsNull , nameof ( node ) ) ) ;
85
80
}
86
81
87
82
if ( ! uint . TryParse ( node . GetAttribute ( "value" ) , out var packageID ) || ( packageID == 0 ) )
88
83
{
89
- return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , ErrorIsInvalid , nameof ( packageID ) ) ) ;
84
+ return bot . Commands . FormatBotResponse ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsInvalid , nameof ( packageID ) ) ) ;
90
85
}
91
86
92
87
Dictionary < string , string > data = new ( 3 )
@@ -110,7 +105,7 @@ public Task OnLoaded()
110
105
var bots = Bot . GetBots ( botNames ) ;
111
106
if ( ( bots == null ) || ( bots . Count == 0 ) )
112
107
{
113
- return access >= EAccess . Owner ? Commands . FormatStaticResponse ( string . Format ( CultureInfo . CurrentCulture , BotNotFound , botNames ) ) : null ;
108
+ return access >= EAccess . Owner ? Commands . FormatStaticResponse ( string . Format ( CultureInfo . CurrentCulture , Strings . BotNotFound , botNames ) ) : null ;
114
109
}
115
110
116
111
var results = await Utilities . InParallel ( bots . Select ( bot => ResponseDeleteGame ( bot , Commands . GetProxyAccess ( bot , access , steamID ) , appIDsText ) ) ) . ConfigureAwait ( false ) ;
0 commit comments