retryactivity.cs

来自「破解的飞信源代码」· CS 代码 · 共 58 行

CS
58
字号
namespace Imps.Client.Core.Login
{
    using Imps.Client.Core;
    using System;

    public class RetryActivity
    {
        internal readonly LoginAction _action;
        private int _failedTimes;
        private const int MAX_FAIL_TIMES = 3;

        public RetryActivity(LoginAction action)
        {
            this._action = action;
            this._failedTimes = 0;
        }

        public bool Execute()
        {
            try
            {
                RetryResult result = new RetryResult();
                this._action.Retry(result);
                if (result.IsCompleted)
                {
                    return false;
                }
                if (!result.IsSucceed)
                {
                    this._failedTimes++;
                }
                else
                {
                    this._failedTimes = 0;
                }
            }
            catch
            {
                this._failedTimes++;
            }
            if (this.FailedTimes >= 3)
            {
                return false;
            }
            return true;
        }

        internal int FailedTimes
        {
            get
            {
                return this._failedTimes;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?