public void ReadReplay() { //get random file string path = SharedCode.GetRelativeDirectory("Replays"); string[] files = Directory.GetFiles(path); Skip.If(files.Length == 0, "No replays in your replay folder!"); for (int i = 0; i < Math.Min(files.Length, 10); i++) //10 at most { var r = Replay.Read(files[i]); Debug.WriteLine("Version: " + r.OsuVersion); Assert.True(r.OsuVersion >= 20070000, "osu! version is too low, is the replay object empty?"); Debug.WriteLine("Beatmap hash: " + r.BeatmapHash); Assert.Equal(32, r.BeatmapHash.Length); //invalid beatmap hash Debug.WriteLine($"Replay by {r.PlayerName}, for {r.Score} score with {r.Combo}x combo. Played at {r.TimePlayed}"); Debug.WriteLine($"Amount of replay frames: {r.ReplayFrames.Length}"); for (int j = 0; j < Math.Min(r.ReplayFrames.Length, 10); j++) { Debug.WriteLine(r.ReplayFrames[j]); } Debug.WriteLine(""); } }
public void CheckBeatmapsAgainstDb() { OsuDb db = OsuDb.Read(SharedCode.GetRelativeFile("osu!.db")); for (var i = 0; i < Math.Min(db.Beatmaps.Count, 50); i++) { var entry = db.Beatmaps[i]; Debug.WriteLine($"Going to read beatmap at /{entry.FolderName}/{entry.BeatmapFileName}"); //just make sure the songs folder exists SharedCode.GetRelativeDirectory("Songs"); //read beatmap try { BeatmapFile bm = BeatmapFile.Read(SharedCode.GetRelativeFile(Path.Combine("Songs", entry.FolderName, entry.BeatmapFileName), true)); //BUG: this can still fail when maps use the hold note (used in some mania maps?) Assert.True(bm.SectionGeneral.Count >= 2); //disco prince only has 2 Assert.True(bm.SectionMetadata.Count >= 4); //disco prince only has 4 Assert.True(bm.SectionDifficulty.Count >= 5); //disco prince only has 5 Assert.Equal(entry.Artist, bm.Artist); Assert.Equal(entry.Version, bm.Version); Assert.Equal(entry.Creator, bm.Creator); Assert.Equal(entry.Title, bm.Title); //TODO: more, but check if the entries are present in the beatmap } catch (NotImplementedException e) { Assert.Equal("Hold notes are not yet parsed.", e.Message); //Unexpected exception thrown } } }