mirror of
https://github.com/ppy/osu
synced 2025-01-11 08:39:31 +00:00
Add prefix Online to BeatmapID and BeatmapSetID
This commit is contained in:
parent
c940b48bba
commit
acfbf2e32e
@ -49,12 +49,12 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
return new BeatmapSetInfo
|
||||
{
|
||||
BeatmapSetID = 1234 + i,
|
||||
OnlineBeatmapSetID = 1234 + i,
|
||||
Hash = "d8e8fca2dc0f896fd7cb4cb0031ba249",
|
||||
Path = string.Empty,
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
BeatmapSetID = 1234 + i,
|
||||
OnlineBeatmapSetID = 1234 + i,
|
||||
Artist = "MONACA",
|
||||
Title = "Black Song",
|
||||
Author = "Some Guy",
|
||||
@ -63,7 +63,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
new BeatmapInfo
|
||||
{
|
||||
BeatmapID = 1234 + i,
|
||||
OnlineBeatmapID = 1234 + i,
|
||||
Mode = PlayMode.Osu,
|
||||
Path = "normal.osu",
|
||||
Version = "Normal",
|
||||
@ -74,7 +74,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
BeatmapID = 1235 + i,
|
||||
OnlineBeatmapID = 1235 + i,
|
||||
Mode = PlayMode.Osu,
|
||||
Path = "hard.osu",
|
||||
Version = "Hard",
|
||||
@ -85,7 +85,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
BeatmapID = 1236 + i,
|
||||
OnlineBeatmapID = 1236 + i,
|
||||
Mode = PlayMode.Osu,
|
||||
Path = "insane.osu",
|
||||
Version = "Insane",
|
||||
|
@ -23,7 +23,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
OsuLegacyDecoder.Register();
|
||||
Ruleset.Register(new OsuRuleset());
|
||||
}
|
||||
[Test]
|
||||
|
||||
[Test]
|
||||
public void TestDecodeMetadata()
|
||||
{
|
||||
var decoder = new OsuLegacyDecoder();
|
||||
@ -31,7 +32,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
{
|
||||
var beatmap = decoder.Decode(new StreamReader(stream));
|
||||
var meta = beatmap.BeatmapInfo.Metadata;
|
||||
Assert.AreEqual(241526, meta.BeatmapSetID);
|
||||
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
|
||||
Assert.AreEqual("Soleily", meta.Artist);
|
||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||
@ -125,7 +126,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
public void TestDecodeHitObjects()
|
||||
[Test]
|
||||
public void TestDecodeHitObjects()
|
||||
{
|
||||
var decoder = new OsuLegacyDecoder();
|
||||
using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
|
||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
Action waitAction = () =>
|
||||
{
|
||||
while ((resultSets = osu.Dependencies.Get<BeatmapDatabase>()
|
||||
.Query<BeatmapSetInfo>().Where(s => s.BeatmapSetID == 241526)).Count() != 1)
|
||||
.Query<BeatmapSetInfo>().Where(s => s.OnlineBeatmapSetID == 241526)).Count() != 1)
|
||||
Thread.Sleep(1);
|
||||
};
|
||||
|
||||
@ -100,7 +100,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
waitAction = () =>
|
||||
{
|
||||
while ((resultBeatmaps = osu.Dependencies.Get<BeatmapDatabase>()
|
||||
.Query<BeatmapInfo>().Where(s => s.BeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
||||
.Query<BeatmapInfo>().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
|
||||
Thread.Sleep(1);
|
||||
};
|
||||
|
||||
@ -113,7 +113,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count());
|
||||
|
||||
foreach (BeatmapInfo b in resultBeatmaps)
|
||||
Assert.IsTrue(set.Beatmaps.Any(c => c.BeatmapID == b.BeatmapID));
|
||||
Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));
|
||||
|
||||
Assert.IsTrue(set.Beatmaps.Count > 0);
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var reader = new OszArchiveReader(osz);
|
||||
var meta = reader.ReadMetadata();
|
||||
Assert.AreEqual(241526, meta.BeatmapSetID);
|
||||
Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
|
||||
Assert.AreEqual("Soleily", meta.Artist);
|
||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||
@ -65,7 +65,8 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
Assert.AreEqual("Renatus", meta.TitleUnicode);
|
||||
}
|
||||
}
|
||||
[Test]
|
||||
|
||||
[Test]
|
||||
public void TestReadFile()
|
||||
{
|
||||
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
|
||||
|
@ -136,11 +136,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
beatmap.BeatmapInfo.Metadata.Tags = val;
|
||||
break;
|
||||
case @"BeatmapID":
|
||||
beatmap.BeatmapInfo.BeatmapID = int.Parse(val);
|
||||
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(val);
|
||||
break;
|
||||
case @"BeatmapSetID":
|
||||
beatmap.BeatmapInfo.BeatmapSetID = int.Parse(val);
|
||||
metadata.BeatmapSetID = int.Parse(val);
|
||||
beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(val);
|
||||
metadata.OnlineBeatmapSetID = int.Parse(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -69,8 +69,8 @@ namespace osu.Game.Database
|
||||
using (var reader = ArchiveReader.GetReader(storage, path))
|
||||
metadata = reader.ReadMetadata();
|
||||
|
||||
if (metadata.BeatmapSetID != -1 &&
|
||||
connection.Table<BeatmapSetInfo>().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0)
|
||||
if (metadata.OnlineBeatmapSetID.HasValue &&
|
||||
connection.Table<BeatmapSetInfo>().Count(b => b.OnlineBeatmapSetID == metadata.OnlineBeatmapSetID) != 0)
|
||||
return; // TODO: Update this beatmap instead
|
||||
|
||||
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
|
||||
@ -87,7 +87,7 @@ namespace osu.Game.Database
|
||||
}
|
||||
var beatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
BeatmapSetID = metadata.BeatmapSetID,
|
||||
OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
|
||||
Beatmaps = new List<BeatmapInfo>(),
|
||||
Path = path,
|
||||
Hash = hash,
|
||||
@ -140,7 +140,7 @@ namespace osu.Game.Database
|
||||
|
||||
public BeatmapSetInfo GetBeatmapSet(int id)
|
||||
{
|
||||
return Query<BeatmapSetInfo>().FirstOrDefault(s => s.BeatmapSetID == id);
|
||||
return Query<BeatmapSetInfo>().FirstOrDefault(s => s.OnlineBeatmapSetID == id);
|
||||
}
|
||||
|
||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
||||
|
@ -16,9 +16,9 @@ namespace osu.Game.Database
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int BeatmapID { get; set; } = 0;
|
||||
public int? OnlineBeatmapID { get; set; } = null;
|
||||
|
||||
public int BeatmapSetID { get; set; } = -1;
|
||||
public int? OnlineBeatmapSetID { get; set; } = null;
|
||||
|
||||
[ForeignKey(typeof(BeatmapSetInfo))]
|
||||
public int BeatmapSetInfoID { get; set; }
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Database
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int BeatmapSetID { get; set; } = -1;
|
||||
public int? OnlineBeatmapSetID { get; set; } = null;
|
||||
|
||||
public string Title { get; set; }
|
||||
public string TitleUnicode { get; set; }
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Database
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int ID { get; set; }
|
||||
|
||||
public int BeatmapSetID { get; set; } = -1;
|
||||
public int? OnlineBeatmapSetID { get; set; } = null;
|
||||
|
||||
[OneToOne(CascadeOperations = CascadeOperation.All)]
|
||||
public BeatmapMetadata Metadata { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user