public void addAccount(string username, string password, string region) { AccountInBox item = new AccountInBox(username, password, region); this.accountsInBox.Add(item); string text = ""; for (int i = 0; i < password.Length; i++) { text += "•"; } using (StreamWriter streamWriter = new StreamWriter(this.specificFolder + "\\accounts.txt", true)) { streamWriter.WriteLine(string.Concat(new string[] { username, "|", password, "|", region })); } this.listBox1.Items.Add(string.Concat(new string[] { username, "|", text, "|", region })); }
private void button5_Click(object sender, EventArgs e) { var selectedItems = listBox1.SelectedItems; for (int i = selectedItems.Count - 1; i >= 0; i--) { string itemText = selectedItems[i].ToString(); string[] itemSeperator = itemText.Split('|'); string username = itemSeperator[0]; int passwordLength = itemSeperator[1].Length; string region = itemSeperator[2]; AccountInBox toSelect = accountsInBox.FirstOrDefault <AccountInBox>(u => u._username == username && u._region == region && u._password.Length == passwordLength); if (!checkBox1.Checked) { _parent.addMdiChild(toSelect._username, toSelect._password, toSelect._region, false); } else { _parent.addMdiChild(toSelect._username, toSelect._password, toSelect._region, true); } } if (selectedItems.Count > 1) { this.Close(); } }
private void button5_Click(object sender, EventArgs e) { ListBox.SelectedObjectCollection selectedItems = this.listBox1.SelectedItems; for (int i = selectedItems.Count - 1; i >= 0; i--) { string text = selectedItems[i].ToString(); string[] array = text.Split(new char[] { '|' }); string username = array[0]; int passwordLength = array[1].Length; string region = array[2]; AccountInBox accountInBox = this.accountsInBox.FirstOrDefault((AccountInBox u) => u._username == username && u._region == region && u._password.Length == passwordLength); if (!this.checkBox1.Checked) { AccountManager._parent.addMdiChild(accountInBox._username, accountInBox._password, accountInBox._region, false); } else { AccountManager._parent.addMdiChild(accountInBox._username, accountInBox._password, accountInBox._region, true); } } if (selectedItems.Count > 1) { base.Close(); } }
private void button3_Click(object sender, EventArgs e) { ListBox.SelectedObjectCollection selectedItems = this.listBox1.SelectedItems; for (int i = selectedItems.Count - 1; i >= 0; i--) { string text = selectedItems[i].ToString(); string[] array = text.Split(new char[] { '|' }); string username = array[0]; int passwordLength = array[1].Length; string region = array[2]; AccountInBox item = this.accountsInBox.FirstOrDefault((AccountInBox u) => u._username == username && u._region == region && u._password.Length == passwordLength); this.accountsInBox.Remove(item); this.listBox1.Items.Remove(selectedItems[i]); } using (StreamWriter streamWriter = new StreamWriter(this.specificFolder + "\\accounts.txt", false)) { foreach (AccountInBox current in this.accountsInBox) { streamWriter.WriteLine(string.Concat(new string[] { current._username, "|", current._password, "|", current._region })); } } }
private void AccountManager_Load(object sender, EventArgs e) { ImageList imageList = new ImageList(); imageList.Images.Add(Resources.add); imageList.ImageSize = new Size(16, 16); this.button2.ImageList = imageList; this.button2.ImageIndex = 0; ImageList imageList2 = new ImageList(); imageList2.Images.Add(Resources.adelete); imageList2.ImageSize = new Size(16, 16); this.button3.ImageList = imageList2; this.button3.ImageIndex = 0; if (File.Exists(this.specificFolder + "\\accounts.txt")) { TextReader textReader = File.OpenText(this.specificFolder + "\\accounts.txt"); string text; while ((text = textReader.ReadLine()) != null) { string[] array = text.Split(new char[] { '|' }); AccountInBox item = new AccountInBox(array[0], array[1], array[2]); this.accountsInBox.Add(item); string text2 = ""; for (int i = 0; i < array[1].Length; i++) { text2 += "•"; } this.listBox1.Items.Add(string.Concat(new string[] { array[0], "|", text2, "|", array[2] })); } textReader.Close(); } object[] regions = Enums.regions; for (int j = 0; j < regions.Length; j++) { string item2 = (string)regions[j]; this.comboBox1.Items.Add(item2); } this.comboBox1.SelectedIndex = 1; }
public void addAccount(string username, string password, string region) { AccountInBox newAccountForBox = new AccountInBox(username, password, region); accountsInBox.Add(newAccountForBox); string temporaryPassword = ""; for(int i = 0; i < password.Length; i++){ temporaryPassword = temporaryPassword + "•"; } using (StreamWriter newTask = new StreamWriter(specificFolder + "\\accounts.txt", true)) { newTask.WriteLine(username + "|" + password + "|" + region); } //MessageBox.Show(username + "|" + temporaryPassword + "|" + region); listBox1.Items.Add(username + "|" + temporaryPassword + "|" + region); }
public void addAccount(string username, string password, string region) { AccountInBox newAccountForBox = new AccountInBox(username, password, region); accountsInBox.Add(newAccountForBox); string temporaryPassword = ""; for (int i = 0; i < password.Length; i++) { temporaryPassword = temporaryPassword + "•"; } using (StreamWriter newTask = new StreamWriter(specificFolder + "\\accounts.txt", true)) { newTask.WriteLine(username + "|" + password + "|" + region); } //MessageBox.Show(username + "|" + temporaryPassword + "|" + region); listBox1.Items.Add(username + "|" + temporaryPassword + "|" + region); }
private void AccountManager_Load(object sender, EventArgs e) { ImageList ilButtonAdd = new ImageList(); ilButtonAdd.Images.Add(Properties.Resources.add); ilButtonAdd.ImageSize = new Size(16, 16); button2.ImageList = ilButtonAdd; button2.ImageIndex = 0; ImageList ilButtonDelete = new ImageList(); ilButtonDelete.Images.Add(Properties.Resources.adelete); ilButtonDelete.ImageSize = new Size(16, 16); button3.ImageList = ilButtonDelete; button3.ImageIndex = 0; if (File.Exists(specificFolder + "\\accounts.txt")) { TextReader tr = File.OpenText(specificFolder + "\\accounts.txt"); string line; while ((line = tr.ReadLine()) != null) { string[] lineSeperated = line.Split('|'); AccountInBox aib = new AccountInBox(lineSeperated[0], lineSeperated[1], lineSeperated[2]); accountsInBox.Add(aib); string temporaryPassword = ""; for (int i = 0; i < lineSeperated[1].Length; i++) { temporaryPassword = temporaryPassword + "•"; } listBox1.Items.Add(lineSeperated[0] + "|" + temporaryPassword + "|" + lineSeperated[2]); } tr.Close(); } foreach (string region in Enums.regions) { comboBox1.Items.Add(region); } comboBox1.SelectedIndex = 1; }
private void AccountManager_Load(object sender, EventArgs e) { ImageList ilButtonAdd = new ImageList(); ilButtonAdd.Images.Add(LoliBot.Properties.Resources.add); ilButtonAdd.ImageSize = new Size(16, 16); button2.ImageList = ilButtonAdd; button2.ImageIndex = 0; ImageList ilButtonDelete = new ImageList(); ilButtonDelete.Images.Add(LoliBot.Properties.Resources.adelete); ilButtonDelete.ImageSize = new Size(16, 16); button3.ImageList = ilButtonDelete; button3.ImageIndex = 0; if (File.Exists(specificFolder + "\\accounts.txt")) { TextReader tr = File.OpenText(specificFolder + "\\accounts.txt"); string line; while ((line = tr.ReadLine()) != null) { string[] lineSeperated = line.Split('|'); AccountInBox aib = new AccountInBox(lineSeperated[0], lineSeperated[1], lineSeperated[2]); accountsInBox.Add(aib); string temporaryPassword = ""; for (int i = 0; i < lineSeperated[1].Length; i++) { temporaryPassword = temporaryPassword + "•"; } listBox1.Items.Add(lineSeperated[0] + "|" + temporaryPassword + "|" + lineSeperated[2]); } tr.Close(); } foreach (string region in Enums.regions) { comboBox1.Items.Add(region); } comboBox1.SelectedIndex = 1; }
private void button3_Click(object sender, EventArgs e) { var selectedItems = listBox1.SelectedItems; for (int i = selectedItems.Count - 1; i >= 0; i--) { string itemText = selectedItems[i].ToString(); string[] itemSeperator = itemText.Split('|'); string username = itemSeperator[0]; int passwordLength = itemSeperator[1].Length; string region = itemSeperator[2]; AccountInBox toDelete = accountsInBox.FirstOrDefault <AccountInBox>(u => u._username == username && u._region == region && u._password.Length == passwordLength); accountsInBox.Remove(toDelete); listBox1.Items.Remove(selectedItems[i]); } using (StreamWriter newTask = new StreamWriter(specificFolder + "\\accounts.txt", false)) { foreach (AccountInBox toSave in accountsInBox) { newTask.WriteLine(toSave._username + "|" + toSave._password + "|" + toSave._region); } } }