Beispiel #1
0
        /// <summary>
        /// Adds a new account by the currently defined data
        /// </summary>
        private void AddAccount()
        {
            String Nick  = textBoxNickname.Text;
            String OAuth = textBoxOAuth.Text;

            if (BotFile.GetAccountNames().Contains(Nick))
            {
                int pos = -1;
                for (int i = 0; i < BotFile.GetAccountNames().Length; i++)
                {
                    if (BotFile.GetAccountNames()[i] == Nick)
                    {
                        pos = i;
                        break;
                    }
                }
                if (pos < 0)
                {
                    return;
                }

                // Update the oauth key
                BotFile.Accounts[pos].OAuth = OAuth;
                return;
            }
            else
            {
                TwitchAccount t = new TwitchAccount(Nick, OAuth);
                BotFile.AddAccount(t);
                RefreshAccounts();
            }
        }