fix: don't refer to CS assembly by name

This commit is contained in:
goat 2024-11-04 14:39:26 +01:00
parent 422463f9cf
commit f39abd9dd2

View file

@ -16,7 +16,7 @@ public unsafe partial class AddonTree
{ {
private static readonly Dictionary<string, Type?> AddonTypeDict = []; private static readonly Dictionary<string, Type?> AddonTypeDict = [];
private static readonly Assembly? ClientStructs = AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(static a => a.GetName().Name == "FFXIVClientStructs"); private static readonly Assembly? ClientStructsAssembly = typeof(Addon).Assembly;
/// <summary> /// <summary>
/// Gets or sets a collection of names for field offsets that have been documented in FFXIVClientStructs. /// Gets or sets a collection of names for field offsets that have been documented in FFXIVClientStructs.
@ -30,11 +30,11 @@ public unsafe partial class AddonTree
return null; return null;
} }
if (AddonTypeDict.TryAdd(this.AddonName, null) && ClientStructs != null) if (AddonTypeDict.TryAdd(this.AddonName, null) && ClientStructsAssembly != null)
{ {
try try
{ {
foreach (var t in from t in ClientStructs.GetTypes() foreach (var t in from t in ClientStructsAssembly.GetTypes()
where t.IsPublic where t.IsPublic
let xivAddonAttr = (Addon?)t.GetCustomAttribute(typeof(Addon), false) let xivAddonAttr = (Addon?)t.GetCustomAttribute(typeof(Addon), false)
where xivAddonAttr != null where xivAddonAttr != null