public void Initialize(DalamudPluginInterface pluginInterface) { this.pluginInterface = pluginInterface; var getBaseUIObjScan = this.pluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? 41 b8 01 00 00 00 48 8d 15 ?? ?? ?? ?? 48 8b 48 20 e8 ?? ?? ?? ?? 48 8b cf"); var getUI2ObjByNameScan = this.pluginInterface.TargetModuleScanner.ScanText("e8 ?? ?? ?? ?? 48 8b cf 48 89 87 ?? ?? 00 00 e8 ?? ?? ?? ?? 41 b8 01 00 00 00"); this.getBaseUIObj = Marshal.GetDelegateForFunctionPointer <GetBaseUIObjDelegate>(getBaseUIObjScan); this.getUI2ObjByName = Marshal.GetDelegateForFunctionPointer <GetUI2ObjByNameDelegate>(getUI2ObjByNameScan); this.chatLogObject = this.getUI2ObjByName(Marshal.ReadIntPtr(getBaseUIObj(), 0x20), "ChatLog"); this.config = (PingConfiguration)this.pluginInterface.GetPluginConfig() ?? new PingConfiguration(); this.config.Initialize(this.pluginInterface); this.pingTracker = new AggregatePingTracker(this.config, new ComponentModelPingTracker(this.config), new Win32APIPingTracker(this.config)); this.pluginInterface.Framework.OnUpdateEvent += OnFrameworkUpdate; this.ui = new PingUI(this.pingTracker, this.config); this.pluginInterface.UiBuilder.OnOpenConfigUi += (sender, e) => this.ui.ConfigVisible = true; this.pluginInterface.UiBuilder.OnBuildUi += this.ui.BuildUi; AddCommandHandlers(); }
private IPingTracker GetBestTracker() { var bestPing = 0UL; IPingTracker bestTracker = null; foreach (var tracker in this.pingTrackers) { if (tracker.LastRTT >= bestPing) { bestPing = tracker.LastRTT; bestTracker = tracker; } } return(bestTracker); }
public void Initialize(DalamudPluginInterface pluginInterface) { this.pluginInterface = pluginInterface; this.config = (PingConfiguration)this.pluginInterface.GetPluginConfig() ?? new PingConfiguration(); this.config.Initialize(this.pluginInterface); this.pingTracker = new AggregatePingTracker(this.config, new ComponentModelPingTracker(this.config), new Win32APIPingTracker(this.config)); this.pluginInterface.Framework.Network.OnNetworkMessage += OnNetworkMessage; this.ui = new PingUI(this.pingTracker, this.config); this.pluginInterface.UiBuilder.OnOpenConfigUi += (sender, e) => this.ui.ConfigVisible = true; this.pluginInterface.UiBuilder.OnBuildUi += this.ui.BuildUi; AddCommandHandlers(); }
public CustomLoggerProvider(IPingTracker tracker) { _tracker = tracker; }
public CustomLogger(IPingTracker tracker) { _pingMessageTracker = tracker; }