// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; using System.Linq; using osu.Game.Database; namespace osu.Game.Configuration { public class SettingsStore : DatabaseBackedStore { public event Action SettingChanged; public SettingsStore(Func createContext) : base(createContext) { } /// /// Retrieve s for a specified ruleset/variant content. /// /// The ruleset's internal ID. /// An optional variant. /// public List Query(int? rulesetId = null, int? variant = null) => GetContext().DatabasedSetting.Where(b => b.RulesetID == rulesetId && b.Variant == variant).ToList(); public void Update(DatabasedSetting setting) { var context = GetContext(); Refresh(ref setting); setting.Value = setting.Value; context.SaveChanges(); SettingChanged?.Invoke(); } } }