protected DownloadableArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, IAPIProvider api, MutableDatabaseBackedStoreWithFileIncludes <TModel, TFileModel> modelStore, IIpcHost importHost = null) : base(storage, contextFactory, modelStore, importHost) { this.api = api; this.modelStore = modelStore; }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio, IResourceStore <byte[]> legacyDefaultResources) : base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost) { this.audio = audio; this.legacyDefaultResources = legacyDefaultResources; ItemRemoved += removedInfo => { // check the removed skin is not the current user choice. if it is, switch back to default. if (removedInfo.ID == CurrentSkinInfo.Value.ID) { CurrentSkinInfo.Value = SkinInfo.Default; } }; CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue); CurrentSkin.ValueChanged += skin => { if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio) : base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost) { this.audio = audio; CurrentSkinInfo.ValueChanged += info => CurrentSkin.Value = GetSkin(info); CurrentSkin.ValueChanged += skin => { if (skin.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; // migrate older imports which didn't have access to skin.ini using (ContextFactory.GetForWrite()) { foreach (var skinInfo in ModelStore.ConsumableItems.Where(s => s.Name.EndsWith(".osk"))) { populate(skinInfo); Update(skinInfo); } } }
public ScoreManager(RulesetStore rulesets, Func <BeatmapManager> beatmaps, Storage storage, IDatabaseContextFactory contextFactory, Scheduler scheduler, IIpcHost importHost = null, Func <BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null) { this.scheduler = scheduler; this.difficulties = difficulties; this.configManager = configManager; scoreModelManager = new ScoreModelManager(rulesets, beatmaps, storage, contextFactory, importHost); }
public ScoreManager(RulesetStore rulesets, Func <BeatmapManager> beatmaps, Storage storage, IAPIProvider api, IDatabaseContextFactory contextFactory, Scheduler scheduler, IIpcHost importHost = null, Func <BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null) : base(storage, contextFactory, api, new ScoreStore(contextFactory, storage), importHost) { this.rulesets = rulesets; this.beatmaps = beatmaps; this.scheduler = scheduler; this.difficulties = difficulties; this.configManager = configManager; }
public BeatmapIPCChannel(IIpcHost host, BeatmapDatabase beatmaps = null) : base(host) { this.beatmaps = beatmaps; MessageReceived += (msg) => { Debug.Assert(beatmaps != null); ImportAsync(msg.Path); }; }
public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null) : base(host) { this.scores = scores; MessageReceived += (msg) => { Debug.Assert(scores != null); ImportAsync(msg.Path); }; }
public ScoreStore(DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) { this.beatmaps = beatmaps; this.rulesets = rulesets; if (importHost != null) { ipc = new ScoreIPCChannel(importHost, this); } }
public ScoreDatabase(Storage storage, IIpcHost importHost = null, BeatmapDatabase beatmaps = null) { this.storage = storage; this.beatmaps = beatmaps; if (importHost != null) { ipc = new ScoreIPCChannel(importHost, this); } }
public ScoreStore(Storage storage, Func <OsuDbContext> factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) { this.storage = storage; this.beatmaps = beatmaps; this.rulesets = rulesets; if (importHost != null) { ipc = new ScoreIPCChannel(importHost, this); } }
public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapDatabase beatmaps = null, RulesetDatabase rulesets = null) : base(storage, connection) { this.storage = storage; this.beatmaps = beatmaps; this.rulesets = rulesets; if (importHost != null) { ipc = new ScoreIPCChannel(importHost, this); } }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio) : base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost) { this.audio = audio; CurrentSkinInfo.ValueChanged += info => CurrentSkin.Value = GetSkin(info); CurrentSkin.ValueChanged += skin => { if (skin.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } }; }
public ArchiveImportIPCChannel(IIpcHost host, ICanAcceptFiles importer = null) : base(host) { this.importer = importer; MessageReceived += msg => { Debug.Assert(importer != null); ImportAsync(msg.Path).ContinueWith(t => { if (t.Exception != null) { throw t.Exception; } }, TaskContinuationOptions.OnlyOnFaulted); }; }
public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null) : base(host) { this.scores = scores; MessageReceived += msg => { Debug.Assert(scores != null); ImportAsync(msg.Path).ContinueWith(t => { if (t.Exception != null) { throw t.Exception; } }, TaskContinuationOptions.OnlyOnFaulted); }; }
public BeatmapIPCChannel(IIpcHost host, BeatmapManager beatmaps = null) : base(host) { this.beatmaps = beatmaps; MessageReceived += msg => { Debug.Assert(beatmaps != null); ImportAsync(msg.Path).ContinueWith(t => { if (t.Exception != null) { throw t.Exception; } }, TaskContinuationOptions.OnlyOnFaulted); }; }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio, IResourceStore <byte[]> legacyDefaultResources) : base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost) { this.audio = audio; this.legacyDefaultResources = legacyDefaultResources; CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue); CurrentSkin.ValueChanged += skin => { if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; }
public BeatmapDatabase(Storage storage, IIpcHost importHost = null) { this.storage = storage; if (importHost != null) { ipc = new BeatmapIPCChannel(importHost, this); } if (connection == null) { try { connection = prepareConnection(); deletePending(); } catch (Exception e) { Logger.Error(e, @"Failed to initialise the beatmap database! Trying again with a clean database..."); storage.DeleteDatabase(@"beatmaps"); connection = prepareConnection(); } } }
public BeatmapDatabase(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection) { this.rulesets = rulesets; if (importHost != null) { ipc = new BeatmapIPCChannel(importHost, this); } }
public BeatmapManager(Storage storage, Func <OsuDbContext> context, RulesetStore rulesets, APIAccess api, IIpcHost importHost = null) { createContext = context; importContext = new Lazy <OsuDbContext>(() => { var c = createContext(); c.Database.AutoTransactionsEnabled = false; return(c); }); beatmaps = createBeatmapStore(context); files = new FileStore(context, storage); this.storage = files.Storage; this.rulesets = rulesets; this.api = api; if (importHost != null) { ipc = new BeatmapIPCChannel(importHost, this); } beatmaps.Cleanup(); }
public ScoreModelDownloader(ScoreModelManager scoreManager, IAPIProvider api, IIpcHost importHost = null) : base(scoreManager, api, importHost) { }
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, AudioManager audioManager, 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; this.audioManager = audioManager; }
protected ModelDownloader(IModelImporter <TModel> importer, IAPIProvider api, IIpcHost importHost = null) { this.importer = importer; this.api = api; }
public ScoreModelManager(RulesetStore rulesets, Func <BeatmapManager> beatmaps, Storage storage, IDatabaseContextFactory contextFactory, IIpcHost importHost = null) : base(storage, contextFactory, new ScoreStore(contextFactory, storage), importHost) { this.rulesets = rulesets; this.beatmaps = beatmaps; }
public IpcChannel(IIpcHost host) { this.host = host; this.host.MessageReceived += handleMessage; }
public BeatmapManager(Storage storage, Func <OsuDbContext> context, RulesetStore rulesets, APIAccess api, IIpcHost importHost = null) { createContext = context; refreshImportContext(); beatmaps = createBeatmapStore(context); files = new FileStore(context, storage); this.storage = files.Storage; this.rulesets = rulesets; this.api = api; if (importHost != null) { ipc = new BeatmapIPCChannel(importHost, this); } beatmaps.Cleanup(); }
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(); }
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); this.storage = storage; this.files = files; this.connection = connection; this.rulesets = rulesets; if (importHost != null) { ipc = new BeatmapIPCChannel(importHost, this); } }
protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes <TModel, TFileModel> modelStore, IIpcHost importHost = null) { ContextFactory = contextFactory; ModelStore = modelStore; ModelStore.ItemUpdated += item => handleEvent(() => itemUpdated.Value = new WeakReference <TModel>(item)); ModelStore.ItemRemoved += item => handleEvent(() => itemRemoved.Value = new WeakReference <TModel>(item)); exportStorage = storage.GetStorageForDirectory("exports"); Files = new FileStore(contextFactory, storage); if (importHost != null) { ipc = new ArchiveImportIPCChannel(importHost, this); } ModelStore.Cleanup(); }
protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes <TModel, TFileModel> modelStore, IIpcHost importHost = null) { ContextFactory = contextFactory; ModelStore = modelStore; ModelStore.ItemAdded += item => handleEvent(() => ItemAdded?.Invoke(item)); ModelStore.ItemRemoved += s => handleEvent(() => ItemRemoved?.Invoke(s)); Files = new FileStore(contextFactory, storage); if (importHost != null) { ipc = new ArchiveImportIPCChannel(importHost, this); } ModelStore.Cleanup(); }
protected ModelDownloader(IModelManager <TModel> modelManager, IAPIProvider api, IIpcHost importHost = null) { this.modelManager = modelManager; this.api = api; }