public static bool StartWorldDatabase() { wcfg = new WorldConfig(); foreach (WorldConfig.World world in wcfg.Worlds.Values) { if (!LoginServer.charServerList.ContainsKey(world.ID)) { ActorDB newCharDB = null;; switch (world.ifSQL) { case 0: newCharDB = new db4oCharacterDB(world.DBHost, world.DBPort, world.DBUser, world.DBPass); break; case 1: newCharDB = new MySQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass); break; case 2: newCharDB = new DatCharacterDB(world.Name, world.DBHost); break; case 3: newCharDB = new MSSQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass); break; } try { newCharDB.Connect(); } catch (Exception ex) { switch (world.ifSQL) { case 0: Console.WriteLine("Error: No se puede conectar a la base de datos " + world.DBHost + ":" + world.DBPort + " con el username: "******" y pass: "******"Error: No se puede conectar a la base de datos " + world.DBHost + ":" + world.DBPort + " con el username: "******" y pass: "******"ERROR, no se puede anadir el mundo: " + world.Name + " con la ID: " + world.ID + " razon: ya hay una ID igual"); return(false); } } return(true); }
public static bool StartWorldDatabase() { wcfg = new WorldConfig(); foreach (WorldConfig.World world in wcfg.Worlds.Values) { if (!LoginServer.charServerList.ContainsKey(world.ID)) { ActorDB newCharDB = null;; switch (world.ifSQL) { case 0: newCharDB = new db4oCharacterDB(world.DBHost, world.DBPort, world.DBUser, world.DBPass); break; case 1: newCharDB = new MySQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass); break; case 2: newCharDB = new DatCharacterDB(world.Name, world.DBHost); break; case 3: newCharDB = new MSSQLCharacterDB(world.DBHost, world.DBPort, world.DBName, world.DBUser, world.DBPass); break; } try { newCharDB.Connect(); } catch (Exception ex) { switch (world.ifSQL) { case 0: Console.WriteLine("Error: Cannot connect to world db server " + world.DBHost + ":" + world.DBPort + " with username: "******" and pass: "******"Error: Cannot connect to world db server " + world.DBHost + ":" + world.DBPort + " with username: "******" and pass: "******"ERROR, cannot add world: " + world.Name + " with ID: " + world.ID + " reason: worldID is already taken"); return(false); } } return(true); }