This repository was archived by the owner on Jan 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMainClass.cs
More file actions
123 lines (99 loc) · 4.83 KB
/
MainClass.cs
File metadata and controls
123 lines (99 loc) · 4.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Linq;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Lumina;
using Lumina.Excel.GeneratedSheets;
using Nhaama;
using Nhaama.Memory;
using Advanced_Combat_Tracker;
using FFXIV_ACT_Plugin;
using FFXIV_ACT_Plugin.Common;
using FFXIV_ACT_Plugin.Logfile;
using FFXIV_ACT_Plugin.Common.Models;
using System.Text.RegularExpressions;
using Machina.FFXIV.Headers;
namespace MoreLogLine
{
public class MainClass : UserControl, IActPluginV1
{
public static Lumina.Lumina lumina = null;
private static FFXIV_ACT_Plugin.FFXIV_ACT_Plugin ffxivPlugin;
private static MoreLogLineUI PluginUI;
private static Process FFXIV;
//private static Craft CraftInfo;
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) {
pluginScreenSpace.Text = "MoreLogLine";
PluginUI = new MoreLogLineUI();
//CraftInfo = new Craft();
PluginUI.InitializeComponent(pluginScreenSpace);
ActGlobals.oFormActMain.OnLogLineRead += new LogLineEventDelegate(this.MoreLogLines_OnLogLineRead);
LogLineHandle.GetOnLogReadList();
GetFfxivPlugin();
Task.Run(() => {
while (FFXIV == null) {
FFXIV = ffxivPlugin.DataRepository.GetCurrentFFXIVProcess();
Thread.Sleep(1000);
}
}).ContinueWith((t) => {
GetFFXIVProcess();
MoreLogLineUI.AddParserMessage($"CurrentPID:{ffxivPlugin.DataRepository.GetCurrentFFXIVProcess().Id}");
//ActGlobals.oFormActMain.BeforeLogLineRead += new LogLineEventDelegate(this.oFormActMain_BeforeLogLineRead);
});
}
private void GetFfxivPlugin() {
ffxivPlugin = null;
List<ActPluginData> _ffxiv_act_plugins;
_ffxiv_act_plugins = ActGlobals.oFormActMain.ActPlugins.Where(x => x.pluginFile.Name.ToUpper().Contains("FFXIV_ACT_Plugin".ToUpper()) && x.lblPluginStatus.Text.ToUpper().Contains("FFXIV Plugin Started.".ToUpper())).ToList();
if (_ffxiv_act_plugins.Count != 1)
return;
//MoreLogLineUI.AddParserMessage($"{_ffxiv_act_plugins.Count}");
ffxivPlugin = (FFXIV_ACT_Plugin.FFXIV_ACT_Plugin)_ffxiv_act_plugins[0].pluginObj;
//MoreLogLineUI.AddParserMessage($"{ffxivPlugin.DataRepository.GetCurrentFFXIVProcess().Id}");
}
private void GetFFXIVProcess() {
FFXIV = ffxivPlugin.DataRepository.GetCurrentFFXIVProcess();
if (FFXIV == null) {
MoreLogLineUI.AddParserMessage("FFXIVProcess NOT Found");
return;
}
MoreLogLineUI.AddParserMessage("Found FFXIVProcess");
NhaamaProcess FFXIVProcess = FFXIV.GetNhaamaProcess();
var GameDir = Path.Combine(FFXIV.MainModule.FileName, "..\\sqpack");
MoreLogLineUI.AddParserMessage(GameDir);
lumina = new Lumina.Lumina(GameDir);
Craft.InitPtr(FFXIVProcess);
CraftNetwork.Init(lumina, ffxivPlugin);
ffxivPlugin.DataSubscription.NetworkReceived += new NetworkReceivedDelegate(this.MoreLogLines_OnNetworkReceived);
}
private void MoreLogLines_OnNetworkReceived(string connection, long epoch, byte[] message) {
if (BitConverter.ToUInt16(message, 18) == OpCode.StatusEffectList) {
CraftNetwork.BuffListProcess(epoch, message);
}
}
private void MoreLogLines_OnLogLineRead(bool isImport, LogLineEventArgs logInfo) {
DateTime dateTime = Utils.ParseLogDateTime(logInfo.logLine);
string logline = logInfo.logLine;
//AddParserMessage(logline);
Craft.ProcessLogLine(isImport, dateTime, logline);
//LogLineEventArgs logLine = new LogLineEventArgs("111111111111", 0, ActGlobals.oFormActMain.LastEstimatedTime, ActGlobals.oFormActMain.ActiveZone.ZoneName, false);
//BoradCastLogLine(isImport, logLine);
//SendLogLine(isImport, logLine);
}
public void DeInitPlugin() {
ActGlobals.oFormActMain.OnLogLineRead -= new LogLineEventDelegate(this.MoreLogLines_OnLogLineRead);
ffxivPlugin.DataSubscription.NetworkReceived -= new NetworkReceivedDelegate(this.MoreLogLines_OnNetworkReceived);
//ffxivPlugin.DataSubscription.ProcessChanged -= new ProcessChangedDelegate(this.MoreLogLines_OnProcessChanged);
}
}
}