Created
June 25, 2019 08:53
-
-
Save Qofar/b83ad0bdb88acad9b7c8dec14f4c23d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Advanced_Combat_Tracker; | |
using System.Reflection; | |
using System.Threading; | |
using System.Windows.Forms; | |
[assembly: AssemblyTitle("FFXIV_ACT_Plugin_V2_sample")] | |
[assembly: AssemblyVersion("2.0.0.0")] | |
namespace FFXIV_ACT_Plugin_V2_sample | |
{ | |
public class FFXIV_ACT_Plugin_V2_sample : IActPluginV1 | |
{ | |
private IActPluginV1 ffxivPlugin; | |
private Label statusLabel; | |
private string CurrentZone = string.Empty; | |
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) | |
{ | |
statusLabel = pluginStatusText; | |
statusLabel.Text = "Plugin started"; | |
var timer = new System.Threading.Timer(new TimerCallback((state) => | |
{ | |
foreach (ActPluginData PluginData in ActGlobals.oFormActMain.ActPlugins) | |
{ | |
if (PluginData.pluginFile.Name.Contains("FFXIV_ACT_Plugin.dll") && PluginData.lblPluginStatus.Text.Contains("FFXIV Plugin Started.")) | |
{ | |
ffxivPlugin = PluginData.pluginObj; | |
} | |
} | |
if (ffxivPlugin != null) | |
{ | |
dynamic plugin_derived = ffxivPlugin; | |
plugin_derived.DataSubscription.LogLine += new FFXIV_ACT_Plugin.Common.LogLineDelegate(XLogLine); ; | |
plugin_derived.DataSubscription.ZoneChanged += new FFXIV_ACT_Plugin.Common.ZoneChangedDelegate(XZoneChanged); | |
} | |
(state as System.Threading.Timer).Dispose(); | |
})); | |
timer.Change(5000, 0); | |
statusLabel.Text = "Plugin Inited."; | |
} | |
public void DeInitPlugin() | |
{ | |
if (ffxivPlugin != null) | |
{ | |
dynamic plugin_derived = ffxivPlugin; | |
plugin_derived.DataSubscription.LogLine -= new FFXIV_ACT_Plugin.Common.LogLineDelegate(XLogLine); ; | |
plugin_derived.DataSubscription.ZoneChanged -= new FFXIV_ACT_Plugin.Common.ZoneChangedDelegate(XZoneChanged); | |
} | |
statusLabel.Text = "Plugin exited"; | |
} | |
private void XZoneChanged(uint ZoneID, string ZoneName) | |
{ | |
ActGlobals.oFormActMain.WriteInfoLog("ZoneChanged<>" + ZoneID + "<>" + ZoneName); | |
} | |
private void XLogLine(uint EventType, uint Seconds, string logline) | |
{ | |
ActGlobals.oFormActMain.WriteInfoLog("LogLine<>" + EventType + "<>" + Seconds + "<>" + logline); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment