Beispiel #1
0
        //**************************************************************************************************
        private void LoadServers()
        {
            Main.servers.Clear();
            using (XwDbCommand sql = new XwDbCommand(Config.GetConnectionString(), "Data.SQLite"))
            {
                sql.ExecuteTX($@"SELECT 
                    id
                    ,name
                    ,host
                    ,ServerType
                    ,Username
                    ,Password
                    ,port   
                    ,Sendkeys
                    ,sound
                    ,drives
                    ,favorite
                    ,groupid
                    ,color
                    ,X
                    ,Y
                    ,Console
                    ,AutoScale
                    ,SSH1
                    ,Passive
                    ,Themes
                    ,Certificates
                    ,UseHtmlLogin
                    ,HtmlUserBox
                    ,HtmlPassBox
                    ,HtmlLoginBtn
                    ,TabColor
                    ,Notes
                    ,SshTerminal
                    ,Encryption
                    ,SshKey
                    ,FtpDataType
                    FROM Servers
                    ORDER BY name
                    COLLATE NOCASE");

                while (sql.Read())
                {
                    ServerType type   = (ServerType)sql.Value("ServerType").ToInt32();
                    var        server = Server.GetServerInstance(type);
                    server.ID            = sql.Value("id").ToInt32();
                    server.Type          = type;
                    server.Name          = sql.Value("name").ToString();
                    server.Host          = sql.Value("host").ToString();
                    server.Username      = sql.Value("username").ToString();
                    server.Password      = sql.Value("password").ToString();
                    server.Port          = sql.Value("port").ToInt32();
                    server.SendKeys      = sql.Value("sendkeys").ToBoolean();
                    server.UseSound      = sql.Value("sound").ToBoolean();
                    server.ConnectDrives = sql.Value("drives").ToBoolean();
                    server.IsFavorite    = sql.Value("favorite").ToBoolean();
                    server.GroupID       = sql.Value("GroupID").ToInt32();
                    server.Color         = sql.Value("Color").ToInt32();
                    server.Width         = sql.Value("X").ToInt32();
                    server.Height        = sql.Value("Y").ToInt32();
                    server.AutoScale     = sql.Value("AutoScale").ToBoolean();
                    server.SSH1          = sql.Value("SSH1").ToBoolean();
                    server.Passive       = sql.Value("Passive").ToBoolean();
                    server.Themes        = sql.Value("Themes").ToBoolean();
                    server.Certificates  = sql.Value("Certificates").ToBoolean();
                    server.UseHtmlLogin  = sql.Value("UseHtmlLogin").ToBoolean();
                    server.HtmlUserBox   = sql.Value("HtmlUserBox").ToString();
                    server.HtmlPassBox   = sql.Value("HtmlPassBox").ToString();
                    server.HtmlLoginBtn  = sql.Value("HtmlLoginBtn").ToString();
                    server.TabColor      = sql.Value("TabColor").ToInt32();
                    server.Notes         = sql.Value("Notes").ToString();
                    server.SshTerminal   = sql.Value("SshTerminal").ToInt32();
                    server.Encryption    = sql.Value("Encryption").ToBoolean();
                    server.SshKey        = sql.Value("SshKey").ToString();
                    server.FtpDataType   = sql.Value("FtpDataType").ToInt32();
                    Main.servers.Add(server);
                }
            }
        }