public static void InitAddon(WCellAddonContext context) { var mgr = new InitMgr(); InitAddon(context, mgr); mgr.PerformInitialization(); }
public static void Initialize(InitMgr mgr) { if (RealmAddonMgr.inited) { return; } RealmAddonMgr.inited = true; WCellAddonMgr.LoadAddons(RealmServerConfiguration.BinaryRoot + RealmAddonMgr.AddonDir, RealmAddonMgr.IgnoredAddonFiles); if (WCellAddonMgr.Contexts.Count > 0) { RealmAddonMgr.log.Info("Found {0} Addon(s):", WCellAddonMgr.Contexts.Count); foreach (WCellAddonContext context in (IEnumerable <WCellAddonContext>)WCellAddonMgr.Contexts) { RealmAddonMgr.log.Info(" Loaded: " + (context.Addon != null ? context.Addon.GetDefaultDescription() : context.Assembly.GetName().Name)); RealmAddonMgr.InitAddon(context, mgr); } } else { RealmAddonMgr.log.Info("No addons found."); } }
/// <summary> /// Starts the server and performs and needed initialization. /// </summary> public virtual void Start() { if (_running) { return; } if (InitMgr.PerformInitialization()) { _tcpEndpoint = new IPEndPoint(Utility.ParseOrResolve(Host), Port); Start(true, false); if (!(_running = TcpEnabledEnabled)) { Log.Fatal(WCell_Core.InitFailed); Stop(); } else { Log.Info("Server started - Max Working Set Size: {0}", Process.GetCurrentProcess().MaxWorkingSet); UpdateTitle(); Action started = Started; if (started == null) { return; } started(); } } else { Log.Fatal(WCell_Core.InitFailed); Stop(); } }
public static void Init(InitMgr mgr) { if (!m_initialized) { DefinitionDir = new DirectoryInfo(Path.Combine(RealmServerConfiguration.ContentDir, "Packets")); var paAsm = typeof(PacketParser).Assembly; if (mgr == null) { InitMgr.Initialize(paAsm); } else { mgr.AddStepsOfAsm(paAsm); } m_packetWriters = new Dictionary <string, IndentTextWriter>(); LoadDefinitions(); m_initialized = true; DumpDir.Create(); //LoginHandler.ClientDisconnected += OnDisconnect; } }
public static void Initialize(InitMgr mgr) { if (inited) { return; } inited = true; LoadAddons(RealmServerConfiguration.BinaryRoot + AddonDir, IgnoredAddonFiles); if (Contexts.Count > 0) { log.Info("Found {0} Addon(s):", Contexts.Count); foreach (var context in Contexts) { log.Info(" Loaded: " + (context.Addon != null ? context.Addon.GetDefaultDescription() : (context.Assembly.GetName().Name))); InitAddon(context, mgr); } } else { log.Info("No addons found."); } }
public static void InitAddon(WCellAddonContext context) { InitMgr mgr = new InitMgr(); RealmAddonMgr.InitAddon(context, mgr); mgr.AddGlobalMgrsOfAsm(typeof(RealmAddonMgr).Assembly); mgr.PerformInitialization(); }
protected static void InitAddon(WCellAddonContext context, InitMgr mgr) { IWCellAddon addon = context.Addon; mgr.AddStepsOfAsm(context.Assembly); RealmCommandHandler.Instance.AddCmdsOfAsm(context.Assembly); if (addon == null || !(addon is WCellAddonBase)) { return; } ((WCellAddonBase)addon).InitAddon(context); }
public static bool Init(string toolsRoot, params Assembly[] assemblies) { ToolConfig.ToolsRoot = toolsRoot; RealmServ.EntryLocation = Path.GetFullPath(ToolConfig.WCellRealmServerConsoleExe); var realmServ = RealmServ.Instance; // make sure to create the RealmServ instance first ToolConfig.InitCfg(); LogUtil.SetupConsoleLogging(); Log.Info("Output Directory: {0}", new DirectoryInfo(ToolConfig.OutputDir).FullName); if (!Directory.Exists(ToolConfig.OutputDir)) { Directory.CreateDirectory(ToolConfig.OutputDir); } RealmServerConfiguration.Instance.AutoSave = false; RealmServerConfiguration.ContentDirName = Path.GetFullPath(ToolConfig.ContentDir); RealmServerConfiguration.Initialize(); RealmAddonMgr.AddonDir = ToolConfig.AddonDir; Log.Info("Content Directory: " + new DirectoryInfo(RealmServerConfiguration.ContentDir).FullName); if (!InitMgr.Initialize(typeof(Tools).Assembly) || !InitMgr.Initialize(typeof(PacketAnalyzer).Assembly)) { Log.Error("Cancelled - Press any key to exit..."); Console.ReadKey(); return(false); } foreach (var asm in assemblies) { if (!InitMgr.Initialize(asm)) { Log.Error("Unable to initialize Assembly: \"{0}\" - Press any key to exit...", asm); return(false); } ToolCommandHandler.Instance.AddCmdsOfAsm(asm); Mgr.AddStaticMethodsOfAsm(asm); } Mgr.AddStaticMethodsOfAsm(typeof(Tools).Assembly); return(true); }
static Program() { LogUtil.SetupConsoleLogging(); Console.WriteLine("Output Directory: " + new DirectoryInfo(Program.OutputDir).FullName); if (!Directory.Exists(Program.OutputDir)) { Directory.CreateDirectory(Program.OutputDir); } RealmServer.RealmServer.Instance.Configuration.ContentDir = ContentDir; RealmServer.RealmServer.Instance.Configuration.AddonDir = AddonDir; Console.WriteLine("Content Directory: " + new DirectoryInfo(RealmServer.RealmServer.Instance.Configuration.ContentDir).FullName); InitMgr.Initialize(typeof(Program).Assembly); ItemMgr.LoadOnStartup = false; }
protected static void InitAddon(WCellAddonContext context, InitMgr mgr) { var addon = context.Addon; // add all initialization steps of the Assembly mgr.AddStepsOfAsm(context.Assembly); // register all Commands of the Assembly AuthCommandHandler.Instance.AddCmdsOfAsm(context.Assembly); if (addon != null) { // init config if (addon is WCellAddonBase) { ((WCellAddonBase)addon).InitAddon(context); } } }
public static void Initialize(InitMgr mgr) { LoadAddons(AddonDir, IgnoredAddonFiles); if (Contexts.Count > 0) { log.Info("Found {0} Addon(s):", Contexts.Count); foreach (var context in Contexts) { log.Info(" Loaded: " + (context.Addon != null ? context.Addon.GetDefaultDescription() : (context.Assembly.GetName().Name))); InitAddon(context, mgr); } } else { log.Info("No addons found."); } }
/// <summary> /// Starts the server and performs and needed initialization. /// </summary> public virtual void Start() { if (_running) { return; } if (InitMgr.PerformInitialization()) { var address = Utility.ParseOrResolve(Host); _tcpEndpoint = new IPEndPoint(address, Port); Start(true, false); if (!(_running = TcpEnabledEnabled)) { Log.Fatal(Resources.InitFailed); Stop(); return; } Log.Info("Server started - Max Working Set Size: {0}", Process.GetCurrentProcess().MaxWorkingSet); //GC.Collect(2, GCCollectionMode.Optimized); UpdateTitle(); var evt = Started; if (evt != null) { evt(); } } else { Log.Fatal(Resources.InitFailed); Stop(); } }