private Lyric createDefaultLyric(string text, string[] ruby, string[] romaji, string translate) { var startTime = Time.Current; const double duration = 1000000; using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream)) using (var reader = new LineBufferedReader(stream)) { writer.WriteLine("karaoke file format v1"); writer.WriteLine("[HitObjects]"); writer.WriteLine(text); ruby?.ForEach(x => writer.WriteLine(x)); romaji?.ForEach(x => writer.WriteLine(x)); writer.WriteLine("end"); writer.Flush(); stream.Position = 0; var lyric = new KaraokeLegacyBeatmapDecoder().Decode(reader).HitObjects.OfType <Lyric>().FirstOrDefault(); // Check is not null if (lyric == null) { throw new ArgumentNullException(); } // Apply property lyric.StartTime = startTime; lyric.Duration = duration; // todo : implementation var defaultLanguage = new CultureInfo("en-US"); lyric.Translates.Add(defaultLanguage, translate); lyric.TimeTags = TimeTagsUtils.ToTimeTagList(new Dictionary <TextIndex, double> { { new TextIndex(0), startTime }, { new TextIndex(4), startTime + duration }, }); return(lyric); } }
public void TestDecodeNote() { using (var resStream = TestResources.OpenBeatmapResource("karaoke-note-samples")) using (var stream = new LineBufferedReader(resStream)) { // Create karaoke beatmap decoder var lrcDecoder = new KaraokeLegacyBeatmapDecoder(); var beatmap = lrcDecoder.Decode(stream); // Get notes var notes = beatmap.HitObjects.OfType <Note>().ToList(); testNote("か", 1, note: notes[0]); testNote("ら", 2, true, notes[1]); testNote("お", 3, note: notes[2]); testNote("け", 3, true, notes[3]); testNote("け", 4, note: notes[4]); } }
public void TestDecodeStyle() { using (var resStream = TestResources.OpenBeatmapResource("karaoke-style-samples")) using (var stream = new LineBufferedReader(resStream)) { // Create karaoke beatmap decoder var lrcDecoder = new KaraokeLegacyBeatmapDecoder(); var beatmap = lrcDecoder.Decode(stream); // Get lyric var lyric = beatmap.HitObjects.OfType <LyricLine>().FirstOrDefault(); // Check is not null Assert.IsTrue(lyric != null); // Check layout and font index Assert.AreEqual(lyric.LayoutIndex, 2); Assert.AreEqual(lyric.FontIndex, 3); } }
private LyricLine createDefaultLyricLine(string text, string[] ruby, string[] romaji, string translate) { var startTime = Time.Current; const double duration = 1000000; using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream)) using (var reader = new LineBufferedReader(stream)) { writer.WriteLine("karaoke file format v1"); writer.WriteLine("[HitObjects]"); writer.WriteLine(text); ruby?.ForEach(x => writer.WriteLine(x)); romaji?.ForEach(x => writer.WriteLine(x)); writer.WriteLine("end"); writer.Flush(); stream.Position = 0; var lyric = new KaraokeLegacyBeatmapDecoder().Decode(reader).HitObjects.OfType <LyricLine>().FirstOrDefault(); // Check is not null Assert.IsTrue(lyric != null); // Apply property lyric.StartTime = startTime; lyric.Duration = duration; lyric.TranslateText = translate; lyric.TimeTags = new Dictionary <TimeTagIndex, double> { { new TimeTagIndex(0), startTime }, { new TimeTagIndex(4), startTime + duration }, }; return(lyric); } }
public KaraokeDifficultyCalculatorTest() { // It's a tricky to let osu! to read karaoke testing beatmap KaraokeLegacyBeatmapDecoder.Register(); }
public KaraokeBeatmapConversionTest() { // It's a tricky to let osu! to read karaoke testing beatmap KaraokeLegacyBeatmapDecoder.Register(); }
public KaraokeRuleset() { // It's a tricky to let osu! to read karaoke testing beatmap KaraokeLegacyBeatmapDecoder.Register(); }
public TestSceneLyricEditorScreen() { // It's a tricky to let osu! to read karaoke testing beatmap KaraokeLegacyBeatmapDecoder.Register(); }