Пример #1
0
        private static RegionDef FindBaseRegionDef(IReadOnlyList <RegionDef> regionDefs, char c)
        {
            RegionDef rval = null;

            foreach (RegionDef rd in regionDefs)
            {
                if (string.Compare(rd.name, c.ToString()) == 0)
                {
                    rval = rd;
                    break;
                }
            }
            return(rval);
        }
Пример #2
0
        /// <summary>
        /// returns the regionDef sequence to be played, with each regionDef having a unique name.
        /// </summary>
        /// <param name="regionDefs"></param>
        /// <param name="regionSequence"></param>
        /// <param name="uniqueNames"></param>
        /// <returns></returns>
        private static List <RegionDef> GetRegionDefSequence(IReadOnlyList <RegionDef> regionDefs, string regionSequence, List <string> uniqueNames)
        {
            List <RegionDef> regionDefSeq = new List <RegionDef>();

            for (int i = 0; i < regionSequence.Length; ++i)
            {
                string    uniqueName      = uniqueNames[i];
                RegionDef brd             = FindBaseRegionDef(regionDefs, regionSequence[i]);
                var       startBarData    = (index : brd.startBarlineIndex, msPosition : brd.startBarlineMsPosInScore);
                var       endBarlineData  = (index : brd.endBarlineIndex, msPosition : brd.endBarlineMsPosInScore);
                RegionDef uniqueRegionDef = new RegionDef(uniqueName, startBarData, endBarlineData);
                regionDefSeq.Add(uniqueRegionDef);
            }
            return(regionDefSeq);
        }