public RepeatEndBegin(RepeatEnd repeatEnd, RepeatBegin repeatBegin) : base() { M.Assert(repeatEnd.PositionInMeasure == repeatBegin.PositionInMeasure); PositionInMeasure = repeatEnd.PositionInMeasure; Times = repeatEnd.Times; }
public List <List <IUniqueDef> > GetGlobalIUDsPerMeasure() { var rval = new List <List <IUniqueDef> >(); for (var measureIndex = 0; measureIndex < GlobalMeasures.Count; measureIndex++) { List <IUniqueDef> measureList = new List <IUniqueDef>(); GlobalDirections globalDirections = GlobalMeasures[measureIndex].GlobalDirections; if (globalDirections != null) { var components = globalDirections.Components; KeySignature keySignature = components.Find(x => x is KeySignature) as KeySignature; if (keySignature != null) { measureList.Add(keySignature); } TimeSignature timeSignature = components.Find(x => x is TimeSignature) as TimeSignature; if (timeSignature != null) { measureList.Add(timeSignature); } RepeatBegin repeatBegin = components.Find(x => x is RepeatBegin) as RepeatBegin; if (repeatBegin != null) { measureList.Add(repeatBegin); } RepeatEnd repeatEnd = components.Find(x => x is RepeatEnd) as RepeatEnd; if (repeatEnd != null) { measureList.Add(repeatEnd); } Segno segno = components.Find(x => x is Segno) as Segno; if (segno != null) { measureList.Add(segno); } Jump jump = components.Find(x => x is Jump) as Jump; if (jump != null) { measureList.Add(jump); } Fine fine = components.Find(x => x is Fine) as Fine; if (fine != null) { measureList.Add(fine); } } rval.Add(measureList); } return(rval); }
// returns either a RepeatBegin or RepeatEnd. private Repeat GetRepeat(XmlReader r) { M.Assert(r.Name == "cresc"); bool? IsBegin = null; string Times = null; // when null, this defaults to 0 for RepeatBegin, and measure duration (= current time signature) for RepeatEnd. PositionInMeasure PositionInMeasure = null; int count = r.AttributeCount; for (int i = 0; i < count; i++) { r.MoveToAttribute(i); switch (r.Name) { case "type": { switch (r.Value) { case "start": IsBegin = true; break; case "end": IsBegin = false; break; default: M.ThrowError("Unknown repeat type."); break; } break; } case "times": { M.Assert(int.TryParse(r.Value, out _)); Times = r.Value; break; } case "location": { PositionInMeasure = new PositionInMeasure(r.Value); break; } default: M.ThrowError("Unknown repeat attribute."); break; } } // r.Name is now the name of the last repeat attribute that has been read. Repeat rval = null; switch (IsBegin) { case true: { rval = new RepeatBegin(PositionInMeasure); break; } case false: { rval = new RepeatEnd(PositionInMeasure, Times); break; } default: // null { M.ThrowError("Undefined repeat type."); break; } } return(rval); }