1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 16:52:55 +08:00

Resolve ruleset dependencies on game core / framework assemblies by checking already loaded assemblies in AppDomain.

This commit is contained in:
Lucas A 2020-04-20 13:56:15 +02:00
parent 1dcb0f53a2
commit a541f92682

View File

@ -62,10 +62,13 @@ namespace osu.Game.Rulesets
var asm = new AssemblyName(args.Name); var asm = new AssemblyName(args.Name);
// the requesting assembly may be located out of the executable's base directory, thus requiring manual resolving of its dependencies. // the requesting assembly may be located out of the executable's base directory, thus requiring manual resolving of its dependencies.
// this assumes the only explicit dependency of the ruleset is the game core assembly. // this attempts resolving the ruleset dependencies on game core and framework assemblies by returning assemblies with the same assembly name
// the ruleset dependency on the game core assembly requires manual resolving, transitive dependencies should be resolved automatically // already loaded in the AppDomain.
if (asm.Name.Equals(typeof(OsuGame).Assembly.GetName().Name, StringComparison.Ordinal)) foreach (var curAsm in AppDomain.CurrentDomain.GetAssemblies())
return Assembly.GetExecutingAssembly(); {
if (asm.Name.Equals(curAsm.GetName().Name, StringComparison.Ordinal))
return curAsm;
}
return loadedAssemblies.Keys.FirstOrDefault(a => a.FullName == asm.FullName); return loadedAssemblies.Keys.FirstOrDefault(a => a.FullName == asm.FullName);
} }