public DatabaseClient(uint mHandle, DatabaseManager pManager) { if (pManager == null) throw new ArgumentNullException("pManager"); Handle = mHandle; Manager = pManager; Connection = new MySqlConnection(Manager.CreateConnectionString()); Command = Connection.CreateCommand(); UpdateLastActivity(); }
public static bool Load() { Zepheus.InterLib.Settings.Initialize(); Settings.Load(); DatabaseManager = new DatabaseManager(Settings.Instance.LoginMysqlServer, (uint)Settings.Instance.LoginMysqlPort, Settings.Instance.LoginMysqlUser, Settings.Instance.LoginMysqlPassword, Settings.Instance.LoginMysqlDatabase, Settings.Instance.LoginDBMinPoolSize, Settings.Instance.LoginDBMaxPoolSize,Settings.Instance.QuerCachePerClient,Settings.Instance.OverloadFlags); DatabaseManager.GetClient(); //testclient Log.SetLogToFile(string.Format(@"Logs\Login\{0}.log", DateTime.Now.ToString("d_M_yyyy HH_mm_ss"))); if (Reflector.GetInitializerMethods().Any(method => !method.Invoke())) { Log.WriteLine(LogLevel.Error, "Server could not be started. Errors occured."); return false; } else return true; }
public static bool Load() { InterLib.Settings.Initialize(); Settings.Load(); DatabaseManager = new DatabaseManager(Settings.Instance.WorldMysqlServer, (uint)Settings.Instance.WorldMysqlPort, Settings.Instance.WorldMysqlUser, Settings.Instance.WorldMysqlPassword, Settings.Instance.WorldMysqlDatabase, Settings.Instance.WorldDBMinPoolSize, Settings.Instance.WorldDBMaxPoolSize, Settings.Instance.QuerCachePerClient,Settings.Instance.OverloadFlags); //DatabaseManager.GetClient(); //testclient Log.SetLogToFile(string.Format(@"Logs\World\{0}.log", DateTime.Now.ToString("d_M_yyyy HH_mm_ss"))); try { if (Reflector.GetInitializerMethods().Any(method => !method.Invoke())) { Log.WriteLine(LogLevel.Error, "Server could not be started. Errors occured."); return false; } else return true; } catch (Exception ex) { Log.WriteLine(LogLevel.Exception, "Fatal exception while load: {0}:{1}", ex.ToString(), ex.StackTrace); return false; } }
private static bool Load() { Zepheus.InterLib.Settings.Initialize(); Settings.Load(); DatabaseManager = new DatabaseManager(Settings.Instance.zoneMysqlServer, (uint)Settings.Instance.zoneMysqlPort, Settings.Instance.zoneMysqlUser, Settings.Instance.zoneMysqlPassword, Settings.Instance.zoneMysqlDatabase, Settings.Instance.ZoneDBMinPoolSize, Settings.Instance.ZoneDBMaxPoolSize,10,1); DatabaseManager.GetClient(); //testclient CharDBManager = new DatabaseManager(Settings.Instance.WorldMysqlServer, (uint)Settings.Instance.WorldMysqlPort, Settings.Instance.WorldMysqlUser, Settings.Instance.WorldMysqlPassword, Settings.Instance.WorldMysqlDatabase, Settings.Instance.WorldDBMinPoolSizeZoneWorld, Settings.Instance.WorldDBMaxPoolSizeZoneWorld,Settings.Instance.QuerCachePerClientZoneWorld,Settings.Instance.OverloadFlagsZoneWorld); CharDBManager.GetClient(); Log.SetLogToFile(string.Format(@"Logs\Zone\{0}.log", DateTime.Now.ToString("yyyy-MM-dd HHmmss"))); Randomizer = new Random(); Log.IsDebug = Settings.Instance.Debug; try { if (Reflector.GetInitializerMethods().Any(method => !method.Invoke())) { Log.WriteLine(LogLevel.Error, "Server could not be started. Errors occured."); return false; } else return true; } catch (Exception ex) { Log.WriteLine(LogLevel.Exception, "Error loading Initializer methods: {0}", ex.ToString()); return false; } }
public void Destroy() { Disconnect(); Connection.Dispose(); Connection = null; Command.Dispose(); Command = null; Manager = null; }