private BeatmapStore createBeatmapStore(Func <OsuDbContext> context) { var store = new BeatmapStore(context); store.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); store.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); store.BeatmapHidden += b => BeatmapHidden?.Invoke(b); store.BeatmapRestored += b => BeatmapRestored?.Invoke(b); return(store); }
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, IIpcHost importHost = null) : base(storage, contextFactory, new BeatmapStore(contextFactory), importHost) { beatmaps = (BeatmapStore)ModelStore; beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); this.rulesets = rulesets; this.api = api; }
public BeatmapModelManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, GameHost host = null) : base(storage, contextFactory, new BeatmapStore(contextFactory), host) { this.rulesets = rulesets; beatmaps = (BeatmapStore)ModelStore; beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); beatmaps.ItemRemoved += b => WorkingBeatmapCache?.Invalidate(b); beatmaps.ItemUpdated += obj => WorkingBeatmapCache?.Invalidate(obj); }
/// <summary> /// Hide a <see cref="BeatmapInfo"/> in the database. /// </summary> /// <param name="beatmap">The beatmap to hide.</param> /// <returns>Whether the beatmap's <see cref="BeatmapInfo.Hidden"/> was changed.</returns> public bool Hide(BeatmapInfo beatmap) { if (beatmap.Hidden) { return(false); } beatmap.Hidden = true; Connection.Update(beatmap); BeatmapHidden?.Invoke(beatmap); return(true); }
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, AudioManager audioManager, IIpcHost importHost = null, WorkingBeatmap defaultBeatmap = null) : base(storage, contextFactory, new BeatmapStore(contextFactory), importHost) { this.rulesets = rulesets; this.api = api; this.audioManager = audioManager; DefaultBeatmap = defaultBeatmap; beatmaps = (BeatmapStore)ModelStore; beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); }
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null, WorkingBeatmap defaultBeatmap = null) : base(storage, contextFactory, new BeatmapStore(contextFactory), host) { this.rulesets = rulesets; this.api = api; this.audioManager = audioManager; this.host = host; DefaultBeatmap = defaultBeatmap; beatmaps = (BeatmapStore)ModelStore; beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); }
/// <summary> /// Hide a <see cref="BeatmapInfo"/> in the database. /// </summary> /// <param name="beatmap">The beatmap to hide.</param> /// <returns>Whether the beatmap's <see cref="BeatmapInfo.Hidden"/> was changed.</returns> public bool Hide(BeatmapInfo beatmap) { var context = GetContext(); if (beatmap.Hidden) { return(false); } beatmap.Hidden = true; context.SaveChanges(); BeatmapHidden?.Invoke(beatmap); return(true); }
/// <summary> /// Hide a <see cref="BeatmapInfo"/> in the database. /// </summary> /// <param name="beatmap">The beatmap to hide.</param> /// <returns>Whether the beatmap's <see cref="BeatmapInfo.Hidden"/> was changed.</returns> public bool Hide(BeatmapInfo beatmap) { using (ContextFactory.GetForWrite()) { Refresh(ref beatmap, Beatmaps); if (beatmap.Hidden) { return(false); } beatmap.Hidden = true; } BeatmapHidden?.Invoke(beatmap); return(true); }
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null, WorkingBeatmap defaultBeatmap = null) : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host) { this.rulesets = rulesets; this.audioManager = audioManager; this.host = host; DefaultBeatmap = defaultBeatmap; beatmaps = (BeatmapStore)ModelStore; beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage); exportStorage = storage.GetStorageForDirectory("exports"); }
public BeatmapManager(Storage storage, FileStore files, SQLiteConnection connection, RulesetStore rulesets, IIpcHost importHost = null) { beatmaps = new BeatmapStore(connection); beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); beatmaps.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); this.storage = storage; this.files = files; this.connection = connection; this.rulesets = rulesets; if (importHost != null) { ipc = new BeatmapIPCChannel(importHost, this); } }
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, IIpcHost importHost = null) { this.contextFactory = contextFactory; beatmaps = new BeatmapStore(contextFactory); beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s); beatmaps.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s); beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b); beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b); files = new FileStore(contextFactory, storage); this.rulesets = rulesets; this.api = api; if (importHost != null) { ipc = new BeatmapIPCChannel(importHost, this); } beatmaps.Cleanup(); }