private void btn_Add_Click(object sender, EventArgs e) { ServerWrapper.AddServerManually(tb_IP.Text, tb_UserName.Text, tb_Password.Text); tb_IP.Clear(); tb_UserName.Clear(); tb_Password.Clear(); tb_IP.Focus(); }
public static void CsVtoServersList(string filePath) { using (var sr = new StreamReader(filePath)) { sr.ReadLine(); // to skip the line with headers try { while (!sr.EndOfStream) { var line = sr.ReadLine(); if (line != null) { var values = line.Split(','); ServerWrapper.AddServerManually(values[0], values[1], values[2]); } } } catch (IndexOutOfRangeException) { MessageBox.Show("Incorrect format of CSV File.\nPlease make sure that it has following format:\n{Ip,Userame,Password}", "CSV Import Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }