mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Update RulesetStore to read from populated defaults
This commit is contained in:
@ -58,16 +58,11 @@ namespace osu.Game.Rulesets
|
||||
|
||||
var instances = loadedAssemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r)).ToList();
|
||||
|
||||
//add all legacy modes in correct order
|
||||
//add all legacy rulesets first to ensure they have exclusive choice of primary key.
|
||||
foreach (var r in instances.Where(r => r is ILegacyRuleset))
|
||||
{
|
||||
int legacyId = ((ILegacyRuleset)r).LegacyID;
|
||||
|
||||
if (context.RulesetInfo.SingleOrDefault(rsi => rsi.ID == legacyId) == null)
|
||||
{
|
||||
r.RulesetInfo.ID = legacyId;
|
||||
if (context.RulesetInfo.SingleOrDefault(dbRuleset => dbRuleset.ID == r.RulesetInfo.ID) == null)
|
||||
context.RulesetInfo.Add(r.RulesetInfo);
|
||||
}
|
||||
}
|
||||
|
||||
context.SaveChanges();
|
||||
|
Reference in New Issue
Block a user