File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -13,18 +13,20 @@ internal sealed class BotContext : IDisposable {
13
13
private const ulong TriesBeforeBlacklistingGameEntry = 5 ;
14
14
15
15
private readonly Dictionary < GameIdentifier , ( ulong counter , DateTime date ) > AppRegistrationContexts = new ( ) ;
16
- private readonly WeakReference < Bot > Bot ;
16
+ private readonly string BotIdentifier ;
17
17
private readonly TimeSpan BlacklistTimeout = TimeSpan . FromDays ( 1 ) ;
18
18
private readonly CompletedAppList CompletedApps = new ( ) ;
19
19
private long LastRunMilli ;
20
20
21
21
public BotContext ( Bot bot ) {
22
- Bot = new WeakReference < Bot > ( bot ) ;
22
+ BotIdentifier = bot . BotName ;
23
23
NewRun ( ) ;
24
24
}
25
25
26
26
private string CompletedAppFilePath ( ) {
27
- if ( ! Bot . TryGetTarget ( out var bot ) ) {
27
+ Bot ? bot = Bot . GetBot ( BotIdentifier ) ;
28
+
29
+ if ( bot is null ) {
28
30
return string . Empty ;
29
31
}
30
32
@@ -65,11 +67,9 @@ public bool HasApp(in GameIdentifier gameIdentifier) {
65
67
return true ;
66
68
}
67
69
68
- if ( ! Bot . TryGetTarget ( out var bot ) ) {
69
- return false ;
70
- }
70
+ Bot ? bot = Bot . GetBot ( BotIdentifier ) ;
71
71
72
- return bot . OwnedPackageIDs . ContainsKey ( checked ( ( uint ) gameIdentifier . Id ) ) ;
72
+ return bot is not null && bot . OwnedPackageIDs . ContainsKey ( checked ( ( uint ) gameIdentifier . Id ) ) ;
73
73
}
74
74
75
75
public bool ShouldHideErrorLogForApp ( in GameIdentifier gameIdentifier ) => ( AppTickCount ( in gameIdentifier ) > 0 ) || CompletedApps . ContainsInvalid ( in gameIdentifier ) ;
You can’t perform that action at this time.
0 commit comments