+65
-52
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ChatTwo.Ipc;
|
using ChatTwo.Ipc;
|
||||||
@@ -66,54 +67,66 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
public Plugin()
|
public Plugin()
|
||||||
{
|
{
|
||||||
GameStarted = Process.GetCurrentProcess().StartTime.ToUniversalTime();
|
try
|
||||||
|
{
|
||||||
|
GameStarted = Process.GetCurrentProcess().StartTime.ToUniversalTime();
|
||||||
|
|
||||||
Config = Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
Config = Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
Config.Migrate();
|
Config.Migrate();
|
||||||
|
|
||||||
if (Config.Tabs.Count == 0) {
|
if (Config.Tabs.Count == 0) {
|
||||||
Config.Tabs.Add(TabsUtil.VanillaGeneral);
|
Config.Tabs.Add(TabsUtil.VanillaGeneral);
|
||||||
|
}
|
||||||
|
|
||||||
|
LanguageChanged(Interface.UiLanguage);
|
||||||
|
|
||||||
|
Commands = new Commands(this);
|
||||||
|
Common = new XivCommonBase(Interface);
|
||||||
|
TextureCache = new TextureCache(TextureProvider);
|
||||||
|
Functions = new GameFunctions.GameFunctions(this);
|
||||||
|
Ipc = new IpcManager(Interface);
|
||||||
|
ExtraChat = new ExtraChat(this);
|
||||||
|
FontManager = new FontManager(this);
|
||||||
|
|
||||||
|
ChatLogWindow = new ChatLogWindow(this);
|
||||||
|
SettingsWindow = new SettingsWindow(this);
|
||||||
|
CommandHelpWindow = new CommandHelpWindow(ChatLogWindow);
|
||||||
|
SeStringDebugger = new SeStringDebugger(this);
|
||||||
|
|
||||||
|
WindowSystem.AddWindow(ChatLogWindow);
|
||||||
|
WindowSystem.AddWindow(SettingsWindow);
|
||||||
|
WindowSystem.AddWindow(CommandHelpWindow);
|
||||||
|
WindowSystem.AddWindow(SeStringDebugger);
|
||||||
|
FontManager.BuildFonts();
|
||||||
|
|
||||||
|
Interface.UiBuilder.DisableCutsceneUiHide = true;
|
||||||
|
Interface.UiBuilder.DisableGposeUiHide = true;
|
||||||
|
|
||||||
|
Store = new Store(this); // requires Ui
|
||||||
|
|
||||||
|
// let all the other components register, then initialise commands
|
||||||
|
Commands.Initialise();
|
||||||
|
|
||||||
|
if (Interface.Reason is not PluginLoadReason.Boot) {
|
||||||
|
Store.FilterAllTabs(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Framework.Update += FrameworkUpdate;
|
||||||
|
Interface.UiBuilder.Draw += Draw;
|
||||||
|
Interface.LanguageChanged += LanguageChanged;
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
LanguageChanged(Interface.UiLanguage);
|
{
|
||||||
|
Dispose();
|
||||||
Commands = new Commands(this);
|
// Re-throw the exception to fail the plugin load.
|
||||||
Common = new XivCommonBase(Interface);
|
throw;
|
||||||
TextureCache = new TextureCache(TextureProvider);
|
|
||||||
Functions = new GameFunctions.GameFunctions(this);
|
|
||||||
Ipc = new IpcManager(Interface);
|
|
||||||
ExtraChat = new ExtraChat(this);
|
|
||||||
FontManager = new FontManager(this);
|
|
||||||
|
|
||||||
ChatLogWindow = new ChatLogWindow(this);
|
|
||||||
SettingsWindow = new SettingsWindow(this);
|
|
||||||
CommandHelpWindow = new CommandHelpWindow(ChatLogWindow);
|
|
||||||
SeStringDebugger = new SeStringDebugger(this);
|
|
||||||
|
|
||||||
WindowSystem.AddWindow(ChatLogWindow);
|
|
||||||
WindowSystem.AddWindow(SettingsWindow);
|
|
||||||
WindowSystem.AddWindow(CommandHelpWindow);
|
|
||||||
WindowSystem.AddWindow(SeStringDebugger);
|
|
||||||
FontManager.BuildFonts();
|
|
||||||
|
|
||||||
Interface.UiBuilder.DisableCutsceneUiHide = true;
|
|
||||||
Interface.UiBuilder.DisableGposeUiHide = true;
|
|
||||||
|
|
||||||
Store = new Store(this); // requires Ui
|
|
||||||
|
|
||||||
// let all the other components register, then initialise commands
|
|
||||||
Commands.Initialise();
|
|
||||||
|
|
||||||
if (Interface.Reason is not PluginLoadReason.Boot) {
|
|
||||||
Store.FilterAllTabs(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Framework.Update += FrameworkUpdate;
|
|
||||||
Interface.UiBuilder.Draw += Draw;
|
|
||||||
Interface.LanguageChanged += LanguageChanged;
|
|
||||||
}
|
}
|
||||||
#pragma warning restore CS8618
|
#pragma warning restore CS8618
|
||||||
|
|
||||||
|
// Suppressing this warning because Dispose() is called in Plugin() if the
|
||||||
|
// load fails, so some values may not be initialized.
|
||||||
|
[SuppressMessage("ReSharper", "ConditionalAccessQualifierIsNonNullableAccordingToAPIContract")]
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Interface.LanguageChanged -= LanguageChanged;
|
Interface.LanguageChanged -= LanguageChanged;
|
||||||
@@ -121,18 +134,18 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
Framework.Update -= FrameworkUpdate;
|
Framework.Update -= FrameworkUpdate;
|
||||||
GameFunctions.GameFunctions.SetChatInteractable(true);
|
GameFunctions.GameFunctions.SetChatInteractable(true);
|
||||||
|
|
||||||
WindowSystem.RemoveAllWindows();
|
WindowSystem?.RemoveAllWindows();
|
||||||
ChatLogWindow.Dispose();
|
ChatLogWindow?.Dispose();
|
||||||
SettingsWindow.Dispose();
|
SettingsWindow?.Dispose();
|
||||||
SeStringDebugger.Dispose();
|
SeStringDebugger?.Dispose();
|
||||||
|
|
||||||
ExtraChat.Dispose();
|
ExtraChat?.Dispose();
|
||||||
Ipc.Dispose();
|
Ipc?.Dispose();
|
||||||
Store.Dispose();
|
Store?.Dispose();
|
||||||
Functions.Dispose();
|
Functions?.Dispose();
|
||||||
TextureCache.Dispose();
|
TextureCache?.Dispose();
|
||||||
Common.Dispose();
|
Common?.Dispose();
|
||||||
Commands.Dispose();
|
Commands?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Draw()
|
private void Draw()
|
||||||
|
|||||||
Reference in New Issue
Block a user