mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
Fix Assembly hooks for sub-dependencies
This commit is contained in:
parent
965f2142ff
commit
64bc2ddee4
1 changed files with 13 additions and 23 deletions
|
|
@ -978,26 +978,21 @@ namespace Dalamud.Plugin.Internal
|
||||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313:Parameter names should begin with lower-case letter", Justification = "Enforced naming for special injected parameters")]
|
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313:Parameter names should begin with lower-case letter", Justification = "Enforced naming for special injected parameters")]
|
||||||
private static void AssemblyLocationPatch(Assembly __instance, ref string __result)
|
private static void AssemblyLocationPatch(Assembly __instance, ref string __result)
|
||||||
{
|
{
|
||||||
// Assembly.GetExecutingAssembly can return this.
|
if (string.IsNullOrEmpty(__result))
|
||||||
// Check for it as a special case and find the plugin.
|
|
||||||
if (__result.EndsWith("System.Private.CoreLib.dll", StringComparison.InvariantCultureIgnoreCase))
|
|
||||||
{
|
{
|
||||||
foreach (var assemblyName in GetStackFrameAssemblyNames())
|
foreach (var assemblyName in GetStackFrameAssemblyNames())
|
||||||
{
|
{
|
||||||
if (PluginLocations.TryGetValue(assemblyName, out var data))
|
if (PluginLocations.TryGetValue(assemblyName, out var data))
|
||||||
{
|
{
|
||||||
__result = data.Location;
|
__result = data.Location;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(__result))
|
|
||||||
{
|
__result ??= string.Empty;
|
||||||
if (PluginLocations.TryGetValue(__instance.FullName, out var data))
|
|
||||||
{
|
Log.Verbose($"Assembly.Location // {__instance.FullName} // {__result}");
|
||||||
__result = data.Location;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1010,26 +1005,21 @@ namespace Dalamud.Plugin.Internal
|
||||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313:Parameter names should begin with lower-case letter", Justification = "Enforced naming for special injected parameters")]
|
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1313:Parameter names should begin with lower-case letter", Justification = "Enforced naming for special injected parameters")]
|
||||||
private static void AssemblyCodeBasePatch(Assembly __instance, ref string __result)
|
private static void AssemblyCodeBasePatch(Assembly __instance, ref string __result)
|
||||||
{
|
{
|
||||||
// Assembly.GetExecutingAssembly can return this.
|
if (string.IsNullOrEmpty(__result))
|
||||||
// Check for it as a special case and find the plugin.
|
|
||||||
if (__result.EndsWith("System.Private.CoreLib.dll"))
|
|
||||||
{
|
{
|
||||||
foreach (var assemblyName in GetStackFrameAssemblyNames())
|
foreach (var assemblyName in GetStackFrameAssemblyNames())
|
||||||
{
|
{
|
||||||
if (PluginLocations.TryGetValue(assemblyName, out var data))
|
if (PluginLocations.TryGetValue(assemblyName, out var data))
|
||||||
{
|
{
|
||||||
__result = data.Location;
|
__result = data.CodeBase;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(__result))
|
|
||||||
{
|
__result ??= string.Empty;
|
||||||
if (PluginLocations.TryGetValue(__instance.FullName, out var data))
|
|
||||||
{
|
Log.Verbose($"Assembly.CodeBase // {__instance.FullName} // {__result}");
|
||||||
__result = data.Location;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<string> GetStackFrameAssemblyNames()
|
private static IEnumerable<string> GetStackFrameAssemblyNames()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue