mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:42:58 +08:00
Merge pull request #9725 from smoogipoo/fix-dynamic-ruleset-load
This commit is contained in:
commit
533be74a38
@ -65,11 +65,15 @@ namespace osu.Game.Rulesets
|
|||||||
// 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 attempts resolving the ruleset dependencies on game core and framework assemblies by returning assemblies with the same assembly name
|
// this attempts resolving the ruleset dependencies on game core and framework assemblies by returning assemblies with the same assembly name
|
||||||
// already loaded in the AppDomain.
|
// already loaded in the AppDomain.
|
||||||
foreach (var curAsm in AppDomain.CurrentDomain.GetAssemblies())
|
var domainAssembly = AppDomain.CurrentDomain.GetAssemblies()
|
||||||
{
|
// Given name is always going to be equally-or-more qualified than the assembly name.
|
||||||
if (asm.Name.Equals(curAsm.GetName().Name, StringComparison.Ordinal))
|
.Where(a => args.Name.Contains(a.GetName().Name, StringComparison.Ordinal))
|
||||||
return curAsm;
|
// Pick the greatest assembly version.
|
||||||
}
|
.OrderByDescending(a => a.GetName().Version)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (domainAssembly != null)
|
||||||
|
return domainAssembly;
|
||||||
|
|
||||||
return loadedAssemblies.Keys.FirstOrDefault(a => a.FullName == asm.FullName);
|
return loadedAssemblies.Keys.FirstOrDefault(a => a.FullName == asm.FullName);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user