mirror of
https://github.com/ppy/osu
synced 2024-12-26 08:53:10 +00:00
More methods
This commit is contained in:
parent
06ef8f71e9
commit
8120bb36bc
@ -24,19 +24,9 @@ namespace osu.Game.Rulesets
|
||||
|
||||
// On android in release configuration assemblies are loaded from the apk directly into memory.
|
||||
// We cannot read assemblies from cwd, so should check loaded assemblies instead.
|
||||
addLoadedRulesets();
|
||||
loadFromAppDomain();
|
||||
|
||||
try
|
||||
{
|
||||
string[] files = Directory.GetFiles(Environment.CurrentDirectory, $"{ruleset_library_prefix}.*.dll");
|
||||
|
||||
foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
|
||||
loadRulesetFromFile(file);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Log($"Could not load rulesets from directory {Environment.CurrentDirectory}");
|
||||
}
|
||||
loadFromDisk();
|
||||
}
|
||||
|
||||
public RulesetStore(IDatabaseContextFactory factory)
|
||||
@ -123,7 +113,7 @@ namespace osu.Game.Rulesets
|
||||
}
|
||||
}
|
||||
|
||||
private static void addLoadedRulesets()
|
||||
private static void loadFromAppDomain()
|
||||
{
|
||||
foreach (var ruleset in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
@ -136,6 +126,21 @@ namespace osu.Game.Rulesets
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadFromDisk()
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] files = Directory.GetFiles(Environment.CurrentDirectory, $"{ruleset_library_prefix}.*.dll");
|
||||
|
||||
foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
|
||||
loadRulesetFromFile(file);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Log($"Could not load rulesets from directory {Environment.CurrentDirectory}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadRulesetFromFile(string file)
|
||||
{
|
||||
var filename = Path.GetFileNameWithoutExtension(file);
|
||||
|
Loading…
Reference in New Issue
Block a user