1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Fix editor saving not updating BeatmapSetInfo's hash

This commit is contained in:
Dean Herbert 2022-07-08 02:31:33 +09:00
parent 0d25b63769
commit c53dd4a703
3 changed files with 5 additions and 1 deletions

View File

@ -40,6 +40,8 @@ namespace osu.Game.Tests.Visual.Editing
SaveEditor(); SaveEditor();
AddAssert("Hash updated", () => !string.IsNullOrEmpty(EditorBeatmap.BeatmapInfo.BeatmapSet?.Hash));
AddAssert("Beatmap has correct metadata", () => EditorBeatmap.BeatmapInfo.Metadata.Artist == "artist" && EditorBeatmap.BeatmapInfo.Metadata.Title == "title"); AddAssert("Beatmap has correct metadata", () => EditorBeatmap.BeatmapInfo.Metadata.Artist == "artist" && EditorBeatmap.BeatmapInfo.Metadata.Title == "title");
AddAssert("Beatmap has correct author", () => EditorBeatmap.BeatmapInfo.Metadata.Author.Username == "author"); AddAssert("Beatmap has correct author", () => EditorBeatmap.BeatmapInfo.Metadata.Author.Username == "author");
AddAssert("Beatmap has correct difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName == "difficulty"); AddAssert("Beatmap has correct difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName == "difficulty");

View File

@ -316,6 +316,8 @@ namespace osu.Game.Beatmaps
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo)); AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
setInfo.Hash = beatmapImporter.ComputeHash(setInfo);
Realm.Write(r => Realm.Write(r =>
{ {
var liveBeatmapSet = r.Find<BeatmapSetInfo>(setInfo.ID); var liveBeatmapSet = r.Find<BeatmapSetInfo>(setInfo.ID);

View File

@ -386,7 +386,7 @@ namespace osu.Game.Database
/// <remarks> /// <remarks>
/// In the case of no matching files, a hash will be generated from the passed archive's <see cref="ArchiveReader.Name"/>. /// In the case of no matching files, a hash will be generated from the passed archive's <see cref="ArchiveReader.Name"/>.
/// </remarks> /// </remarks>
protected string ComputeHash(TModel item) public string ComputeHash(TModel item)
{ {
// for now, concatenate all hashable files in the set to create a unique hash. // for now, concatenate all hashable files in the set to create a unique hash.
MemoryStream hashable = new MemoryStream(); MemoryStream hashable = new MemoryStream();