public void TestMethod1() { var f = new SheetReaderFactory(); var reader = f.GetReader("hallo.mid"); Assert.IsNotNull(reader); }
public async Task TestLy() { var writerFactory = new SheetWriterFactory(); var writerExt = writerFactory.GetAllSupportedExtension(); var readerFactory = new SheetReaderFactory(); var readerExt = readerFactory.GetAllSupportedExtension(); var reader = readerFactory.GetReader("../../../DPA_Musicsheets/Files/Twee-emmertjes-water-halen.ly"); //reader.SetFilePath("../../../DPA_Musicsheets/Files/Alle-eendjes-zwemmen-in-het-water.ly"); reader.SetFilePath("../../../DPA_Musicsheets/Files/Twee-emmertjes-water-halen.ly"); var resultA = await reader.ReadFromFileAsync(); var resultB = await reader.ReadFromFileAsync(); var writerA = writerFactory.GetWriter("hallo.ly"); var strResultA = await writerA.WriteToString(resultA); var strResultB = await writerA.WriteToString(resultB); var nothing = string.Empty; }
async public Task TextChanged(string lilypondText) { var sheetReaderFactory = new SheetReaderFactory(); var sheetReader = sheetReaderFactory.GetReader(".ly"); try { var sheet = await sheetReader.ReadFromStringAsync(lilypondText); var converter = new SheetToWPFConverter(); WPFStaffs.Clear(); WPFStaffs.AddRange(converter.ConvertSheet(sheet)); WPFStaffsChanged?.Invoke(this, new WPFStaffsEventArgs() { Symbols = WPFStaffs }); MidiSequence = GetSequenceFromWPFStaffs(); MidiSequenceChanged?.Invoke(this, new MidiSequenceEventArgs() { MidiSequence = MidiSequence }); } catch (Exception) { Messenger.Default.Send(new CurrentStateMessage() { State = "Error parsing lilypond" }); } }
private int _beatsPerBar; // Aantal beatnotes per maat. async public Task OpenFile(string fileName) { var sheetReaderFactory = new SheetReaderFactory(); var sheetWriterFactory = new SheetWriterFactory(); var sheetReader = sheetReaderFactory.GetReader(fileName); var converter = new SheetToWPFConverter(); var writer = sheetWriterFactory.GetWriter(".ly"); var sheet = await sheetReader.ReadFromFileAsync(); WPFStaffs.Clear(); WPFStaffs.AddRange(converter.ConvertSheet(sheet)); WPFStaffsChanged?.Invoke(this, new WPFStaffsEventArgs() { Symbols = WPFStaffs }); LilypondTextChanged?.Invoke(this, new LilypondEventArgs { LilypondText = await writer.WriteToString(sheet) }); MidiSequence = GetSequenceFromWPFStaffs(); MidiSequenceChanged?.Invoke(this, new MidiSequenceEventArgs() { MidiSequence = MidiSequence }); }
public async Task TestFile() { var f = new SheetReaderFactory(); var reader = f.GetReader("../../../DPA_Musicsheets/Files/Alle-eendjes-zwemmen-in-het-water.mid"); await reader.ReadFromFileAsync(); Assert.IsTrue(true); }
public void TestCustomTypes() { var asm = typeof(ReaderTests).Assembly; var f = new SheetReaderFactory(asm); var reader = f.GetReader("hallo.mid"); Assert.IsTrue(reader is MockReader); }
public void SetText(string text) { _text = text; var factory = new SheetReaderFactory(); var writer = factory.GetReader(".ly"); try { _musicSheet = writer.ReadFromStringAsync(_text).Result; } catch (Exception) { } }