public static Schedule[] GetSchedules(string output_of___show_rebuild___show_verify___cx_show_rebuild) { var lines = output_of___show_rebuild___show_verify___cx_show_rebuild.SplitOnNewLines(); var i = 0; while (i < lines.Length && lines[i].IndexOf("--") == NotFound) { i++; } i++; int db = 0, si = i; while (i < lines.Length) { if (lines[i] != String.Empty) { db++; } i++; } i = si; var result = new Schedule[db]; var j = 0; while (j < db) { var values = ElliminateCharsAndCreateArray(lines[i++], '\t'); if (values.Length <= 3) { continue; } var slot = Convert.ToInt32(values[0]); var day = new DayConverter().GetDayFromString(values[1]); var hour = values[2].ConvertToTimeSpan(); if (values.Length > 4) { var duration = values[3].ConvertToTimeSpan(); var status = values[4]; result[j++] = new Schedule(slot, day, hour, duration, status); } else { var status = values[3]; result[j++] = new Schedule(slot, day, hour, null, status); } } return(result); }
public static SelfTest[] GetSelfTests(string output_of___show_selftest) { var lines = output_of___show_selftest.SplitOnNewLines(); var i = 0; while (i < lines.Length && lines[i].IndexOf("--") == NotFound) { i++; } i++; int db = 0, si = i; while (i < lines.Length) { if (lines[i] != String.Empty) { db++; } i++; } i = si; var result = new SelfTest[db]; var j = 0; while (j < db) { var values = ElliminateCharsAndCreateArray(lines[i++], '\t'); var slot = Convert.ToInt32(values[0]); var day = new DayConverter().GetDayFromString(values[1]); var hour = values[2].ConvertToTimeSpan(); var UDMA = values[3]; string SMART = null; if (values.Length > 4) { SMART = values[4]; } result[j++] = new SelfTest(slot, day.Value, hour.Value, UDMA, SMART); } return(result); }