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

Commit

Permalink
fix: remove the default list.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 9, 2023
1 parent 36d24fd commit b24b43e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 34 deletions.
3 changes: 0 additions & 3 deletions Resources/defaultList.json

This file was deleted.

2 changes: 1 addition & 1 deletion Resources/whitelist.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
"Some Dll",
"RotationSolver.Default",
"Another Dll"
]
1 change: 0 additions & 1 deletion RotationSolver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8948C02A-914E-4A51-B1FE-2C608492EBF5}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
Resources\defaultList.json = Resources\defaultList.json
Directory.Build.props = Directory.Build.props
Resources\downloadList.json = Resources\downloadList.json
manifest.json = manifest.json
Expand Down
23 changes: 1 addition & 22 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ namespace RotationSolver;
internal static class RotationHelper
{
public static string[] AllowedAssembly { get; private set; } = new string[0];
public static string[] DefaultAssembly { get; private set; } = new string[]
{
"RotationSolver.Default",
};

public static async void LoadList()
{
Expand All @@ -26,25 +22,8 @@ public static async void LoadList()
{
PluginLog.Log(ex, "Failed to load white List.");
}

try
{
var bts = await client.GetByteArrayAsync("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Resources/defaultList.json");
DefaultAssembly = JsonConvert.DeserializeObject<string[]>(Encoding.Default.GetString(bts));
}
catch (Exception ex)
{
PluginLog.Log(ex, "Failed to load default List.");
}
}
}

public static bool IsDefault(this ICustomRotation rotation)
{
var type = rotation.GetType();
if (!DefaultAssembly.Contains(type.Assembly.GetName().Name)) return false;
return type.Name.Contains("Default", StringComparison.OrdinalIgnoreCase);
}

public static bool IsAllowed(this ICustomRotation rotation, out string name)
{
Expand All @@ -55,7 +34,7 @@ public static bool IsAllowed(this ICustomRotation rotation, out string name)
}
name = rotation.GetType().Assembly.GetName().Name;

return DefaultAssembly.Contains(name) || AllowedAssembly.Contains(name);
return AllowedAssembly.Contains(name);
}

public static Vector4 GetColor(this ICustomRotation rotation)
Expand Down
2 changes: 0 additions & 2 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ internal static void UpdateDisplayWindow()
&& !Service.Conditions[ConditionFlag.WaitingForDuty]
&& !Service.Conditions[ConditionFlag.OccupiedInQuestEvent]);

isValid = true;

_controlWindow.IsOpen = isValid && Service.Config.ShowControlWindow;
_nextActionWindow.IsOpen = isValid && Service.Config.ShowNextActionWindow;
_cooldownWindow.IsOpen = isValid && Service.Config.ShowCooldownWindow;
Expand Down
8 changes: 6 additions & 2 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@ public static void UpdateRotation()

internal static ICustomRotation GetChooseRotation(CustomRotationGroup group)
{
Service.Config.RotationChoices.TryGetValue((uint)group.jobId, out var name);
var has = Service.Config.RotationChoices.TryGetValue((uint)group.jobId, out var name);

var rotation = group.rotations.FirstOrDefault(r => r.GetType().FullName == name);
rotation ??= group.rotations.FirstOrDefault(RotationHelper.IsDefault);
rotation ??= group.rotations.FirstOrDefault(r => r.IsAllowed(out _));
rotation ??= group.rotations.FirstOrDefault();

if (!has && rotation != null)
{
Service.Config.RotationChoices[(uint)group.jobId] = rotation.GetType().FullName;
}
return rotation;
}
}
6 changes: 3 additions & 3 deletions RotationSolver/Updaters/TimeLineUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@ public static void DrawHeader()

if (hasSet)
{
if (ImGuiHelper.IconButton(Dalamud.Interface.FontAwesomeIcon.Ban, "##DeleteTimelineConditionSet"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.Ban, "##DeleteTimelineConditionSet"))
{
Delete(set.Name);
}

ImGui.SameLine();
}

if (ImGuiHelper.IconButton(Dalamud.Interface.FontAwesomeIcon.Plus, "##AddNewTimelineConditionSet"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.Plus, "##AddNewTimelineConditionSet"))
{
AddNew();
}

ImGui.SameLine();
if (ImGuiHelper.IconButton(Dalamud.Interface.FontAwesomeIcon.Folder, "##OpenDefinationFolder"))
if (ImGuiHelper.IconButton(FontAwesomeIcon.Folder, "##OpenDefinationFolder"))
{
Process.Start("explorer.exe", _timelineFolder);
}
Expand Down

0 comments on commit b24b43e

Please sign in to comment.