public Intervals Periods; //perion IntervalsConfig checkEmpty(bool isSave) { if (Scores == null || Scores.Items == null || Scores.Items.Length < 2) Scores = isSave ? new Intervals() : Intervals.ScoreDefault(); if (Secs == null || Secs.Items == null || Secs.Items.Length < 2) Secs = isSave ? new Intervals() : Intervals.ElapsedDefault(); if (Periods == null || Periods.Items == null || Periods.Items.Length < 2) Periods = isSave ? new Intervals() : Intervals.PeriodDefault(); return this; }
public static Intervals ScoreDefault() { var res = new Intervals { Items = new Interval[] { new Interval() {From=99}, new Interval() {From=97}, new Interval() {From=94}, new Interval() {From=89}, new Interval() {From=82}, new Interval() {From=70}, new Interval() {From=56}, new Interval() {From=35}, new Interval() {From=-1}, } }; return res; }
public static Intervals ElapsedDefault() { string[] secYearDefault = new string[] { "4.00:00:00", "2.20:00:00", "2.00:00:00", "1.10:00:00", "1.00:00:00", "17:00:0", "12:00:00", "08:30:00", "06:00:00", "04:00:00", "03:00:00", "02:00:00", "01:30:00", "01:00:00", "00:45:00", "00:30:00", "00:20:00", "00:15:00", "00:10:00", "00:00:00" }; var res = new Intervals() { Items = secYearDefault.Select((s, idx) => new Interval() { From = (int)TimeSpan.Parse(s).TotalSeconds /*, Title = s + " - " + (idx == 0 ? "" : secYearDefault[idx - 1])*/ }).ToArray() }; return res; }
public static Intervals PeriodDefault() { var res = new Intervals { Items = Enumerable.Range(0, 12).Select(y => new Interval() { From = MonthCode(1, 2013 + y), }).ToArray() }; return res; }