mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Make settings works with current caching structure
Will likely pull out that `RulesetConfigCache` next, but this is an "everything works" state.
This commit is contained in:
@ -4,15 +4,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Database;
|
||||
using Realms;
|
||||
|
||||
namespace osu.Game.Configuration
|
||||
{
|
||||
public class RealmSettingsStore
|
||||
public class SettingsStore
|
||||
{
|
||||
private readonly RealmContextFactory realmFactory;
|
||||
|
||||
public RealmSettingsStore(RealmContextFactory realmFactory)
|
||||
public SettingsStore(RealmContextFactory realmFactory)
|
||||
{
|
||||
this.realmFactory = realmFactory;
|
||||
}
|
||||
@ -27,21 +26,5 @@ namespace osu.Game.Configuration
|
||||
using (var context = realmFactory.GetForRead())
|
||||
return context.Realm.All<RealmSetting>().Where(b => b.RulesetID == rulesetId && b.Variant == variant).ToList();
|
||||
}
|
||||
|
||||
public void Update(RealmSetting setting)
|
||||
{
|
||||
using (ContextFactory.GetForWrite())
|
||||
{
|
||||
var newValue = setting.Value;
|
||||
Refresh(ref setting);
|
||||
setting.Value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(RealmSetting setting)
|
||||
{
|
||||
using (var usage = ContextFactory.GetForWrite())
|
||||
usage.Context.Remove(setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user