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

Commit

Permalink
fix: add change logs for aseembly link.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 12, 2023
1 parent dfbbd8d commit c172e4d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 3 additions & 1 deletion RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ public class AssemblyLinkAttribute : Attribute
{
public string SupportLink { get; }
public string HelpLink { get; }
public string ChangeLog { get; }

public AssemblyLinkAttribute(string supportLink = "", string helpLink = "")
public AssemblyLinkAttribute(string supportLink = null, string helpLink = null, string changeLog = null)
{
SupportLink = supportLink;
HelpLink = helpLink;
ChangeLog = changeLog;
}
}
6 changes: 3 additions & 3 deletions RotationSolver/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace RotationSolver;

internal record AssemblyInfo(string Name, string Author, string Path, string support, string help);
internal record AssemblyInfo(string Name, string Author, string Path, string support, string help, string changeLog);

internal static class RotationHelper
{
Expand Down Expand Up @@ -86,7 +86,7 @@ public static AssemblyInfo GetInfo(this Assembly assembly)
{
return value;
}
return _assemblyInfos[assembly] = new AssemblyInfo(assembly.GetName().Name, "Unknown", assembly.Location, string.Empty, string.Empty);
return _assemblyInfos[assembly] = new AssemblyInfo(assembly.GetName().Name, "Unknown", assembly.Location, null, null, null);
}
public static async void LoadList()
{
Expand Down Expand Up @@ -154,7 +154,7 @@ public static Assembly LoadFrom(string filePath)
var name = assembly.GetName().Name;

var attr = assembly.GetCustomAttribute<AssemblyLinkAttribute>();
_assemblyInfos[assembly] = new AssemblyInfo(name, GetAuthor(filePath, name), filePath, attr?.SupportLink, attr?.HelpLink);
_assemblyInfos[assembly] = new AssemblyInfo(name, GetAuthor(filePath, name), filePath, attr?.SupportLink, attr?.HelpLink, attr?.ChangeLog);
return assembly;
}
}
15 changes: 15 additions & 0 deletions RotationSolver/UI/RotationConfigWindow_Rotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,21 @@ private static void DrawInfos()
}
}

if (!string.IsNullOrEmpty(info.changeLog))
{
if (ImGui.Button($"ChangeLog##{grp.Key.GetHashCode()}"))
{
try
{
Util.OpenLink(info.changeLog);
}
catch
{

}
}
}

if (!isAllowed) ImGui.PopStyleColor();
}
ImGui.EndTable();
Expand Down

0 comments on commit c172e4d

Please sign in to comment.