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

Commit

Permalink
fix: Reduced the frequency of use of GetAuthors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 11, 2023
1 parent af271c0 commit 5989a8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
10 changes: 4 additions & 6 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace RotationSolver;
internal static class RotationHelper
{
public static string[] AllowedAssembly { get; private set; } = new string[0];

static readonly SortedList<Assembly, string> _authors = new SortedList<Assembly, string>();
public static async void LoadList()
{
using (var client = new HttpClient())
Expand Down Expand Up @@ -46,16 +46,14 @@ public static Vector4 GetColor(this ICustomRotation rotation)
public static bool IsBeta(this ICustomRotation rotation)
=> rotation.GetType().GetCustomAttribute<BetaRotationAttribute>() != null;


public static string GetAuthor(this ICustomRotation rotation)
=> rotation.GetType().Assembly.GetAuthor();

public static string GetAuthor(this Assembly assembly)
{
if (_authors.TryGetValue(assembly, out var author)) return author;
try
{
var name = assembly.GetName().Name;
return (RotationLoadContext.AssemblyPaths.TryGetValue(name, out var path)
return _authors[assembly] =
(RotationLoadContext.AssemblyPaths.TryGetValue(name, out var path)
? FileVersionInfo.GetVersionInfo(path)?.CompanyName : name)
?? name ?? "Unknown";
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
ImGui.SameLine();

ImGui.PushStyleColor(ImGuiCol.Text, rotation.GetColor());
ImGui.Text(rotation.GetAuthor());
ImGui.Text(rotation.GetType().Assembly.GetName().Name);
if (!rotation.IsAllowed(out _))
{
var showStr = string.Format(LocalizationManager.RightLang.ConfigWindow_Helper_HighEndWarning, rotation)
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_RotationDev.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ private void DrawRotationDevTab()
}

ImGui.EndChild();

}
}
}

0 comments on commit 5989a8a

Please sign in to comment.