public static void Initialize() { if (Initialized) return; if (!Debugger.IsAttached) // the debugger handle the unhandled exceptions AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; AppDomain.CurrentDomain.ProcessExit += OnProcessExit; Config = new Config(ConfigPath); foreach (var assembly in m_hierarchy) { Config.BindAssembly(assembly); Config.RegisterAttributes(assembly); } Config.Load(); logger.Info("{0} loaded", Path.GetFileName(Config.FilePath)); var d2oSource = new D2OSource(); d2oSource.AddReaders(DofusDataPath); DataProvider.Instance.AddSource(d2oSource); var maps = new D2PSource(new D2pFile(DofusMapsD2P)); DataProvider.Instance.AddSource(maps); // todo : langs var d2iSource = new D2ISource(Languages.English); d2iSource.AddReaders(DofusI18NPath); DataProvider.Instance.AddSource(d2iSource); MITM = new MITM.MITM(new MITMConfiguration { FakeAuthHost = BotAuthHost, FakeAuthPort = BotAuthPort, FakeWorldHost = BotWorldHost, FakeWorldPort = BotWorldPort, RealAuthHost = RealAuthHost, RealAuthPort = RealAuthPort }); MessageDispatcher.DefineHierarchy(m_hierarchy); foreach (var assembly in m_hierarchy) { MessageDispatcher.RegisterSharedAssembly(assembly); } PluginManager.Instance.LoadAllPlugins(); DispatcherTask = new DispatcherTask(new MessageDispatcher(), MITM); DispatcherTask.Start(); // we have to start it now to dispatch the initialization msg var msg = new HostInitializationMessage(); DispatcherTask.Dispatcher.Enqueue(msg, MITM); msg.Wait(); Initialized = true; }
public static void Initialize() { if (Initialized) { return; } if (!Debugger.IsAttached) // the debugger handle the unhandled exceptions { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; } AppDomain.CurrentDomain.ProcessExit += OnProcessExit; Config = new Config(ConfigPath); foreach (var assembly in m_hierarchy) { Config.BindAssembly(assembly); Config.RegisterAttributes(assembly); } Config.Load(); logger.Info("{0} loaded", Path.GetFileName(Config.FilePath)); var d2oSource = new D2OSource(); d2oSource.AddReaders(DofusDataPath); DataProvider.Instance.AddSource(d2oSource); var maps = new D2PSource(new D2pFile(DofusMapsD2P)); DataProvider.Instance.AddSource(maps); // todo : langs var d2iSource = new D2ISource(Languages.English); d2iSource.AddReaders(DofusI18NPath); DataProvider.Instance.AddSource(d2iSource); MITM = new MITM.MITM(new MITMConfiguration { FakeAuthHost = BotAuthHost, FakeAuthPort = BotAuthPort, FakeWorldHost = BotWorldHost, FakeWorldPort = BotWorldPort, RealAuthHost = RealAuthHost, RealAuthPort = RealAuthPort }); MessageDispatcher.DefineHierarchy(m_hierarchy); foreach (var assembly in m_hierarchy) { MessageDispatcher.RegisterSharedAssembly(assembly); } PluginManager.Instance.LoadAllPlugins(); DispatcherTask = new DispatcherTask(new MessageDispatcher(), MITM); DispatcherTask.Start(); // we have to start it now to dispatch the initialization msg var msg = new HostInitializationMessage(); DispatcherTask.Dispatcher.Enqueue(msg, MITM); msg.Wait(); Initialized = true; }
private static void Initialize() { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; AppDomain.CurrentDomain.ProcessExit += OnProcessExit; Config = new Config(ConfigPath); Config.Load(); foreach (var assembly in m_hierarchy) { Config.BindAssembly(assembly); } var d2oSource = new D2OSource(); d2oSource.AddReaders(Config.GetStatic("DofusDataPath", @"C:\Program Files (x86)\Dofus 2\app\data\common")); DataProvider.Instance.AddSource(d2oSource); var maps = new D2PSource(new D2pFile(Config.GetStatic("DofusMapsD2P", @"C:\Program Files (x86)\Dofus 2\app\content\maps\maps0.d2p"))); DataProvider.Instance.AddSource(maps); var d2iSource = new D2ISource(Languages.English); d2iSource.AddReaders(Config.GetStatic("DofusI18NPath", @"C:\Program Files (x86)\Dofus 2\app\data\i18n")); DataProvider.Instance.AddSource(d2iSource); MITM = new MITM.MITM(new MITMConfiguration { FakeAuthHost = Config.GetStatic("BotAuthHost", "localhost"), FakeAuthPort = Config.GetStatic("BotAuthPort", 5555), FakeWorldHost = Config.GetStatic("BotWorldHost", "localhost"), FakeWorldPort = Config.GetStatic("BotWorldPort", 5556), RealAuthHost = Config.GetStatic("RealAuthHost", "213.248.126.180"), RealAuthPort = Config.GetStatic("RealAuthPort", 5555) }); MessageDispatcher.DefineHierarchy(m_hierarchy); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { MessageDispatcher.RegisterAssembly(assembly); } PluginManager.Instance.LoadAllPlugins(); DispatcherTask = new DispatcherTask(new MessageDispatcher(), MITM); DispatcherTask.Start(); // we have to start it now to dispatch the initialization msg var msg = new HostInitializationMessage(); DispatcherTask.Dispatcher.Enqueue(msg, MITM); msg.Wait(); }