Example #1
0
        private List <string> loadCustomUsers(Giveaway giveaway)
        {
            List <string> custom_users = new List <string>();

            if (customButtonInput.Checked)
            {
                if (!string.IsNullOrEmpty(customInput.Text))
                {
                    custom_users = this.readTextBoxInput(customInput, giveaway);
                }
            }
            else if (customButtonText.Checked && file_loaded_custom)
            {
                custom_users = this.readFileInput(custom_filename, giveaway);
            }

            return(custom_users);
        }
Example #2
0
        private List <string> loadIgnoredUsers(Giveaway giveaway)
        {
            List <string> ignored_users = new List <string>();

            if (ignoreButtonInput.Checked)
            {
                if (!string.IsNullOrEmpty(ignoreInput.Text))
                {
                    ignored_users = this.readTextBoxInput(ignoreInput, giveaway);
                }
            }
            else if (ignoreButtonText.Checked && file_loaded_ignore)
            {
                ignored_users = this.readFileInput(ignore_filename, giveaway);
            }

            return(ignored_users);
        }
Example #3
0
        // Reads usernames entered in the text boxes.
        private List <string> readTextBoxInput(RichTextBox box, Giveaway giveaway)
        {
            List <string> users = new List <string>();

            string[] lines = box.Lines;
            foreach (string line in lines)
            {
                string name;
                try
                {
                    name = giveaway.request.getDisplayName(line.ToLower());
                    users.Add(name);
                }
                catch (WebException)
                {
                    MessageBox.Show(string.Format("Invalid username \"{0}\".", line), "Giveaway Error.",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw;
                }
            }

            return(users);
        }