using System; using System.Collections.Generic; using System.Linq; namespace CPF.ReoGrid { public class AutoFillSequence { public AutoFillSequence(IList values) { bool flag = values == null || values.Count == 0; if (flag) { throw new ArgumentException("AutoFillSequence requires at least one value."); } int i = 0; IAutoFillSectionEntry entry = AutoFillSectionEntryFactory.Create(values[i++]); AutoFillSection autoFillSection = new AutoFillSection(entry); this.sections.Add(autoFillSection); while (i < values.Count) { entry = AutoFillSectionEntryFactory.Create(values[i++]); bool flag2 = !autoFillSection.TryAdd(entry); if (flag2) { autoFillSection = new AutoFillSection(entry); this.sections.Add(autoFillSection); } } } public object[] Extrapolate(int count) { List list = new List(count); int num = 0; while (list.Count < count) { num++; foreach (AutoFillSection autoFillSection in this.sections) { object[] values = autoFillSection.GetValues(num); list.AddRange(values.Take(count - list.Count)); } } return list.ToArray(); } private readonly List sections = new List(); } }