/// <summary> /// Reads Mei-File and generates sequences per panel. /// </summary> /// <param name="_filedir">Path to Mei file</param> /// <returns>List of sequence objects</returns> public static List <Sequence> GetSequences(string _filedir) { MeiDocument doc = MeiImport.ImportDocument(_filedir); MeiElement root = doc.Root; List <Sequence> sequences = new List <Sequence>(); string piece; //Get name of piece try { piece = root.Element <MeiHead>().Element <FileDesc>().Descendants <Title>().FirstOrDefault().Value; } catch { string[] splitUri = doc.BaseUri.Split('/'); piece = splitUri[splitUri.Length - 1]; } foreach (Panel panel in root.Descendants <Panel>()) { List <Sequence> sequencesPerPart = SequenceHandler.GetPreConversionSequence(panel, piece); foreach (Sequence stateSequence in sequencesPerPart) { sequences.Add(stateSequence); } } return(sequences); }
public void TestIDHandling() { XElement testelement = new XElement("ligature", new XElement("note", new XAttribute("label", "test")), new XAttribute(XNamespace.Xml + "id", "t-123")); MeiElement test = MeiImport.XmlToMei(testelement); Assert.AreEqual(test.GetId(), "t-123"); Assert.IsNotNull(test.Element <Note>().GetId()); }