mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Rename Score/Skin ModelManager
classes to Importer
for now
This commit is contained in:
parent
1f3e1b2d97
commit
4d9e3d1982
@ -19,7 +19,7 @@ using Realms;
|
||||
|
||||
namespace osu.Game.Scoring
|
||||
{
|
||||
public class ScoreModelManager : RealmArchiveModelManager<ScoreInfo>
|
||||
public class ScoreImporter : RealmArchiveModelManager<ScoreInfo>
|
||||
{
|
||||
public override IEnumerable<string> HandledExtensions => new[] { ".osr" };
|
||||
|
||||
@ -28,7 +28,7 @@ namespace osu.Game.Scoring
|
||||
private readonly RulesetStore rulesets;
|
||||
private readonly Func<BeatmapManager> beatmaps;
|
||||
|
||||
public ScoreModelManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmAccess realm)
|
||||
public ScoreImporter(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmAccess realm)
|
||||
: base(storage, realm)
|
||||
{
|
||||
this.rulesets = rulesets;
|
@ -28,7 +28,7 @@ namespace osu.Game.Scoring
|
||||
private readonly Scheduler scheduler;
|
||||
private readonly Func<BeatmapDifficultyCache> difficulties;
|
||||
private readonly OsuConfigManager configManager;
|
||||
private readonly ScoreModelManager scoreModelManager;
|
||||
private readonly ScoreImporter scoreImporter;
|
||||
|
||||
public ScoreManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmAccess realm, Scheduler scheduler,
|
||||
Func<BeatmapDifficultyCache> difficulties = null, OsuConfigManager configManager = null)
|
||||
@ -38,10 +38,10 @@ namespace osu.Game.Scoring
|
||||
this.difficulties = difficulties;
|
||||
this.configManager = configManager;
|
||||
|
||||
scoreModelManager = new ScoreModelManager(rulesets, beatmaps, storage, realm);
|
||||
scoreImporter = new ScoreImporter(rulesets, beatmaps, storage, realm);
|
||||
}
|
||||
|
||||
public Score GetScore(ScoreInfo score) => scoreModelManager.GetScore(score);
|
||||
public Score GetScore(ScoreInfo score) => scoreImporter.GetScore(score);
|
||||
|
||||
/// <summary>
|
||||
/// Perform a lookup query on available <see cref="ScoreInfo"/>s.
|
||||
@ -231,7 +231,7 @@ namespace osu.Game.Scoring
|
||||
|
||||
public Action<Notification> PostNotification
|
||||
{
|
||||
set => scoreModelManager.PostNotification = value;
|
||||
set => scoreImporter.PostNotification = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -240,7 +240,7 @@ namespace osu.Game.Scoring
|
||||
|
||||
public bool Delete(ScoreInfo item)
|
||||
{
|
||||
return scoreModelManager.Delete(item);
|
||||
return scoreImporter.Delete(item);
|
||||
}
|
||||
|
||||
public void Delete([CanBeNull] Expression<Func<ScoreInfo, bool>> filter = null, bool silent = false)
|
||||
@ -253,7 +253,7 @@ namespace osu.Game.Scoring
|
||||
if (filter != null)
|
||||
items = items.Where(filter);
|
||||
|
||||
scoreModelManager.Delete(items.ToList(), silent);
|
||||
scoreImporter.Delete(items.ToList(), silent);
|
||||
});
|
||||
}
|
||||
|
||||
@ -262,27 +262,27 @@ namespace osu.Game.Scoring
|
||||
realm.Run(r =>
|
||||
{
|
||||
var beatmapScores = r.Find<BeatmapInfo>(beatmap.ID).Scores.ToList();
|
||||
scoreModelManager.Delete(beatmapScores, silent);
|
||||
scoreImporter.Delete(beatmapScores, silent);
|
||||
});
|
||||
}
|
||||
|
||||
public void Delete(List<ScoreInfo> items, bool silent = false) => scoreModelManager.Delete(items, silent);
|
||||
public void Delete(List<ScoreInfo> items, bool silent = false) => scoreImporter.Delete(items, silent);
|
||||
|
||||
public void Undelete(List<ScoreInfo> items, bool silent = false) => scoreModelManager.Undelete(items, silent);
|
||||
public void Undelete(List<ScoreInfo> items, bool silent = false) => scoreImporter.Undelete(items, silent);
|
||||
|
||||
public void Undelete(ScoreInfo item) => scoreModelManager.Undelete(item);
|
||||
public void Undelete(ScoreInfo item) => scoreImporter.Undelete(item);
|
||||
|
||||
public Task Import(params string[] paths) => scoreModelManager.Import(paths);
|
||||
public Task Import(params string[] paths) => scoreImporter.Import(paths);
|
||||
|
||||
public Task Import(params ImportTask[] tasks) => scoreModelManager.Import(tasks);
|
||||
public Task Import(params ImportTask[] tasks) => scoreImporter.Import(tasks);
|
||||
|
||||
public IEnumerable<string> HandledExtensions => scoreModelManager.HandledExtensions;
|
||||
public IEnumerable<string> HandledExtensions => scoreImporter.HandledExtensions;
|
||||
|
||||
public Task<IEnumerable<Live<ScoreInfo>>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreModelManager.Import(notification, tasks);
|
||||
public Task<IEnumerable<Live<ScoreInfo>>> Import(ProgressNotification notification, params ImportTask[] tasks) => scoreImporter.Import(notification, tasks);
|
||||
|
||||
public Live<ScoreInfo> Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreModelManager.Import(item, archive, batchImport, cancellationToken);
|
||||
public Live<ScoreInfo> Import(ScoreInfo item, ArchiveReader archive = null, bool batchImport = false, CancellationToken cancellationToken = default) => scoreImporter.Import(item, archive, batchImport, cancellationToken);
|
||||
|
||||
public bool IsAvailableLocally(ScoreInfo model) => scoreModelManager.IsAvailableLocally(model);
|
||||
public bool IsAvailableLocally(ScoreInfo model) => scoreImporter.IsAvailableLocally(model);
|
||||
|
||||
#endregion
|
||||
|
||||
@ -290,7 +290,7 @@ namespace osu.Game.Scoring
|
||||
|
||||
public Action<IEnumerable<Live<ScoreInfo>>> PostImport
|
||||
{
|
||||
set => scoreModelManager.PostImport = value;
|
||||
set => scoreImporter.PostImport = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -20,13 +20,13 @@ using Realms;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class SkinModelManager : RealmArchiveModelManager<SkinInfo>
|
||||
public class SkinImporter : RealmArchiveModelManager<SkinInfo>
|
||||
{
|
||||
private const string skin_info_file = "skininfo.json";
|
||||
|
||||
private readonly IStorageResourceProvider skinResources;
|
||||
|
||||
public SkinModelManager(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources)
|
||||
public SkinImporter(Storage storage, RealmAccess realm, IStorageResourceProvider skinResources)
|
||||
: base(storage, realm)
|
||||
{
|
||||
this.skinResources = skinResources;
|
@ -55,7 +55,7 @@ namespace osu.Game.Skinning
|
||||
Default = Skinning.DefaultSkin.CreateInfo().ToLiveUnmanaged()
|
||||
};
|
||||
|
||||
private readonly SkinModelManager skinModelManager;
|
||||
private readonly SkinImporter skinImporter;
|
||||
private readonly RealmAccess realm;
|
||||
|
||||
private readonly IResourceStore<byte[]> userFiles;
|
||||
@ -80,7 +80,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files"));
|
||||
|
||||
skinModelManager = new SkinModelManager(storage, realm, this);
|
||||
skinImporter = new SkinImporter(storage, realm, this);
|
||||
|
||||
var defaultSkins = new[]
|
||||
{
|
||||
@ -166,7 +166,7 @@ namespace osu.Game.Skinning
|
||||
Name = NamingUtils.GetNextBestName(existingSkinNames, $@"{s.Name} (modified)")
|
||||
};
|
||||
|
||||
var result = skinModelManager.Import(skinInfo);
|
||||
var result = skinImporter.Import(skinInfo);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
@ -186,7 +186,7 @@ namespace osu.Game.Skinning
|
||||
if (!skin.SkinInfo.IsManaged)
|
||||
throw new InvalidOperationException($"Attempting to save a skin which is not yet tracked. Call {nameof(EnsureMutableSkin)} first.");
|
||||
|
||||
skinModelManager.Save(skin);
|
||||
skinImporter.Save(skin);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -260,26 +260,26 @@ namespace osu.Game.Skinning
|
||||
|
||||
public Action<Notification> PostNotification
|
||||
{
|
||||
set => skinModelManager.PostNotification = value;
|
||||
set => skinImporter.PostNotification = value;
|
||||
}
|
||||
|
||||
public Action<IEnumerable<Live<SkinInfo>>> PostImport
|
||||
{
|
||||
set => skinModelManager.PostImport = value;
|
||||
set => skinImporter.PostImport = value;
|
||||
}
|
||||
|
||||
public Task Import(params string[] paths) => skinModelManager.Import(paths);
|
||||
public Task Import(params string[] paths) => skinImporter.Import(paths);
|
||||
|
||||
public Task Import(params ImportTask[] tasks) => skinModelManager.Import(tasks);
|
||||
public Task Import(params ImportTask[] tasks) => skinImporter.Import(tasks);
|
||||
|
||||
public IEnumerable<string> HandledExtensions => skinModelManager.HandledExtensions;
|
||||
public IEnumerable<string> HandledExtensions => skinImporter.HandledExtensions;
|
||||
|
||||
public Task<IEnumerable<Live<SkinInfo>>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinModelManager.Import(notification, tasks);
|
||||
public Task<IEnumerable<Live<SkinInfo>>> Import(ProgressNotification notification, params ImportTask[] tasks) => skinImporter.Import(notification, tasks);
|
||||
|
||||
public Task<Live<SkinInfo>> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinModelManager.Import(task, batchImport, cancellationToken);
|
||||
public Task<Live<SkinInfo>> Import(ImportTask task, bool batchImport = false, CancellationToken cancellationToken = default) => skinImporter.Import(task, batchImport, cancellationToken);
|
||||
|
||||
public Task<Live<SkinInfo>> Import(ArchiveReader archive, bool batchImport = false, CancellationToken cancellationToken = default) =>
|
||||
skinModelManager.Import(archive, batchImport, cancellationToken);
|
||||
skinImporter.Import(archive, batchImport, cancellationToken);
|
||||
|
||||
#endregion
|
||||
|
||||
@ -300,25 +300,25 @@ namespace osu.Game.Skinning
|
||||
if (items.Any(s => s.ID == currentUserSkin))
|
||||
scheduler.Add(() => CurrentSkinInfo.Value = Skinning.DefaultSkin.CreateInfo().ToLiveUnmanaged());
|
||||
|
||||
skinModelManager.Delete(items.ToList(), silent);
|
||||
skinImporter.Delete(items.ToList(), silent);
|
||||
});
|
||||
}
|
||||
|
||||
public bool Delete(SkinInfo item) => skinModelManager.Delete(item);
|
||||
public bool Delete(SkinInfo item) => skinImporter.Delete(item);
|
||||
|
||||
public void Delete(List<SkinInfo> items, bool silent = false) => skinModelManager.Delete(items, silent);
|
||||
public void Delete(List<SkinInfo> items, bool silent = false) => skinImporter.Delete(items, silent);
|
||||
|
||||
public void Undelete(List<SkinInfo> items, bool silent = false) => skinModelManager.Undelete(items, silent);
|
||||
public void Undelete(List<SkinInfo> items, bool silent = false) => skinImporter.Undelete(items, silent);
|
||||
|
||||
public void Undelete(SkinInfo item) => skinModelManager.Undelete(item);
|
||||
public void Undelete(SkinInfo item) => skinImporter.Undelete(item);
|
||||
|
||||
public bool IsAvailableLocally(SkinInfo model) => skinModelManager.IsAvailableLocally(model);
|
||||
public bool IsAvailableLocally(SkinInfo model) => skinImporter.IsAvailableLocally(model);
|
||||
|
||||
public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinModelManager.ReplaceFile(model, file, contents);
|
||||
public void ReplaceFile(SkinInfo model, RealmNamedFileUsage file, Stream contents) => skinImporter.ReplaceFile(model, file, contents);
|
||||
|
||||
public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinModelManager.DeleteFile(model, file);
|
||||
public void DeleteFile(SkinInfo model, RealmNamedFileUsage file) => skinImporter.DeleteFile(model, file);
|
||||
|
||||
public void AddFile(SkinInfo model, Stream contents, string filename) => skinModelManager.AddFile(model, contents, filename);
|
||||
public void AddFile(SkinInfo model, Stream contents, string filename) => skinImporter.AddFile(model, contents, filename);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user