mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Revert split and make collections boolean internal to BeatmapManager
This commit is contained in:
parent
1c1c9915bb
commit
e6de167adb
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
Assert.That(preserveCollection.BeatmapMD5Hashes, Does.Contain(initialHash));
|
||||
Assert.That(noNewCollection.BeatmapMD5Hashes, Does.Not.Contain(initialHash));
|
||||
|
||||
beatmaps.SaveExistingBeatmap(working.BeatmapInfo, working.GetPlayableBeatmap(new OsuRuleset().RulesetInfo));
|
||||
beatmaps.Save(working.BeatmapInfo, working.GetPlayableBeatmap(new OsuRuleset().RulesetInfo));
|
||||
|
||||
string finalHash = working.BeatmapInfo.MD5Hash;
|
||||
|
||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Beatmaps
|
||||
targetBeatmapSet.Beatmaps.Add(newBeatmap.BeatmapInfo);
|
||||
newBeatmap.BeatmapInfo.BeatmapSet = targetBeatmapSet;
|
||||
|
||||
SaveNewBeatmap(newBeatmap.BeatmapInfo, newBeatmap, beatmapSkin);
|
||||
save(newBeatmap.BeatmapInfo, newBeatmap, beatmapSkin, false);
|
||||
|
||||
workingBeatmapCache.Invalidate(targetBeatmapSet);
|
||||
return GetWorkingBeatmap(newBeatmap.BeatmapInfo);
|
||||
@ -286,22 +286,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <param name="beatmapInfo">The <see cref="BeatmapInfo"/> to save the content against. The file referenced by <see cref="BeatmapInfo.Path"/> will be replaced.</param>
|
||||
/// <param name="beatmapContent">The <see cref="IBeatmap"/> content to write.</param>
|
||||
/// <param name="beatmapSkin">The beatmap <see cref="ISkin"/> content to write, null if to be omitted.</param>
|
||||
public virtual void SaveExistingBeatmap(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin? beatmapSkin = null)
|
||||
{
|
||||
string oldMd5Hash = beatmapInfo.MD5Hash;
|
||||
|
||||
save(beatmapInfo, beatmapContent, beatmapSkin);
|
||||
|
||||
Realm.Write(r => beatmapInfo.TransferCollectionReferences(r, oldMd5Hash));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a new <see cref="IBeatmap"/> file against a given <see cref="BeatmapInfo"/>.
|
||||
/// </summary>
|
||||
/// <param name="beatmapInfo">The <see cref="BeatmapInfo"/> to save the content against. The file referenced by <see cref="BeatmapInfo.Path"/> will be replaced.</param>
|
||||
/// <param name="beatmapContent">The <see cref="IBeatmap"/> content to write.</param>
|
||||
/// <param name="beatmapSkin">The beatmap <see cref="ISkin"/> content to write, null if to be omitted.</param>
|
||||
public virtual void SaveNewBeatmap(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin? beatmapSkin = null)
|
||||
public virtual void Save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin? beatmapSkin = null)
|
||||
{
|
||||
save(beatmapInfo, beatmapContent, beatmapSkin);
|
||||
}
|
||||
@ -414,7 +399,7 @@ namespace osu.Game.Beatmaps
|
||||
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
}
|
||||
|
||||
private void save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin? beatmapSkin)
|
||||
private void save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent, ISkin? beatmapSkin, bool transferCollections = true)
|
||||
{
|
||||
var setInfo = beatmapInfo.BeatmapSet;
|
||||
Debug.Assert(setInfo != null);
|
||||
@ -448,6 +433,8 @@ namespace osu.Game.Beatmaps
|
||||
if (existingFileInfo != null)
|
||||
DeleteFile(setInfo, existingFileInfo);
|
||||
|
||||
string oldMd5Hash = beatmapInfo.MD5Hash;
|
||||
|
||||
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
||||
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
||||
|
||||
@ -464,6 +451,9 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
setInfo.CopyChangesToRealm(liveBeatmapSet);
|
||||
|
||||
if (transferCollections)
|
||||
beatmapInfo.TransferCollectionReferences(r, oldMd5Hash);
|
||||
|
||||
ProcessBeatmap?.Invoke((liveBeatmapSet, false));
|
||||
});
|
||||
}
|
||||
|
@ -429,10 +429,7 @@ namespace osu.Game.Screens.Edit
|
||||
try
|
||||
{
|
||||
// save the loaded beatmap's data stream.
|
||||
if (isNewBeatmap)
|
||||
beatmapManager.SaveNewBeatmap(editorBeatmap.BeatmapInfo, editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin);
|
||||
else
|
||||
beatmapManager.SaveExistingBeatmap(editorBeatmap.BeatmapInfo, editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin);
|
||||
beatmapManager.Save(editorBeatmap.BeatmapInfo, editorBeatmap.PlayableBeatmap, editorBeatmap.BeatmapSkin);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -178,12 +178,7 @@ namespace osu.Game.Tests.Visual
|
||||
=> testBeatmapManager.TestBeatmap;
|
||||
}
|
||||
|
||||
public override void SaveExistingBeatmap(BeatmapInfo info, IBeatmap beatmapContent, ISkin beatmapSkin = null)
|
||||
{
|
||||
// don't actually care about saving for this context.
|
||||
}
|
||||
|
||||
public override void SaveNewBeatmap(BeatmapInfo info, IBeatmap beatmapContent, ISkin beatmapSkin = null)
|
||||
public override void Save(BeatmapInfo info, IBeatmap beatmapContent, ISkin beatmapSkin = null)
|
||||
{
|
||||
// don't actually care about saving for this context.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user