mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 18:32:56 +08:00
Update AddBeatmap accordingly
This commit is contained in:
parent
e9a45de51f
commit
c9a057b510
@ -19,6 +19,7 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
Connection = storage.GetDatabase(@"beatmaps");
|
Connection = storage.GetDatabase(@"beatmaps");
|
||||||
Connection.CreateTable<BeatmapMetadata>();
|
Connection.CreateTable<BeatmapMetadata>();
|
||||||
|
Connection.CreateTable<BaseDifficulty>();
|
||||||
Connection.CreateTable<BeatmapSet>();
|
Connection.CreateTable<BeatmapSet>();
|
||||||
Connection.CreateTable<Beatmap>();
|
Connection.CreateTable<Beatmap>();
|
||||||
}
|
}
|
||||||
@ -30,20 +31,6 @@ namespace osu.Game.Database
|
|||||||
return;
|
return;
|
||||||
string[] mapNames = input.ReadBeatmaps();
|
string[] mapNames = input.ReadBeatmaps();
|
||||||
var beatmapSet = new BeatmapSet { BeatmapSetID = metadata.BeatmapSetID };
|
var beatmapSet = new BeatmapSet { BeatmapSetID = metadata.BeatmapSetID };
|
||||||
var beatmapMetadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Title = metadata.Title,
|
|
||||||
TitleUnicode = metadata.TitleUnicode,
|
|
||||||
Artist = metadata.Artist,
|
|
||||||
ArtistUnicode = metadata.ArtistUnicode,
|
|
||||||
Author = metadata.Author,
|
|
||||||
Source = metadata.Source,
|
|
||||||
Tags = metadata.Tags,
|
|
||||||
Mode = metadata.Mode,
|
|
||||||
PreviewTime = metadata.PreviewTime,
|
|
||||||
AudioFile = metadata.AudioFile,
|
|
||||||
BackgroundFile = metadata.BackgroundFile,
|
|
||||||
};
|
|
||||||
var maps = new List<Beatmap>();
|
var maps = new List<Beatmap>();
|
||||||
foreach (var name in mapNames)
|
foreach (var name in mapNames)
|
||||||
{
|
{
|
||||||
@ -51,15 +38,11 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
var decoder = BeatmapDecoder.GetDecoder(stream);
|
var decoder = BeatmapDecoder.GetDecoder(stream);
|
||||||
var beatmap = decoder.Decode(stream);
|
var beatmap = decoder.Decode(stream);
|
||||||
maps.Add(new Beatmap
|
maps.Add(beatmap);
|
||||||
{
|
beatmap.BaseDifficultyID = Connection.Insert(beatmap.BaseDifficulty);
|
||||||
BeatmapID = beatmap.BeatmapID,
|
|
||||||
BeatmapSetID = metadata.BeatmapSetID,
|
|
||||||
// TODO: Import more things
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
beatmapSet.BeatmapMetadataID = Connection.Insert(beatmapMetadata);
|
beatmapSet.BeatmapMetadataID = Connection.Insert(metadata);
|
||||||
Connection.Insert(beatmapSet);
|
Connection.Insert(beatmapSet);
|
||||||
Connection.InsertAll(maps);
|
Connection.InsertAll(maps);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user