asmrobot
2019-11-25 2aeab450471cb80b59002da7da80faf251a0c4f4
src/RichCreator/Models/RichCreatorConfig.cs
@@ -71,6 +71,56 @@
        /// </summary>
        public string Password3 { get; set; }
        /// <summary>
        /// 获取配置文件中账号的数量
        /// </summary>
        /// <returns></returns>
        public Int32 GetAccountCount()
        {
            Int32 accountCount = 0;
            if (!string.IsNullOrEmpty(this.UserName1))
            {
                accountCount = 1;
                if (!string.IsNullOrEmpty(this.UserName2))
                {
                    accountCount = 2;
                    if (!string.IsNullOrEmpty(this.UserName3))
                    {
                        accountCount = 3;
                    }
                }
            }
            return accountCount;
        }
        /// <summary>
        /// 获取指定编号
        /// </summary>
        /// <param name="accountIndex">从0开始</param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public void GetAccount(Int32 accountIndex, out string username, out string password)
        {
            username = this.UserName1;
            password = this.Password1;
            if (accountIndex == 1)
            {
                username = this.UserName2;
                password = this.Password2;
            }
            if (accountIndex == 2)
            {
                username = this.UserName3;
                password = this.Password3;
            }
        }
    }
}