diff --git a/CommandHandler.cs b/CommandHandler.cs index 8086a69..b6d10f9 100644 --- a/CommandHandler.cs +++ b/CommandHandler.cs @@ -15,7 +15,7 @@ internal CommandHandler(Plugin plugin) { foreach (var name in CommandNames) { this.Plugin.CommandManager.AddHandler(name, new CommandInfo(this.Command) { - HelpMessage = $"Toggle the {this.Plugin.Name} interface", + HelpMessage = $"Toggle the {Plugin.Name} interface", }); } } diff --git a/DownloadTask.cs b/DownloadTask.cs index cfab201..20b754a 100644 --- a/DownloadTask.cs +++ b/DownloadTask.cs @@ -109,7 +109,7 @@ private async Task Run() { this.StateData = this.StateDataMax = 1; this.Plugin.Interface.UiBuilder.AddNotification( $"{this.PackageName} installed in Penumbra.", - this.Plugin.Name, + Plugin.Name, NotificationType.Success ); @@ -132,7 +132,7 @@ await this.Plugin.Framework.RunOnFrameworkThread(() => { this.Error = ex; this.Plugin.Interface.UiBuilder.AddNotification( $"Failed to install {this.PackageName ?? "mod"}.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error, 5_000 ); diff --git a/Plugin.cs b/Plugin.cs index b0f541a..5f74e18 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -20,7 +20,7 @@ namespace Heliosphere; public class Plugin : IDalamudPlugin { - public string Name => "Heliosphere"; + internal static string Name => "Heliosphere"; internal static HttpClient Client { get; } = new(); internal static Plugin Instance { get; private set; } @@ -204,7 +204,7 @@ internal async Task AddDownloadAsync(DownloadTask task, CancellationToken token if (!wasAdded) { this.Interface.UiBuilder.AddNotification( $"Already downloading that mod!", - this.Name, + Name, NotificationType.Error ); diff --git a/Server.cs b/Server.cs index d3708c2..7bc1489 100644 --- a/Server.cs +++ b/Server.cs @@ -137,7 +137,7 @@ private void HandleConnection() { try { this.Plugin.Interface.UiBuilder.AddNotification( "Installing a mod...", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); if (this.Plugin.Penumbra.TryGetModDirectory(out var modDir)) { @@ -153,7 +153,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( } else { this.Plugin.Interface.UiBuilder.AddNotification( "Cannot install mod: Penumbra is not set up.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } @@ -161,7 +161,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( ErrorHelper.Handle(ex, "Error performing one-click install"); this.Plugin.Interface.UiBuilder.AddNotification( "Error performing one-click install.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } @@ -172,7 +172,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( try { this.Plugin.Interface.UiBuilder.AddNotification( "Opening mod installer, please wait...", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); var window = await PromptWindow.Open(this.Plugin, info.PackageId, info.VersionId, info.DownloadCode); @@ -181,7 +181,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( ErrorHelper.Handle(ex, "Error opening prompt window"); this.Plugin.Interface.UiBuilder.AddNotification( "Error opening installer prompt.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } @@ -205,7 +205,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( var plural = info.VariantIds.Length == 1 ? "" : "s"; this.Plugin.Interface.UiBuilder.AddNotification( $"Installing a mod with {info.VariantIds.Length} variant{plural}...", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); var resp = await Plugin.GraphQl.MultiVariantInstall.ExecuteAsync(info.PackageId); @@ -230,7 +230,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( } else { this.Plugin.Interface.UiBuilder.AddNotification( "Cannot install mod: Penumbra is not set up.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } @@ -238,7 +238,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( ErrorHelper.Handle(ex, "Error performing one-click install"); this.Plugin.Interface.UiBuilder.AddNotification( "Error performing one-click install.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } @@ -249,7 +249,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( try { this.Plugin.Interface.UiBuilder.AddNotification( "Opening mod installer, please wait...", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); var window = await MultiVariantPromptWindow.Open(this.Plugin, info.PackageId, info.VariantIds, info.DownloadCode); @@ -258,7 +258,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( ErrorHelper.Handle(ex, "Error opening prompt window"); this.Plugin.Interface.UiBuilder.AddNotification( "Error opening installer prompt.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } @@ -279,7 +279,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( if (!this.Plugin.Penumbra.TryGetModDirectory(out var modDir)) { this.Plugin.Interface.UiBuilder.AddNotification( "Cannot install mod: Penumbra is not set up.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); @@ -291,7 +291,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( var plural = info.Installs.Length == 1 ? "" : "s"; this.Plugin.Interface.UiBuilder.AddNotification( $"Installing {info.Installs.Length} mod{plural}...", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); @@ -310,7 +310,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( ErrorHelper.Handle(ex, "Error performing one-click install"); this.Plugin.Interface.UiBuilder.AddNotification( "Error performing one-click install.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } @@ -322,7 +322,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( try { this.Plugin.Interface.UiBuilder.AddNotification( "Opening mod installer, please wait...", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); var window = await MultiPromptWindow.Open(this.Plugin, info.Installs); @@ -331,7 +331,7 @@ await this.Plugin.AddDownloadAsync(new DownloadTask( ErrorHelper.Handle(ex, "Error opening prompt window"); this.Plugin.Interface.UiBuilder.AddNotification( "Error opening installer prompt.", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); } diff --git a/Ui/AntiVirusWindow.cs b/Ui/AntiVirusWindow.cs index 5bdc4d5..c995675 100644 --- a/Ui/AntiVirusWindow.cs +++ b/Ui/AntiVirusWindow.cs @@ -22,7 +22,7 @@ public DrawStatus Draw() { } using var end = new OnDispose(ImGui.End); - if (!ImGui.Begin($"{this.Plugin.Name}##av-warning", ref this._visible, ImGuiWindowFlags.AlwaysAutoResize)) { + if (!ImGui.Begin($"{Plugin.Name}##av-warning", ref this._visible, ImGuiWindowFlags.AlwaysAutoResize)) { return DrawStatus.Continue; } diff --git a/Ui/DownloadStatusWindow.cs b/Ui/DownloadStatusWindow.cs index 05a4ce2..07df796 100644 --- a/Ui/DownloadStatusWindow.cs +++ b/Ui/DownloadStatusWindow.cs @@ -49,7 +49,7 @@ private void Draw() { } ImGui.SetNextWindowSize(new Vector2(500, 160), ImGuiCond.FirstUseEver); - if (!ImGui.Begin($"{this.Plugin.Name} downloads", flags)) { + if (!ImGui.Begin($"{Plugin.Name} downloads", flags)) { ImGui.End(); return; } diff --git a/Ui/InstallerWindow.cs b/Ui/InstallerWindow.cs index ea5c017..49e9cb4 100644 --- a/Ui/InstallerWindow.cs +++ b/Ui/InstallerWindow.cs @@ -140,7 +140,7 @@ internal static async Task OpenAndAdd(OpenOptions options, string? packageName = ErrorHelper.Handle(ex, "Could not open installer window"); options.Plugin.Interface.UiBuilder.AddNotification( $"Could not open installer window for {options.Info?.Variant.Package.Name ?? packageName}. Check that it still exists and that your internet connection is working.", - $"[{options.Plugin.Name}] Error opening installer", + $"[{Plugin.Name}] Error opening installer", NotificationType.Error, 5_000 ); diff --git a/Ui/MultiPromptWindow.cs b/Ui/MultiPromptWindow.cs index 90ce471..06a2488 100644 --- a/Ui/MultiPromptWindow.cs +++ b/Ui/MultiPromptWindow.cs @@ -54,7 +54,7 @@ internal static async Task OpenAndAdd(Plugin plugin, IEnumerable in ErrorHelper.Handle(ex, "Error opening prompt window"); plugin.Interface.UiBuilder.AddNotification( "Error opening installer prompt.", - plugin.Name, + Plugin.Name, NotificationType.Error ); } diff --git a/Ui/MultiVariantPromptWindow.cs b/Ui/MultiVariantPromptWindow.cs index 186e47e..407e257 100644 --- a/Ui/MultiVariantPromptWindow.cs +++ b/Ui/MultiVariantPromptWindow.cs @@ -154,7 +154,7 @@ internal static async Task OpenAndAdd(Plugin plugin, Guid packageId, Guid[] vari ErrorHelper.Handle(ex, "Error opening prompt window"); plugin.Interface.UiBuilder.AddNotification( "Error opening installer prompt.", - plugin.Name, + Plugin.Name, NotificationType.Error ); } diff --git a/Ui/PluginUi.cs b/Ui/PluginUi.cs index e4d4c6e..b637137 100644 --- a/Ui/PluginUi.cs +++ b/Ui/PluginUi.cs @@ -153,7 +153,7 @@ private void Inner() { } ImGui.SetNextWindowSize(new Vector2(585, 775), ImGuiCond.FirstUseEver); - if (!ImGui.Begin(this.Plugin.Name, ref this.Visible)) { + if (!ImGui.Begin(Plugin.Name, ref this.Visible)) { ImGui.End(); return; } diff --git a/Ui/PromptWindow.cs b/Ui/PromptWindow.cs index 1830cf5..42e6baa 100644 --- a/Ui/PromptWindow.cs +++ b/Ui/PromptWindow.cs @@ -68,7 +68,7 @@ internal static async Task OpenAndAdd(Plugin plugin, Guid packageId, Guid versio ErrorHelper.Handle(ex, "Error opening prompt window"); plugin.Interface.UiBuilder.AddNotification( "Error opening installer prompt.", - plugin.Name, + Plugin.Name, NotificationType.Error ); } diff --git a/Ui/Tabs/Manager.cs b/Ui/Tabs/Manager.cs index a70bb7f..f598c73 100644 --- a/Ui/Tabs/Manager.cs +++ b/Ui/Tabs/Manager.cs @@ -334,7 +334,7 @@ private void DrawActionsTab(HeliosphereMeta pkg) { if (info.Versions.Count == 0 || info.Versions[0].Version == pkg.Version) { this.Plugin.Interface.UiBuilder.AddNotification( $"{pkg.Name} is already up-to-date.", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); return; @@ -708,7 +708,7 @@ private async Task DownloadUpdatesInner(bool useConfig) { var autoHeader = $"{numMods} mod{plural} auto-updated successfully."; this.Plugin.Interface.UiBuilder.AddNotification( autoHeader, - this.Plugin.Name, + Plugin.Name, NotificationType.Success ); this.Plugin.ChatGui.Print(autoHeader); diff --git a/Ui/Tabs/Settings.cs b/Ui/Tabs/Settings.cs index 7047cf5..49cc4d5 100644 --- a/Ui/Tabs/Settings.cs +++ b/Ui/Tabs/Settings.cs @@ -108,7 +108,7 @@ ref this.Plugin.Config.DefaultCollection ImGui.SetClipboardText(Base64.Default.Encode(password)); this.Plugin.Interface.UiBuilder.AddNotification( "Code copied to clipboard. Paste it on the Heliosphere website.", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); } @@ -171,7 +171,7 @@ ref this.Plugin.Config.OneClickCollection ImGui.SetClipboardText($"{this.Plugin.Config.UserId:N}"); this.Plugin.Interface.UiBuilder.AddNotification( "Support ID copied to clipboard.", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); } @@ -184,7 +184,7 @@ ref this.Plugin.Config.OneClickCollection this.Plugin.Interface.UiBuilder.AddNotification( "Config copied to clipboard.", - this.Plugin.Name, + Plugin.Name, NotificationType.Info ); } @@ -199,7 +199,7 @@ ref this.Plugin.Config.OneClickCollection ErrorHelper.Handle(ex, "Could not start server"); this.Plugin.Interface.UiBuilder.AddNotification( "Could not start server", - this.Plugin.Name, + Plugin.Name, NotificationType.Error ); }