Example #1
0
        public IEnumerable <T> EnumerateAffectingRange(Util.TimeRange timeRange)
        {
            T   lastItem = default(T);
            var gotFirst = false;

            foreach (var item in this.internalList)
            {
                var itemTime = this.getTimeFunc(item);
                if (timeRange.Overlaps(itemTime))
                {
                    if (!gotFirst)
                    {
                        gotFirst = true;
                        if (itemTime > timeRange.Start)
                        {
                            yield return(lastItem);
                        }
                    }
                    yield return(item);
                }

                if (itemTime <= timeRange.Start)
                {
                    lastItem = item;
                }
            }

            if (!gotFirst)
            {
                yield return(lastItem);
            }
        }
Example #2
0
 public IEnumerable <T> EnumerateOverlappingRange(Util.TimeRange timeRange)
 {
     foreach (var item in this.internalList)
     {
         if (timeRange.Overlaps(this.getTimeFunc(item)))
         {
             yield return(item);
         }
     }
 }
Example #3
0
        public void CutRange(Util.TimeRange timeRange)
        {
            foreach (var track in this.tracks)
            {
                track.CutRange(timeRange);
            }

            this.sectionBreaks.RemoveAll(sb => timeRange.Overlaps(sb.time));
            foreach (var sectionBreak in this.sectionBreaks.Clone())
            {
                if (sectionBreak.time >= timeRange.Start)
                {
                    this.RemoveSectionBreak(sectionBreak);
                    sectionBreak.time -= timeRange.Duration;
                    this.InsertSectionBreak(sectionBreak);
                }
            }

            this.keyChanges.RemoveAll(kc => timeRange.Overlaps(kc.time));
            foreach (var keyChange in this.keyChanges.Clone())
            {
                if (keyChange.time >= timeRange.Start)
                {
                    this.RemoveKeyChange(keyChange);
                    keyChange.time -= timeRange.Duration;
                    this.InsertKeyChange(keyChange);
                }
            }

            this.meterChanges.RemoveAll(mc => timeRange.Overlaps(mc.time));
            foreach (var meterChange in this.meterChanges.Clone())
            {
                if (meterChange.time >= timeRange.Start)
                {
                    this.RemoveMeterChange(meterChange);
                    meterChange.time -= timeRange.Duration;
                    this.InsertMeterChange(meterChange);
                }
            }

            this.length -= timeRange.Duration;
        }
Example #4
0
 public void RemoveOverlappingRange(Util.TimeRange timeRange)
 {
     internalList.RemoveAll(item => timeRange.Overlaps(this.getTimeFunc(item)));
 }