Esempio n. 1
0
        public static Barline CreateBarline(BarlineProperties bi)
        {
            ObjectFactory factory = new ObjectFactory();
            Barline       barline = factory.createBarline();

            //create an ending
            if (bi.EndingValue != "")
            {
                Ending ending = factory.createEnding();
                ending.setType(StartStopDiscontinue.fromValue(bi.EndingType));
                ending.setValue(bi.EndingValue);
                barline.setEnding(ending);
            }

            //create a repeat
            if (bi.RepeatTimes != "")
            {
                Repeat repeat = factory.createRepeat();
                repeat.setTimes(new BigInteger(bi.RepeatTimes));
                repeat.setDirection(BackwardForward.fromValue(bi.RepeatDirection));
                barline.setRepeat(repeat);
            }

            //set bar line location
            if (bi.Location != "")
            {
                barline.setLocation(RightLeftMiddle.fromValue(bi.Location));
            }

            return(barline);
        }
Esempio n. 2
0
 //Read the barline
 public static BarlineProperties ReadBarline(int barnumber, ScorePartwise.Part.Measure measure)
 {
     if (getbarindex(barnumber, measure) != -1)
     {
         Barline           barline = (Barline)measure.getNoteOrBackupOrForward().get(getbarindex(barnumber, measure));
         BarlineProperties barprop = new BarlineProperties();
         if (barline.getEnding() != null)
         {
             barprop.EndingType  = barline.getEnding().getType().value();
             barprop.EndingValue = barline.getEnding().getValue();
         }
         if (barline.getRepeat() != null)
         {
             barprop.RepeatTimes     = barline.getRepeat().getTimes().intValue().ToString();
             barprop.RepeatDirection = barline.getRepeat().getDirection().value();
         }
         barprop.Location = barline.getLocation().value();
         return(barprop);
     }
     return(null);
 }