diff --git a/CustomizePlus/Core/Helpers/VersionHelper.cs b/CustomizePlus/Core/Helpers/VersionHelper.cs new file mode 100644 index 0000000..7c8e64f --- /dev/null +++ b/CustomizePlus/Core/Helpers/VersionHelper.cs @@ -0,0 +1,27 @@ +#if !DEBUG +using System.Reflection; +#endif + +namespace CustomizePlus.Core.Helpers; + +internal static class VersionHelper +{ + public static string Version { get; private set; } = "Initializing"; + + public static bool IsTesting { get; private set; } = false; + + static VersionHelper() + { + #if DEBUG + Version = $"{ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha} [DEBUG]"; + #else + Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty; + #endif + + if (ThisAssembly.Git.BaseTag.ToLowerInvariant().Contains("testing")) + IsTesting = true; + + if (IsTesting) + Version += " [TESTING BUILD]"; + } +} diff --git a/CustomizePlus/Core/Services/CommandService.cs b/CustomizePlus/Core/Services/CommandService.cs index 285c182..ee21ca7 100644 --- a/CustomizePlus/Core/Services/CommandService.cs +++ b/CustomizePlus/Core/Services/CommandService.cs @@ -219,6 +219,7 @@ public class CommandService : IDisposable { if (state != null) { + //todo: still check and disable other profiles in this case? if (targetProfile!.Enabled == state) { _chatService.PrintInChat(new SeStringBuilder() diff --git a/CustomizePlus/Core/Services/SupportLogBuilderService.cs b/CustomizePlus/Core/Services/SupportLogBuilderService.cs index 063d42c..8c7dead 100644 --- a/CustomizePlus/Core/Services/SupportLogBuilderService.cs +++ b/CustomizePlus/Core/Services/SupportLogBuilderService.cs @@ -5,6 +5,7 @@ using CustomizePlus.Armatures.Services; using CustomizePlus.Configuration.Data; using CustomizePlus.Core.Data; using CustomizePlus.Core.Extensions; +using CustomizePlus.Core.Helpers; using CustomizePlus.Profiles; using CustomizePlus.Templates; using Dalamud.Plugin; @@ -38,7 +39,7 @@ public class SupportLogBuilderService { var sb = new StringBuilder(102400); //it's fair to assume this will very often be quite large sb.AppendLine("**Settings**"); - sb.Append($"> **`Plugin Version: `** {Plugin.Version}\n"); + sb.Append($"> **`Plugin Version: `** {VersionHelper.Version}\n"); sb.Append($"> **`Commit Hash: `** {ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}\n"); sb.Append($"> **`Plugin enabled: `** {_configuration.PluginEnabled}\n"); sb.AppendLine("**Settings -> Editor Settings**"); diff --git a/CustomizePlus/Plugin.cs b/CustomizePlus/Plugin.cs index 26b5e87..73b7c7c 100644 --- a/CustomizePlus/Plugin.cs +++ b/CustomizePlus/Plugin.cs @@ -1,9 +1,7 @@ using System; -#if !DEBUG -using System.Reflection; -#endif using CustomizePlus.Api; using CustomizePlus.Core; +using CustomizePlus.Core.Helpers; using CustomizePlus.Core.Services; using CustomizePlus.UI; using Dalamud.Plugin; @@ -16,12 +14,6 @@ namespace CustomizePlus; public sealed class Plugin : IDalamudPlugin { -#if DEBUG - public static readonly string Version = $"{ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha} [DEBUG]"; -#else - public static readonly string Version = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? string.Empty; -#endif - private readonly ServiceManager _services; public static readonly Logger Logger = new(); //for loggin in static classes/methods @@ -40,7 +32,7 @@ public sealed class Plugin : IDalamudPlugin _services.GetService(); _services.GetService(); - Logger.Information($"Customize+ {Version} ({ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}) [FantasiaPlus] started"); + Logger.Information($"Customize+ {VersionHelper.Version} ({ThisAssembly.Git.Commit}+{ThisAssembly.Git.Sha}) [FantasiaPlus] started"); } catch (Exception ex) { diff --git a/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs b/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs index 8fa48de..e989db8 100644 --- a/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs +++ b/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs @@ -38,6 +38,7 @@ public class PluginStateBlock { var severity = PluginStateSeverity.Normal; string? message = null; + string? hoverInfo = null; if(_hookingService.RenderHookFailed || _hookingService.MovementHookFailed) { @@ -74,6 +75,12 @@ public class PluginStateBlock severity = PluginStateSeverity.Error; message = $"Detected failure in IPC. Integrations with other plugins will not function."; } + else if(VersionHelper.IsTesting) + { + severity = PluginStateSeverity.Warning; + message = $"You are running testing version of Customize+, hover for more information."; + hoverInfo = "This is a testing build of Customize+. Some features like integration with other plugins might not function correctly."; + } if (message != null) { @@ -96,6 +103,8 @@ public class PluginStateBlock ImGui.PushStyleColor(ImGuiCol.Text, color); CtrlHelper.LabelWithIcon(icon, message, false); ImGui.PopStyleColor(); + if (hoverInfo != null) + CtrlHelper.AddHoverText(hoverInfo); } } diff --git a/CustomizePlus/UI/Windows/MainWindow/MainWindow.cs b/CustomizePlus/UI/Windows/MainWindow/MainWindow.cs index ab8da19..ab04c18 100644 --- a/CustomizePlus/UI/Windows/MainWindow/MainWindow.cs +++ b/CustomizePlus/UI/Windows/MainWindow/MainWindow.cs @@ -19,6 +19,7 @@ using Dalamud.Interface.Colors; using CustomizePlus.Templates.Events; using CustomizePlus.Templates.Data; using ECommons.Schedulers; +using CustomizePlus.Core.Helpers; namespace CustomizePlus.UI.Windows.MainWindow; @@ -59,7 +60,7 @@ public class MainWindow : Window, IDisposable PluginConfiguration configuration, HookingService hookingService, TemplateEditorEvent templateEditorEvent - ) : base($"Customize+ {Plugin.Version}###CPlusMainWindow") + ) : base($"Customize+ {VersionHelper.Version}###CPlusMainWindow") { _settingsTab = settingsTab; _templatesTab = templatesTab;