private void LoadSsh()
        {
            var ofd = new OpenFileDialog();

            ofd.Title  = "SSH File(Host|Username|Password)";
            ofd.Filter = "SSH file|*.txt";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                SplashScreenManager.ShowForm(this.FindForm(), typeof(WaitForm1), true, true, false);
                var lines = File.ReadAllLines(ofd.FileName);

                foreach (var line in lines)
                {
                    ssh++;
                    SplashScreenManager.Default.SetWaitFormDescription($"Processing {ssh}/{lines.Length} SSH...");
                    var sp = line.Split('|');
                    if (sp.Length < 3)
                    {
                        continue;
                    }
                    var item = new SshItems()
                    {
                        Host     = sp[0],
                        Username = sp[1],
                        Password = sp[2],
                        IsAlive  = true,
                    };
                    SshController.Instance.Insert(item);
                }
                FillSshToListView();
                SplashScreenManager.CloseForm();
            }
        }
        private void Edit()
        {
            labelControl1.Text = "EDIT";
            isAdd = false;
            var selectedItem = gridView1.GetSelectedItems <SshItems>()?.ToList();

            selectedSsh = selectedItem[0];
            if (selectedItem != null && selectedItem.Count > 0)
            {
                teHost.Text     = selectedItem[0].Host;
                teUsername.Text = selectedItem[0].Username;
                teUsername.Text = selectedItem[0].Password;
                flyoutPanel1.ShowBeakForm();
                teHost.Focus();
            }
        }
        public List <SshItems> getAllSsh()
        {
            var             table = DataController.Instance.GetDataTable("SELECT * FROM Sshes");
            List <SshItems> items = new List <SshItems>();

            foreach (DataRow row in table.Rows)
            {
                var ssh = new SshItems();
                ssh.Id       = int.Parse(row["Id"].ToString());
                ssh.Host     = row["Host"].ToString();
                ssh.Username = row["Username"].ToString();
                ssh.Password = row["Password"].ToString();
                ssh.IsAlive  = row["IsAlive"].ToString() == "1";

                items.Add(ssh);
            }
            return(items);
        }
        public bool UpdateSsh(int id, SshItems newSsh)
        {
            var updateCmd = $"UPDATE Sshes SET Host='{newSsh.Host}',Username='******',Password='******' WHERE Id = {id}";

            return(DataController.Instance.ExecuteNonQuerry(updateCmd) > 0);
        }
        public void Insert(SshItems ssh)
        {
            var insertCmd = $"INSERT INTO Sshes(Host,Username,Password,IsAlive)VALUES('{ssh.Host}','{ssh.Username}','{ssh.Password}','1')";

            DataController.Instance.ExecuteNonQuerry(insertCmd);
        }