public CServer CSQL_GetServer(string key) { string sql = "SELECT * FROM servers " + "WHERE servers.server_addr like '" + key + "'" + " OR servers.server_friend_name like '" + key + "';"; SqliteCommand dbhCmd; SqliteDataReader dbhReader; CServer cserver = null; if (CSQL_Connected()) { dbhCmd = new SqliteCommand(sql, dbh); dbhReader = dbhCmd.ExecuteReader(); if (dbhReader.HasRows) { dbhReader.Read(); cserver = new CServer( dbhReader.GetString((int)tbl_servers.SERVER_ADDR), dbhReader.GetInt32((int)tbl_servers.SERVER_PORT), dbhReader.GetString((int)tbl_servers.SERVER_BASE_DIR), dbhReader.GetInt32((int)tbl_servers.SERVER_AUTH_REQ), dbhReader.GetString((int)tbl_servers.SERVER_UNAME), dbhReader.GetString((int)tbl_servers.SERVER_PNAME), dbhReader.GetString((int)tbl_servers.SERVER_FRIEND_NAME), dbhReader.GetString((int)tbl_servers.SERVER_PROTOCOL) ); } else { cleanup(); return(null); } } else { cleanup(); return(null); } cleanup(); return(cserver); }
public bool CSQL_UpdateServer(CServer server) { string sql_update_server = "UPDATE servers " + "SET server_friend_name = '" + server.ServerFriendName + "', " + "server_pword = '" + server.ServerPassword + "', " + "server_uname = '" + server.ServerUserName + "', " + "server_auth_req = " + server.ServerAuthRequired + ", " + "server_base_dir = '" + server.ServerBaseDir + "', " + "server_port = " + server.ServerPort + ", " + "server_addr = '" + server.ServerAddr + "', " + "server_protocol = '" + server.ServerProtocol + "' " + "WHERE server_addr like '" + server.OldServerAddr + "';"; SqliteCommand dbhCmd = new SqliteCommand(sql_update_server, dbh); dbhCmd.ExecuteNonQuery(); return(true); }
public bool CSQL_AddServer(CServer cserver) { string sql = "INSERT INTO servers " + "VALUES ('" + cserver.ServerAddr + "', '" + cserver.ServerPort + "', '" + cserver.ServerBaseDir + "', '" + cserver.ServerAuthRequired + "', '" + cserver.ServerUserName + "', '" + cserver.ServerPassword + "', '" + cserver.ServerFriendName + "', '" + cserver.ServerProtocol + "' );"; SqliteCommand dbhCmd; if (CSQL_Connected()) { dbhCmd = new SqliteCommand(sql, dbh); int num_recs = 0; try { num_recs = dbhCmd.ExecuteNonQuery(); } catch (Exception e) { Console.WriteLine("==> ERROR: Line 139: " + e.Message); } if (num_recs > 0) { cleanup(); return(true); } else { cleanup(); return(false); } } else { cleanup(); return(false); } }
public CFTP(CServer server, CDevice device) { _server = server; _device = device; }
public CFTP( CServer server, CDevice device ) { _server = server; _device = device; }
public bool CSQL_AddServer(CServer cserver) { string sql = "INSERT INTO servers " + "VALUES ('" + cserver.ServerAddr + "', '" + cserver.ServerPort + "', '" + cserver.ServerBaseDir + "', '" + cserver.ServerAuthRequired + "', '" + cserver.ServerUserName + "', '" + cserver.ServerPassword + "', '" + cserver.ServerFriendName + "', '" + cserver.ServerProtocol + "' );"; SqliteCommand dbhCmd; if (CSQL_Connected ()) { dbhCmd = new SqliteCommand (sql, dbh); int num_recs = 0; try { num_recs = dbhCmd.ExecuteNonQuery (); } catch (Exception e) { Console.WriteLine ("==> ERROR: Line 139: " + e.Message); } if (num_recs > 0) { cleanup (); return true; } else { cleanup (); return false; } } else { cleanup (); return false; } }
public bool CSQL_UpdateServer( CServer server ) { string sql_update_server = "UPDATE servers " + "SET server_friend_name = '" + server.ServerFriendName + "', " + "server_pword = '" + server.ServerPassword + "', " + "server_uname = '" + server.ServerUserName + "', " + "server_auth_req = " + server.ServerAuthRequired + ", " + "server_base_dir = '" + server.ServerBaseDir + "', " + "server_port = " + server.ServerPort + ", " + "server_addr = '" + server.ServerAddr + "', " + "server_protocol = '" + server.ServerProtocol + "' " + "WHERE server_addr like '" + server.OldServerAddr + "';"; SqliteCommand dbhCmd = new SqliteCommand (sql_update_server, dbh); dbhCmd.ExecuteNonQuery (); return true; }
public CServer CSQL_GetServer(string key) { string sql = "SELECT * FROM servers " + "WHERE servers.server_addr like '" + key + "'" + " OR servers.server_friend_name like '" + key + "';"; SqliteCommand dbhCmd; SqliteDataReader dbhReader; CServer cserver = null; if (CSQL_Connected ()) { dbhCmd = new SqliteCommand (sql, dbh); dbhReader = dbhCmd.ExecuteReader (); if (dbhReader.HasRows) { dbhReader.Read (); cserver = new CServer ( dbhReader.GetString ((int)tbl_servers.SERVER_ADDR), dbhReader.GetInt32 ((int)tbl_servers.SERVER_PORT), dbhReader.GetString ((int)tbl_servers.SERVER_BASE_DIR), dbhReader.GetInt32 ((int)tbl_servers.SERVER_AUTH_REQ), dbhReader.GetString ((int)tbl_servers.SERVER_UNAME), dbhReader.GetString ((int)tbl_servers.SERVER_PNAME), dbhReader.GetString ((int)tbl_servers.SERVER_FRIEND_NAME), dbhReader.GetString ((int)tbl_servers.SERVER_PROTOCOL) ); } else { cleanup (); return null; } } else { cleanup (); return null; } cleanup (); return cserver; }