Import beatmaps into the database via IPC

This commit is contained in:
Drew DeVault
2016-10-11 10:53:16 -04:00
committed by Dean Herbert
parent 3a163de0f7
commit 45c0bc5428
4 changed files with 24 additions and 9 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps.IO
foreach (var reader in readers)
{
if (reader.Test(storage, path))
return (ArchiveReader)Activator.CreateInstance(reader.Type);
return (ArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(path));
}
throw new IOException("Unknown file format");
}

View File

@ -13,12 +13,7 @@ namespace osu.Game.Beatmaps.IO
AddReader<OszArchiveReader>((storage, path) =>
{
using (var stream = storage.GetStream(path))
{
if (!ZipFile.IsZipFile(stream, false))
return false;
using (ZipFile zip = ZipFile.Read(stream))
return zip.Entries.Any(e => e.FileName.EndsWith(".osu"));
}
return ZipFile.IsZipFile(stream, false);
});
OsuLegacyDecoder.Register();
}

View File

@ -18,7 +18,12 @@ namespace osu.Game.Beatmaps.Objects.Osu
Circle = 1,
Slider = 2,
NewCombo = 4,
CircleNewCombo = 5,
SliderNewCombo = 6,
Spinner = 8,
ColourHax = 122,
Hold = 128,
ManiaLong = 128,
}
public static OsuBaseHit Parse(string val)
@ -26,6 +31,7 @@ namespace osu.Game.Beatmaps.Objects.Osu
string[] split = val.Split(',');
var type = (HitObjectType)int.Parse(split[3]);
bool combo = type.HasFlag(HitObjectType.NewCombo);
type &= (HitObjectType)0xF;
type &= ~HitObjectType.NewCombo;
OsuBaseHit result;
switch (type)