mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Mark BeatmapSet.Status
as modified when any beatmap is modified, rather than all
This commit is contained in:
parent
df76f9f4da
commit
8cb02f47eb
@ -312,14 +312,13 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
||||||
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
||||||
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
|
||||||
|
|
||||||
if (setInfo.Beatmaps.All(b => b.Status == BeatmapOnlineStatus.LocallyModified))
|
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||||
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
|
||||||
|
|
||||||
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
||||||
|
|
||||||
setInfo.Hash = beatmapImporter.ComputeHash(setInfo);
|
setInfo.Hash = beatmapImporter.ComputeHash(setInfo);
|
||||||
|
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||||
|
|
||||||
Realm.Write(r =>
|
Realm.Write(r =>
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Data.Sqlite;
|
using Microsoft.Data.Sqlite;
|
||||||
using osu.Framework.Development;
|
using osu.Framework.Development;
|
||||||
@ -103,9 +104,11 @@ namespace osu.Game.Beatmaps
|
|||||||
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
||||||
{
|
{
|
||||||
beatmapInfo.Status = res.Status;
|
beatmapInfo.Status = res.Status;
|
||||||
|
|
||||||
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
|
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beatmapInfo.BeatmapSet.Beatmaps.All(b => b.MatchesOnlineVersion || b.Status != BeatmapOnlineStatus.LocallyModified))
|
||||||
|
{
|
||||||
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
|
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
|
||||||
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
|
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
|
||||||
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;
|
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;
|
||||||
@ -208,7 +211,12 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
var status = (BeatmapOnlineStatus)reader.GetByte(2);
|
var status = (BeatmapOnlineStatus)reader.GetByte(2);
|
||||||
|
|
||||||
beatmapInfo.Status = status;
|
// Some metadata should only be applied if there's no local changes.
|
||||||
|
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
||||||
|
{
|
||||||
|
beatmapInfo.Status = status;
|
||||||
|
beatmapInfo.Metadata.Author.OnlineID = reader.GetInt32(3);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: DateSubmitted and DateRanked are not provided by local cache.
|
// TODO: DateSubmitted and DateRanked are not provided by local cache.
|
||||||
beatmapInfo.OnlineID = reader.GetInt32(1);
|
beatmapInfo.OnlineID = reader.GetInt32(1);
|
||||||
@ -218,11 +226,9 @@ namespace osu.Game.Beatmaps
|
|||||||
Debug.Assert(beatmapInfo.BeatmapSet != null);
|
Debug.Assert(beatmapInfo.BeatmapSet != null);
|
||||||
beatmapInfo.BeatmapSet.OnlineID = reader.GetInt32(0);
|
beatmapInfo.BeatmapSet.OnlineID = reader.GetInt32(0);
|
||||||
|
|
||||||
// Some metadata should only be applied if there's no local changes.
|
if (beatmapInfo.BeatmapSet.Beatmaps.All(b => b.MatchesOnlineVersion || b.Status != BeatmapOnlineStatus.LocallyModified))
|
||||||
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
|
|
||||||
{
|
{
|
||||||
beatmapInfo.BeatmapSet.Status = status;
|
beatmapInfo.BeatmapSet.Status = status;
|
||||||
beatmapInfo.Metadata.Author.OnlineID = reader.GetInt32(3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logForModel(set, $"Cached local retrieval for {beatmapInfo}.");
|
logForModel(set, $"Cached local retrieval for {beatmapInfo}.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user