public NewOverlayDialog(PluginMain pluginMain) { InitializeComponent(); this.pluginMain = pluginMain; // Default validator this.NameValidator = (name) => { return(name != null); }; foreach (var overlayType in Registry.Overlays) { var name = overlayType.Name; if (name.EndsWith("Overlay")) { name = name.Substring(0, name.Length - 7); } comboBox1.Items.Add(new KeyValuePair <string, Type>(name, overlayType)); } comboBox1.DisplayMember = "Key"; comboBox1.SelectedIndex = 0; textBox1.Focus(); }
public ControlPanel(PluginMain pluginMain, PluginConfig config) { InitializeComponent(); this.pluginMain = pluginMain; this.config = config; SetupMiniParseConfigHandlers(); SetupSpellTimerConfigHandlers(); SetupMiniParseTab(); SetupSpellTimerTab(); this.menuFollowLatestLog.Checked = this.config.FollowLatestLog; this.listViewLog.VirtualListSize = pluginMain.Logs.Count; this.pluginMain.Logs.ListChanged += (o, e) => { this.listViewLog.BeginUpdate(); this.listViewLog.VirtualListSize = pluginMain.Logs.Count; if (this.config.FollowLatestLog && this.pluginMain.Logs.Count > 0) { this.listViewLog.EnsureVisible(this.pluginMain.Logs.Count - 1); } this.listViewLog.EndUpdate(); }; }
public ControlPanel(PluginMain pluginMain, PluginConfig config) { InitializeComponent(); this.pluginMain = pluginMain; this.config = config; this.checkBoxAutoHide.Checked = this.config.HideOverlaysWhenNotActive; this.menuFollowLatestLog.Checked = this.config.FollowLatestLog; this.listViewLog.VirtualListSize = pluginMain.Logger.Logs.Count; this.pluginMain.Logger.Logs.ListChanged += (o, e) => { this.listViewLog.BeginUpdate(); this.listViewLog.VirtualListSize = pluginMain.Logger.Logs.Count; if (this.config.FollowLatestLog && this.listViewLog.VirtualListSize > 0) { this.listViewLog.EnsureVisible(this.listViewLog.VirtualListSize - 1); } this.listViewLog.EndUpdate(); }; InitializeOverlayConfigTabs(); UpdateOverlayListView(); }
private void Initialize(TabPage pluginScreenSpace, Label pluginStatusText) { pluginStatusText.Text = "Initializing Runtime..."; Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, "AssemblyResolver: Error: {0}", e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, "AssemblyResolver: Loaded: {0}", e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); if (ActGlobals.oFormActMain.Visible) { // ACT is running and this plugin was added. Immediately initialize! InitPluginCore(pluginScreenSpace, pluginStatusText); } else { // ACT is starting up and loading plugins. Wait until it's done and the main window becomes visible before we start initializing. EventHandler initHandler = null; initHandler = (o, e) => { ActGlobals.oFormActMain.VisibleChanged -= initHandler; InitPluginCore(pluginScreenSpace, pluginStatusText); }; ActGlobals.oFormActMain.VisibleChanged += initHandler; pluginStatusText.Text = "Waiting for ACT to finish startup..."; } }
private async void Initialize() { pluginStatusText.Text = Resources.InitRuntime; var container = new TinyIoCContainer(); logger = new Logger(); container.Register(logger); container.Register <ILogger>(logger); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, Resources.AssemblyResolverError, e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, Resources.AssemblyResolverLoaded, e.LoadedAssembly.FullName); this.Container = container; pluginMain = new PluginMain(pluginDirectory, logger, container); container.Register(pluginMain); pluginStatusText.Text = Resources.InitCef; SanityChecker.CheckDependencyVersions(logger); try { CurlWrapper.Init(pluginDirectory); } catch (Exception ex) { logger.Log(LogLevel.Error, ex.ToString()); ActGlobals.oFormActMain.WriteDebugLog(ex.ToString()); } await FinishInit(container); }
public ControlPanel(PluginMain pluginMain, PluginConfig config) { InitializeComponent(); this.pluginMain = pluginMain; this.config = config; this.checkBoxAutoHide.Checked = this.config.HideOverlaysWhenNotActive; this.menuFollowLatestLog.Checked = this.config.FollowLatestLog; this.listViewLog.VirtualListSize = pluginMain.Logger.Logs.Count; this.pluginMain.Logger.Logs.ListChanged += (o, e) => { this.listViewLog.BeginUpdate(); this.listViewLog.VirtualListSize = pluginMain.Logger.Logs.Count; if (this.config.FollowLatestLog && this.listViewLog.VirtualListSize > 0) { this.listViewLog.EnsureVisible(this.listViewLog.VirtualListSize - 1); } this.listViewLog.EndUpdate(); }; InitializeOverlayConfigTabs(); screenShotPath.Text = config.ScreenShotSavePath; screenShotBackgroundPath.Text = config.ScreenShotBackgroundPath; screenShotBackgroundMode.SelectedIndex = config.ScreenShotBackgroundMode; screenShotAutoClipping.Checked = config.ScreenShotAutoClipping; screenShotMargin.Value = config.ScreenShotMargin; if (string.IsNullOrWhiteSpace(screenShotPath.Text)) { screenShotPath.Text = PluginMain.DefaultScreenShotPath; } }
private void Initialize(TabPage pluginScreenSpace, Label pluginStatusText) { asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, "AssemblyResolver: Error: {0}", e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, "AssemblyResolver: Loaded: {0}", e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); pluginMain.InitPlugin(pluginScreenSpace, pluginStatusText); }
public ControlPanel(TinyIoCContainer container) { InitializeComponent(); tableLayoutPanel0.PerformLayout(); splitContainer1.SplitterDistance = (int)Math.Round(Height * 0.75); _container = container; _logger = container.Resolve <ILogger>(); _pluginMain = container.Resolve <PluginMain>(); _config = container.Resolve <IPluginConfig>(); _registry = container.Resolve <Registry>(); this.checkBoxFollowLog.Checked = _config.FollowLatestLog; _generalTab = new ConfigTabPage { Name = Resources.GeneralTab, Text = "", }; _generalTab.Controls.Add(new GeneralConfigTab(container)); _eventTab = new ConfigTabPage { Name = Resources.EventConfigTab, Text = "", }; _eventTab.Controls.Add(new EventSources.BuiltinEventConfigPanel(container)); _logger.RegisterListener(AddLogEntry); _registry.EventSourceRegistered += (o, e) => Invoke((Action)(() => AddEventSourceTab(o, e))); }
public TriggIntegration(TinyIoCContainer container) { var logger = container.Resolve <ILogger>(); _plugin = container.Resolve <PluginMain>(); try { var trigg = ActGlobals.oFormActMain.ActPlugins.FirstOrDefault(x => x.lblPluginTitle.Text == "Triggernometry.dll"); if (trigg == null || trigg.pluginObj == null) { return; } var triggType = trigg.pluginObj.GetType(); var deleType = triggType.GetNestedType("CustomCallbackDelegate"); if (deleType == null) { return; } var dele = Delegate.CreateDelegate(deleType, this, typeof(TriggIntegration).GetMethod("SendOverlayMessage")); triggType.GetMethod("RegisterNamedCallback")?.Invoke(trigg.pluginObj, new object[] { "OverlayPluginMessage", dele, null }); } catch (Exception ex) { logger.Log(LogLevel.Error, $"Failed to register Triggernometry callback: {ex}"); } }
private void Initialize(TabPage pluginScreenSpace, Label pluginStatusText) { // Prevent a stack overflow in the assembly loaded handler by loading the logger interface early. var dummy = typeof(ILogger); Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, "AssemblyResolver: Error: {0}", e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, "AssemblyResolver: Loaded: {0}", e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); if (ActGlobals.oFormActMain.Visible) { // ACT is running and this plugin was added. Immediately initialize! pluginMain.InitPlugin(pluginScreenSpace, pluginStatusText); } else { // ACT is starting up and loading plugins. Wait until it's done and the main window becomes visible before we start initializing. EventHandler initHandler = null; initHandler = (o, e) => { ActGlobals.oFormActMain.VisibleChanged -= initHandler; pluginMain.InitPlugin(pluginScreenSpace, pluginStatusText); }; ActGlobals.oFormActMain.VisibleChanged += initHandler; } }
public OverlayHider(TinyIoCContainer container) { this.config = container.Resolve <IPluginConfig>(); this.logger = container.Resolve <ILogger>(); this.main = container.Resolve <PluginMain>(); this.repository = container.Resolve <FFXIVRepository>(); container.Resolve <NativeMethods>().ActiveWindowChanged += ActiveWindowChangedHandler; container.Resolve <NetworkParser>().OnOnlineStatusChanged += OnlineStatusChanged; container.Resolve <EventSources.EnmityEventSource>().CombatStatusChanged += CombatStatusChanged; try { repository.RegisterProcessChangedHandler(UpdateFFXIVProcess); } catch (Exception ex) { logger.Log(LogLevel.Error, "Failed to register process watcher for FFXIV; this is only an issue if you're playing FFXIV. As a consequence, OverlayPlugin won't be able to hide overlays if you're not in-game."); logger.Log(LogLevel.Error, "Details: " + ex.ToString()); } focusTimer = new Timer(); focusTimer.Tick += (o, e) => ActiveWindowChangedHandler(this, IntPtr.Zero); focusTimer.Interval = 10000; // 10 seconds focusTimer.Start(); }
public WSServer(TinyIoCContainer container) { _container = container; _logger = container.Resolve <ILogger>(); _cfg = container.Resolve <IPluginConfig>(); _plugin = container.Resolve <PluginMain>(); }
public NewOverlayDialog(PluginMain pluginMain) { InitializeComponent(); this.pluginMain = pluginMain; // Default validator NameValidator = (name) => { return(name != null); }; foreach (var overlayType in Registry.Overlays) { var name = overlayType.Name; if (name.EndsWith("Overlay")) { name = name.Substring(0, name.Length - 7); } if (overlayNames.ContainsKey(name)) { name = overlayNames[name]; } cbType.Items.Add(new KeyValuePair <string, Type>(name, overlayType)); } cbType.DisplayMember = "Key"; cbType.SelectedIndex = 0; presets = PreparePresetCombo(cbPreset); lblType.Visible = false; cbType.Visible = false; lblTypeDesc.Visible = false; textBox1.Focus(); }
public WSConfigPanel(TinyIoCContainer container) { InitializeComponent(); _config = container.Resolve <IPluginConfig>(); _server = container.Resolve <WSServer>(); _plugin = container.Resolve <PluginMain>(); _registry = container.Resolve <Registry>(); ipTxt.Text = _config.WSServerIP; portTxt.Text = "" + _config.WSServerPort; sslBox.Checked = _config.WSServerSSL; sslBox.Enabled = _server.IsSSLPossible(); for (var i = 0; i < regionCb.Items.Count; i++) { if ((string)regionCb.Items[i] == _config.TunnelRegion) { regionCb.SelectedIndex = i; break; } } UpdateStatus(null, new WSServer.StateChangedArgs(_server.IsRunning(), _server.IsFailed())); _server.OnStateChanged += UpdateStatus; UpdateTunnelStatus(TunnelStatus.Inactive); lblUrlConfidentWarning.Visible = false; }
public ControlPanel(PluginMain pluginMain, PluginConfig config) { InitializeComponent(); tableLayoutPanel0.PerformLayout(); splitContainer1.SplitterDistance = splitContainer1.Height - 180; this.pluginMain = pluginMain; this.config = config; this.checkBoxFollowLog.Checked = this.config.FollowLatestLog; generalTab = new ConfigTabPage { Name = Resources.GeneralTab, Text = "", }; generalTab.Controls.Add(new GeneralConfigTab()); eventTab = new ConfigTabPage { Name = Resources.EventConfigTab, Text = "", }; eventTab.Controls.Add(new EventSources.BuiltinEventConfigPanel()); PluginMain.Logger.RegisterListener(AddLogEntry); Registry.EventSourceRegistered += (o, e) => Invoke((Action)(() => AddEventSourceTab(o, e))); }
public static void Init() { main = Registry.Resolve <PluginMain>(); logger = Registry.Resolve <ILogger>(); var span = TimeSpan.FromSeconds(3); timer = new Timer(EnsureOverlaysAreOverGame, null, span, span); }
public static void Init() { config = Registry.Resolve <IPluginConfig>(); logger = Registry.Resolve <ILogger>(); main = Registry.Resolve <PluginMain>(); NativeMethods.ActiveWindowChanged += ActiveWindowChangedHandler; NetworkParser.OnOnlineStatusChanged += OnlineStatusChanged; }
public OverlayHider(TinyIoCContainer container) { this.config = container.Resolve <IPluginConfig>(); this.logger = container.Resolve <ILogger>(); this.main = container.Resolve <PluginMain>(); this.repository = container.Resolve <FFXIVRepository>(); container.Resolve <NativeMethods>().ActiveWindowChanged += ActiveWindowChangedHandler; container.Resolve <NetworkParser>().OnOnlineStatusChanged += OnlineStatusChanged; }
public OverlayZCorrector(TinyIoCContainer container) { main = container.Resolve <PluginMain>(); logger = container.Resolve <ILogger>(); repository = container.Resolve <FFXIVRepository>(); var span = TimeSpan.FromSeconds(3); timer = new Timer(EnsureOverlaysAreOverGame, null, span, span); }
public ControlPanel(PluginMain pluginMain, PluginConfig config) { InitializeComponent(); tableLayoutPanel0.PerformLayout(); this.pluginMain = pluginMain; this.config = config; this.checkBoxAutoHide.Checked = this.config.HideOverlaysWhenNotActive; this.checkBoxFollowLog.Checked = this.config.FollowLatestLog; PluginMain.Logger.RegisterListener(addLogEntry); Registry.AddonRegistered += InitializeOverlayConfigTabs; InitializeOverlayConfigTabs(null, null); }
public NewOverlayDialog(PluginMain pluginMain) { InitializeComponent(); this.pluginMain = pluginMain; this.NameValidator = (name) => { return(name != null); }; foreach (var addon in pluginMain.Addons) { comboBox1.Items.Add(addon); } comboBox1.DisplayMember = "Name"; comboBox1.SelectedIndex = 0; }
public OverlayHider(TinyIoCContainer container) { this.config = container.Resolve <IPluginConfig>(); this.logger = container.Resolve <ILogger>(); this.main = container.Resolve <PluginMain>(); this.repository = container.Resolve <FFXIVRepository>(); container.Resolve <NativeMethods>().ActiveWindowChanged += ActiveWindowChangedHandler; container.Resolve <NetworkParser>().OnOnlineStatusChanged += OnlineStatusChanged; repository.RegisterProcessChangedHandler(UpdateFFXIVProcess); focusTimer = new Timer(); focusTimer.Tick += (o, e) => ActiveWindowChangedHandler(this, IntPtr.Zero); focusTimer.Interval = 10000; // 10 seconds focusTimer.Start(); }
public NewOverlayDialog(TinyIoCContainer container) { InitializeComponent(); pluginMain = container.Resolve <PluginMain>(); registry = container.Resolve <Registry>(); logger = container.Resolve <ILogger>(); this.container = container; // Default validator NameValidator = (name) => { return(name != null); }; foreach (var overlayType in registry.Overlays) { var name = overlayType.Name; if (name.EndsWith("Overlay")) { name = name.Substring(0, name.Length - 7); } if (overlayNames.ContainsKey(name)) { name = overlayNames[name]; } cbType.Items.Add(new KeyValuePair <string, Type>(name, overlayType)); } cbType.DisplayMember = "Key"; // Workaround for the special case where no overlay type has been registered. // That still indicates a bug but showing an empty combo box is better than crashing. if (cbType.Items.Count > 0) { cbType.SelectedIndex = 0; } presets = PreparePresetCombo(cbPreset); lblType.Visible = false; cbType.Visible = false; lblTypeDesc.Visible = false; textBox1.Focus(); }
public ControlPanel(TinyIoCContainer container) { InitializeComponent(); tableLayoutPanel0.PerformLayout(); // Make the log box big until we load the overlays since the log is going to be *very* // important if we never make it that far. splitContainer1.SplitterDistance = 5; _container = container; _logger = container.Resolve <ILogger>(); _pluginMain = container.Resolve <PluginMain>(); _config = container.Resolve <IPluginConfig>(); _registry = container.Resolve <Registry>(); this.checkBoxFollowLog.Checked = _config.FollowLatestLog; _generalTab = new ConfigTabPage { Name = Resources.GeneralTab, Text = "", }; _generalTab.Controls.Add(new GeneralConfigTab(container)); _eventTab = new ConfigTabPage { Name = Resources.EventConfigTab, Text = "", }; _eventTab.Controls.Add(new EventSources.BuiltinEventConfigPanel(container)); _logger.RegisterListener(AddLogEntry); _registry.EventSourceRegistered += (o, e) => Invoke((Action)(() => AddEventSourceTab(o, e))); Resize += (o, e) => { if (!logResized && Height > 500 && tabControl.TabCount > 0) { logResized = true; // Overlay tabs have been initialised, everything is fine; make the log small again. splitContainer1.SplitterDistance = (int)Math.Round(Height * 0.75); } }; }
public ControlPanel(PluginMain pluginMain, PluginConfig config) { InitializeComponent(); tableLayoutPanel0.PerformLayout(); splitContainer1.SplitterDistance = splitContainer1.Height - 180; this.pluginMain = pluginMain; this.config = config; this.checkBoxFollowLog.Checked = this.config.FollowLatestLog; generalTab = new TabPage { Name = "General", Text = "", }; generalTab.Controls.Add(new GeneralConfigTab()); PluginMain.Logger.RegisterListener(addLogEntry); Registry.AddonRegistered += InitializeOverlayConfigTabs; InitializeOverlayConfigTabs(null, null); }
private async void Initialize() { pluginStatusText.Text = Resources.InitRuntime; Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, Resources.AssemblyResolverError, e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, Resources.AssemblyResolverLoaded, e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); pluginStatusText.Text = Resources.InitCef; try { CurlWrapper.Init(pluginDirectory); } catch (Exception ex) { logger.Log(LogLevel.Error, ex.ToString()); } await FinishInit(); }
private async void Initialize(TabPage pluginScreenSpace, Label pluginStatusText) { pluginStatusText.Text = Resources.InitRuntime; Registry.Init(); logger = new Logger(); asmResolver.ExceptionOccured += (o, e) => logger.Log(LogLevel.Error, Resources.AssemblyResolverError, e.Exception); asmResolver.AssemblyLoaded += (o, e) => logger.Log(LogLevel.Debug, Resources.AssemblyResolverLoaded, e.LoadedAssembly.FullName); pluginMain = new PluginMain(pluginDirectory, logger); pluginStatusText.Text = Resources.InitCef; try { CurlWrapper.Init(pluginDirectory); } catch (Exception ex) { logger.Log(LogLevel.Error, ex.ToString()); } if (await CefInstaller.EnsureCef(GetCefPath())) { // Finally, load the html renderer. We load it here since HtmlRenderer depends on CEF which we can't load these before // the CefInstaller is done. if (SanityChecker.LoadSaneAssembly("HtmlRenderer")) { // Since this is an async method, we could have switched threds. Make sure InitPlugin() runs on the ACT main thread. ActGlobals.oFormActMain.Invoke((Action)(() => { pluginMain.InitPlugin(pluginScreenSpace, pluginStatusText); })); } else { pluginStatusText.Text = Resources.CoreOrHtmlRendererInsane; } } }
public TriggIntegration(TinyIoCContainer container) { var logger = container.Resolve <ILogger>(); _plugin = container.Resolve <PluginMain>(); try { var trigg = GetPluginData(); if (trigg == null || trigg.pluginObj == null) { return; } var triggType = trigg.pluginObj.GetType(); var deleType = triggType.GetNestedType("CustomCallbackDelegate"); if (deleType == null) { return; } var registerType = triggType.GetMethod("RegisterNamedCallback"); var sendDele = Delegate.CreateDelegate(deleType, this, typeof(TriggIntegration).GetMethod("SendOverlayMessage")); registerType?.Invoke(trigg.pluginObj, new object[] { "OverlayPluginMessage", sendDele, null }); var hideDele = Delegate.CreateDelegate(deleType, this, typeof(TriggIntegration).GetMethod("HideOverlay")); registerType?.Invoke(trigg.pluginObj, new object[] { "HideOverlay", hideDele, null }); var showDele = Delegate.CreateDelegate(deleType, this, typeof(TriggIntegration).GetMethod("ShowOverlay")); registerType?.Invoke(trigg.pluginObj, new object[] { "ShowOverlay", showDele, null }); } catch (Exception ex) { logger.Log(LogLevel.Error, $"Failed to register Triggernometry callback: {ex}"); } }
public NewOverlayDialog(PluginMain pluginMain) { InitializeComponent(); this.pluginMain = pluginMain; // Default validator NameValidator = (name) => { return(name != null); }; foreach (var overlayType in Registry.Overlays) { var name = overlayType.Name; if (name.EndsWith("Overlay")) { name = name.Substring(0, name.Length - 7); } if (overlayNames.ContainsKey(name)) { name = overlayNames[name]; } cbType.Items.Add(new KeyValuePair <string, Type>(name, overlayType)); } cbType.DisplayMember = "Key"; cbType.SelectedIndex = 0; #if DEBUG var presetFile = Path.Combine(PluginMain.PluginDirectory, "libs", "resources", "presets.json"); #else var presetFile = Path.Combine(PluginMain.PluginDirectory, "resources", "presets.json"); #endif var presetData = "{}"; try { presetData = File.ReadAllText(presetFile); } catch (Exception ex) { Registry.Resolve <ILogger>().Log(LogLevel.Error, string.Format(Resources.ErrorCouldNotLoadPresets, ex)); } presets = JsonConvert.DeserializeObject <Dictionary <string, OverlayPreset> >(presetData); foreach (var pair in presets) { pair.Value.Name = pair.Key; cbPreset.Items.Add(pair.Value); } foreach (var item in Registry.OverlayPresets) { cbPreset.Items.Add(item); } cbPreset.Items.Add(new OverlayPreset { Name = Resources.CustomPresetLabel, Url = "special:custom", }); cbPreset.DisplayMember = "Name"; lblType.Visible = false; cbType.Visible = false; lblTypeDesc.Visible = false; textBox1.Focus(); }