public FateWatcher(CactbotEventSource client, string language) { client_ = client; if (language == "ko") { region_ = "ko"; } else if (language == "cn") { region_ = "cn"; } else { region_ = "intl"; } fateSemaphore = new SemaphoreSlim(0, 1); ceSemaphore = new SemaphoreSlim(0, 1); ac143opcodes = new Dictionary <string, AC143OPCodes>(); ac143opcodes.Add("ko", ac143_v5_2); ac143opcodes.Add("cn", ac143_v5_2); ac143opcodes.Add("intl", ac143_v5_2); cedirectoropcodes = new Dictionary <string, CEDirectorOPCodes>(); cedirectoropcodes.Add("ko", cedirector_ko); cedirectoropcodes.Add("cn", cedirector_cn); cedirectoropcodes.Add("intl", cedirector_intl); fates = new Dictionary <int, int>(); ces = new Dictionary <int, CEDirectorData>(); var FFXIV = ActGlobals.oFormActMain.ActPlugins.FirstOrDefault(x => x.lblPluginTitle.Text == "FFXIV_ACT_Plugin.dll"); if (FFXIV != null && FFXIV.pluginObj != null) { try { subscription = (IDataSubscription)FFXIV.pluginObj.GetType().GetProperty("DataSubscription").GetValue(FFXIV.pluginObj); } catch (Exception ex) { client_.LogError(ex.ToString()); } } var mach = Assembly.Load("Machina.FFXIV"); MessageType = mach.GetType("Machina.FFXIV.Headers.Server_MessageType"); actorControl143 = new ActorControl143(MessageType, mach); headerOffset = GetOffset(actorControl143.packetType, "MessageHeader"); messageHeader = actorControl143.packetType.GetField("MessageHeader").FieldType; messageTypeOffset = headerOffset + GetOffset(messageHeader, "MessageType"); }
public FateWatcher(TinyIoCContainer container) { container_ = container; logger = container.Resolve <ILogger>(); var ffxiv = container.Resolve <FFXIVRepository>(); if (!ffxiv.IsFFXIVPluginPresent()) { return; } var language = ffxiv.GetLocaleString(); if (language == "ko") { region_ = "ko"; } else if (language == "cn") { region_ = "cn"; } else { region_ = "intl"; } fateSemaphore = new SemaphoreSlim(0, 1); ceSemaphore = new SemaphoreSlim(0, 1); ac143opcodes = new Dictionary <string, AC143OPCodes>(); ac143opcodes.Add("ko", ac143_v5_2); ac143opcodes.Add("cn", ac143_v5_2); ac143opcodes.Add("intl", ac143_v5_2); cedirectoropcodes = new Dictionary <string, CEDirectorOPCodes>(); cedirectoropcodes.Add("intl", cedirector_cn); cedirectoropcodes.Add("cn", cedirector_cn); fates = new Dictionary <int, int>(); ces = new Dictionary <int, CEDirectorData>(); var netHelper = container.Resolve <NetworkParser>(); var mach = Assembly.Load("Machina.FFXIV"); MessageType = mach.GetType("Machina.FFXIV.Headers.Server_MessageType"); actorControl143 = new ActorControl143(container, mach); headerOffset = netHelper.GetOffset(actorControl143.packetType, "MessageHeader"); messageHeader = actorControl143.packetType.GetField("MessageHeader").FieldType; messageTypeOffset = headerOffset + netHelper.GetOffset(messageHeader, "MessageType"); ffxiv.RegisterNetworkParser(MessageReceived); }