Update databased MD5 hash on save

This commit is contained in:
smoogipoo 2020-06-02 14:04:00 +09:00
parent 68fbe9f4c1
commit b41bb5a682
1 changed files with 3 additions and 1 deletions

View File

@ -201,7 +201,9 @@ public void Save(BeatmapInfo info, IBeatmap beatmapContent)
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
new LegacyBeatmapEncoder(beatmapContent).Encode(sw);
stream.Seek(0, SeekOrigin.Begin);
var attachedInfo = setInfo.Beatmaps.Single(b => b.ID == info.ID);
var md5Hash = stream.ComputeMD5Hash();
attachedInfo.MD5Hash = md5Hash;
UpdateFile(setInfo, setInfo.Files.Single(f => string.Equals(f.Filename, info.Path, StringComparison.OrdinalIgnoreCase)), stream);
}