Testing version warning

This commit is contained in:
RisaDev
2024-10-24 23:38:39 +03:00
parent 4284b323ef
commit a3c3d4d0e5
6 changed files with 43 additions and 12 deletions

View File

@@ -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]";
}
}

View File

@@ -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()

View File

@@ -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**");

View File

@@ -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<CPlusWindowSystem>();
_services.GetService<CommandService>();
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)
{

View File

@@ -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);
}
}

View File

@@ -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;