public SQLite(string file) { if (!Initialize(file)) { Log.Error("SQLite", sLConsole.GetString("Error was handled when tried to connect to the database!")); SchumixBase.ServerDisconnect(false); Thread.Sleep(1000); sRuntime.Exit(); } else { Log.Notice("SQLite", sLConsole.GetString("Successfully connected to the SQLite database.")); } }
public MySql(string host, int port, string username, string password, string database, string charset) { if (!Initialize(host, port, username, password, database, charset)) { Log.Error("MySql", sLConsole.GetString("Error was handled when tried to connect to the database!")); SchumixBase.ServerDisconnect(false); Thread.Sleep(1000); sRuntime.Exit(); } else { Log.Success("MySql", sLConsole.GetString("Successfully connected to the MySql database.")); } }
public DatabaseManager() { byte x = 0; Log.Debug("DatabaseManager", sLConsole.GetString("Started the database loading.")); if (SQLiteConfig.Enabled) { x++; sdatabase = new SQLite(SQLiteConfig.FileName); } if (MySqlConfig.Enabled) { x++; mdatabase = new MySql(MySqlConfig.Host, MySqlConfig.Port, MySqlConfig.User, MySqlConfig.Password, MySqlConfig.Database, MySqlConfig.Charset); } Log.Debug("DatabaseManager", sLConsole.GetString("Selecting the Database.")); if (x == 0) { Log.LargeError(sLConsole.GetString("MAJOR ERROR")); Log.Error("DatabaseManager", sLConsole.GetString("Database type's is not selected!")); SchumixBase.ServerDisconnect(false); Thread.Sleep(1000); Environment.Exit(1); } else if (x == 2) { Log.LargeError(sLConsole.GetString("MAJOR ERROR")); Log.Error("DatabaseManager", sLConsole.GetString("2 Database are selected!")); SchumixBase.ServerDisconnect(false); Thread.Sleep(1000); Environment.Exit(1); } }