private void btnGenerate_Click(object sender, EventArgs e) { if (ddlDictionary.SelectedIndex < 0) { MessageBox.Show("No Dictionary Selected"); return; } string password = string.Empty; char splitChar = new char(); eDictionary dictionary = (eDictionary)Enum.Parse(typeof(eDictionary), ddlDictionary.SelectedItem.ToString()); int.TryParse(ictrlNumberOfWords.Value.ToString(), out int amount); List <string> passwordWords = GetAmountOfWords(amount, dictionary); if (chkSplit.Checked) { if (txtSplitChar.Text.Length > 0) { splitChar = Convert.ToChar(txtSplitChar.Text); } else { MessageBox.Show("Can't split on an empty char."); return; } } foreach (string s in passwordWords) { string word = s; if (chkUppercase.Checked) { word = FirstCharToUpper(s); } if (splitChar != new char()) { password += splitChar.ToString(); } password += word; } //cba stopping it from adding to beginning and end password = password.Substring(1, password.Length - 1); txtPassword.Text = password; }
public Form1() { InitializeComponent(); tooltipDictionary = new eDictionary(); var tooltip = new RichTextBoxToolTip { RichTextBox = textArea, Dictionary = tooltipDictionary, TitlePrefix = "Alternatywy dla wyrazu \"", TitleSuffix = "\": ", TitleBrush = Brushes.DarkBlue, TitleFont = new Font(textArea.SelectionFont, FontStyle.Bold), DescriptionFont = new Font(textArea.SelectionFont, FontStyle.Regular), DescriptionBrush = Brushes.Blue, }; wordsDictionary = new WordsDictionary(); words = new List <Word>(); }