Use tuple to better explain new `bool` parameter

This commit is contained in:
Dean Herbert 2022-07-29 16:05:41 +09:00
parent 8cb4fb35e0
commit 2ff6ff06d3
3 changed files with 6 additions and 7 deletions

View File

@ -34,7 +34,7 @@ public class BeatmapImporter : RealmArchiveModelImporter<BeatmapSetInfo>
protected override string[] HashableFileTypes => new[] { ".osu" };
public Action<BeatmapSetInfo, bool>? ProcessBeatmap { private get; set; }
public Action<(BeatmapSetInfo beatmapSet, bool isBatch)>? ProcessBeatmap { private get; set; }
public BeatmapImporter(Storage storage, RealmAccess realm)
: base(storage, realm)
@ -171,8 +171,7 @@ protected override void PreImport(BeatmapSetInfo beatmapSet, Realm realm)
protected override void PostImport(BeatmapSetInfo model, Realm realm, bool batchImport)
{
base.PostImport(model, realm, batchImport);
ProcessBeatmap?.Invoke(model, batchImport);
ProcessBeatmap?.Invoke((model, batchImport));
}
private void validateOnlineIds(BeatmapSetInfo beatmapSet, Realm realm)

View File

@ -42,7 +42,7 @@ public class BeatmapManager : ModelManager<BeatmapSetInfo>, IModelImporter<Beatm
private readonly WorkingBeatmapCache workingBeatmapCache;
public Action<BeatmapSetInfo, bool>? ProcessBeatmap { private get; set; }
public Action<(BeatmapSetInfo beatmapSet, bool isBatch)>? ProcessBeatmap { private get; set; }
public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets, IAPIProvider? api, AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost? host = null,
WorkingBeatmap? defaultBeatmap = null, BeatmapDifficultyCache? difficultyCache = null, bool performOnlineLookups = false)
@ -62,7 +62,7 @@ public BeatmapManager(Storage storage, RealmAccess realm, RulesetStore rulesets,
BeatmapTrackStore = audioManager.GetTrackStore(userResources);
beatmapImporter = CreateBeatmapImporter(storage, realm);
beatmapImporter.ProcessBeatmap = (obj, isBatch) => ProcessBeatmap?.Invoke(obj, isBatch);
beatmapImporter.ProcessBeatmap = args => ProcessBeatmap?.Invoke(args);
beatmapImporter.PostNotification = obj => PostNotification?.Invoke(obj);
workingBeatmapCache = CreateWorkingBeatmapCache(audioManager, gameResources, userResources, defaultBeatmap, host);
@ -323,7 +323,7 @@ public virtual void Save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin
setInfo.CopyChangesToRealm(liveBeatmapSet);
ProcessBeatmap?.Invoke(liveBeatmapSet, false);
ProcessBeatmap?.Invoke((liveBeatmapSet, false));
});
}

View File

@ -287,7 +287,7 @@ private void load(ReadableKeyCombinationProvider keyCombinationProvider)
AddInternal(new BeatmapOnlineChangeIngest(beatmapUpdater, realm, metadataClient));
BeatmapManager.ProcessBeatmap = (set, isBatch) => beatmapUpdater.Process(set, preferOnlineFetch: !isBatch);
BeatmapManager.ProcessBeatmap = args => beatmapUpdater.Process(args.beatmapSet, !args.isBatch);
dependencies.Cache(userCache = new UserLookupCache());
AddInternal(userCache);