//Reads the top level score static public ScoreProperties ReadScore(ScorePartwise scorePartwise) { //get the top level properties of the score ScoreProperties i = new ScoreProperties(); if (scorePartwise.getWork() != null) { i.WorkTitle = scorePartwise.getWork().getWorkTitle(); } if (scorePartwise.getMovementTitle() != null) { i.MovementTitle = scorePartwise.getMovementTitle(); } if (scorePartwise.getIdentification().getEncoding().getEncodingDateOrEncoderOrSoftware().get(0) != null) { javax.xml.bind.JAXBElement x = (javax.xml.bind.JAXBElement)scorePartwise.getIdentification().getEncoding().getEncodingDateOrEncoderOrSoftware().get(0); i.EncodingSoftware = x.getValue().ToString(); } if (scorePartwise.getCredit().size() > 0) { Credit credit = (Credit)scorePartwise.getCredit().get(0); if (credit.getCreditTypeOrLinkOrBookmark().get(0) is FormattedText) { FormattedText ft = (FormattedText)credit.getCreditTypeOrLinkOrBookmark().get(0); i.CreditWords = ft.getValue(); } } PartList partlist = scorePartwise.getPartList(); if (partlist.getPartGroupOrScorePart().get(0) is ScorePart) { ScorePart scorepart = (ScorePart)partlist.getPartGroupOrScorePart().get(0); i.ScorePartID = scorepart.getId(); i.PartDisplayName = scorepart.getPartName().getValue(); i.PartAbbreviation = scorepart.getPartAbbreviation() is PartName?scorepart.getPartAbbreviation().getValue() : ""; ScoreInstrument scoreinstrument = (ScoreInstrument)scorepart.getScoreInstrument().get(0); i.InstrumentID = scoreinstrument.getId(); i.InstrumentName = scoreinstrument.getInstrumentName(); if (scorepart.getMidiDeviceAndMidiInstrument().get(0) is MidiInstrument) { MidiInstrument midiinstrument = (MidiInstrument)scorepart.getMidiDeviceAndMidiInstrument().get(0); i.MidiChannel = midiinstrument.getMidiChannel(); i.MidiProgram = midiinstrument.getMidiProgram(); } } if (scorePartwise.getPart().size() > 0) { i.Part = (ScorePartwise.Part)scorePartwise.getPart().get(0); } return(i); }