Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: add the white list to the github.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 8, 2023
1 parent f699848 commit 0f1def2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
13 changes: 6 additions & 7 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
@@ -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)
{
Expand All @@ -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<BetaRotationAttribute>() != null;
Expand Down
9 changes: 9 additions & 0 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -72,6 +75,12 @@ public unsafe RotationSolverPlugin(DalamudPluginInterface pluginInterface)
{
if(id == 0) OpenConfigWindow();
});

using (var client = new HttpClient())
{
var bts = client.GetByteArrayAsync("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/whitelist.json");
RotationHelper.AllowedAssembly = JsonConvert.DeserializeObject<string[]>( Encoding.Default.GetString(bts.Result));
}
}


Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/UI/RotationConfigWindow_Major.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0f1def2

Please sign in to comment.