internal Score LoadLyricsTemplateFile() { const string path = "TestFiles/GuitarPro6/LyricsTemplate.gpx"; var buffer = ByteBuffer.FromBuffer(File.ReadAllBytes(path)); var importer = new GpxImporter(); importer.Init(buffer); return(importer.ReadScore()); }
protected Score TestReferenceFile(string file, string renderLayout = "page", bool renderAllTracks = false) { var gpxImporter = new GpxImporter(); var sw = new Stopwatch(); try { sw.Restart(); var buffer = File.ReadAllBytes(file); var importer = PrepareImporterWithBytes(buffer); var score = importer.ReadScore(); sw.Stop(); if (renderAllTracks) { Render(score.Tracks.ToArray(), Path.ChangeExtension(file, ".all.png"), renderLayout); } else { foreach (var track in score.Tracks) { Render(new[] { track }, Path.ChangeExtension(file, "." + track.Index + ".png"), renderLayout); } } var reference = Path.ChangeExtension(file, ".gpx"); Score referenceScore; if (!File.Exists(reference)) { Assert.Inconclusive(); } gpxImporter.Init(ByteBuffer.FromBuffer(File.ReadAllBytes(reference))); referenceScore = gpxImporter.ReadScore(); AreEqual(referenceScore, score); return(score); } catch (UnsupportedFormatException e) { Assert.Fail("Failed to load file {0}: {1}", file, e); throw; } }