70 lines
1.2 KiB
C#
70 lines
1.2 KiB
C#
namespace Questionable.Controller.Steps.Interactions;
|
|
|
|
internal sealed class DutyRetryState
|
|
{
|
|
private int _retryCount;
|
|
|
|
public bool AwaitingOutcome { get; private set; }
|
|
|
|
public bool CanRetry(int maxRetries)
|
|
{
|
|
int num = ((maxRetries < 0) ? 1447023727 : 1447023721);
|
|
bool result = default(bool);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 1447023724;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
num = 1447023721;
|
|
break;
|
|
case 4:
|
|
result = _retryCount < maxRetries;
|
|
num = 1447023725;
|
|
break;
|
|
case 3:
|
|
result = true;
|
|
num = 1447023725;
|
|
break;
|
|
case 2:
|
|
result = false;
|
|
num = 1447023725;
|
|
break;
|
|
case 5:
|
|
num = ((maxRetries != 0) ? 1447023720 : 1447023726);
|
|
break;
|
|
case 1:
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void BeginAwaitingOutcome()
|
|
{
|
|
AwaitingOutcome = true;
|
|
}
|
|
|
|
public void EndAwaitingOutcome()
|
|
{
|
|
AwaitingOutcome = false;
|
|
}
|
|
|
|
public void RecordRetry()
|
|
{
|
|
int retryCount = _retryCount;
|
|
int num = 1;
|
|
int num2 = retryCount;
|
|
int num3 = num2 ^ num;
|
|
int num4 = num2 & num;
|
|
_retryCount = num3 + (num4 + num4);
|
|
AwaitingOutcome = false;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_retryCount = 0;
|
|
AwaitingOutcome = false;
|
|
}
|
|
}
|