File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Threading ;
2
3
using System . Threading . Tasks ;
3
4
using TbsCore . Models . AccModels ;
4
5
using TbsCore . Models . VillageModels ;
@@ -52,7 +53,19 @@ public abstract class BotTask
52
53
/// </summary>
53
54
public TaskPriority Priority { get ; set ; }
54
55
55
- protected bool StopFlag = false ;
56
+ private long stopFlag ;
57
+
58
+ public bool StopFlag
59
+ {
60
+ get
61
+ {
62
+ return Interlocked . Read ( ref stopFlag ) == 1 ;
63
+ }
64
+ set
65
+ {
66
+ Interlocked . Exchange ( ref stopFlag , Convert . ToInt64 ( value ) ) ;
67
+ }
68
+ }
56
69
57
70
protected void Retry ( Account acc , string message )
58
71
{
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public class UpgradeBuilding : BotTask
23
23
24
24
public override async Task < TaskRes > Execute ( Account acc )
25
25
{
26
+ StopFlag = false ;
26
27
do
27
28
{
28
29
if ( StopFlag ) return TaskRes . Executed ;
You can’t perform that action at this time.
0 commit comments