private void FillSplitSegments() { foreach (DataGridViewRow rows in this.segmentsGridView.Rows) { String segmentName = (rows.Cells[0].Value == null) ? "-" : rows.Cells[0].Value.ToString(); double splitTime = (rows.Cells[1].Value == null) ? 0.0 : FaceSplitUtils.TimeParse(rows.Cells[1].Value.ToString()); double segmentTime = (rows.Cells[2].Value == null) ? 0.0 : FaceSplitUtils.TimeParse(rows.Cells[2].Value.ToString()); double bestSegmentTime = (rows.Cells[3].Value == null) ? 0.0 : FaceSplitUtils.TimeParse(rows.Cells[3].Value.ToString()); this.split.Segments.Add(new Segment(segmentName, splitTime, segmentTime, bestSegmentTime)); } }
/// <summary> /// Get the list of splits time from the data grid view. /// </summary> /// <param name="splitsTime">The list of splits time to be fill.</param> private void FillSplitsTime(List <double> splitsTime) { foreach (DataGridViewRow rows in this.segmentsGridView.Rows) { String splitTimeString = (rows.Cells[1].Value == null) ? "" : rows.Cells[1].Value.ToString(); if (!String.IsNullOrEmpty(splitTimeString.Trim())) { splitsTime.Add(FaceSplitUtils.TimeParse(splitTimeString)); } else { splitsTime.Add(INVALID_VALUE); } } }
private void LoadFile(String fileName) { String[] lines = File.ReadAllLines(fileName); String runTitle = ""; String runGoal = ""; int runCount = 0; int runsCompleted = 0; String segmentName = ""; String segmentSplitTime = ""; String segmentTime = ""; String segmentBestTime = ""; List <Segment> segments = new List <Segment>(); try { runTitle = lines.ElementAt(0); runGoal = lines.ElementAt(1); runCount = Int32.Parse(lines.ElementAt(2)); runsCompleted = Int32.Parse(lines.ElementAt(3)); for (int i = 4; i < lines.Length; ++i) { segmentName = lines.ElementAt(i).Split('-').ElementAt(0); segmentSplitTime = lines.ElementAt(i).Split('-').ElementAt(1); segmentTime = lines.ElementAt(i).Split('-').ElementAt(2); segmentBestTime = lines.ElementAt(i).Split('-').ElementAt(3); segments.Add(new Segment(segmentName, FaceSplitUtils.TimeParse(segmentSplitTime), FaceSplitUtils.TimeParse(segmentTime), FaceSplitUtils.TimeParse(segmentBestTime))); } this.split = new Split(runTitle, runGoal, runCount, segments); this.split.RunsCompleted = runsCompleted; this.split.File = fileName; this.informations.Clear(); FillInformations(); CreateSegmentsRectangles(); this.displayMode = DisplayMode.SEGMENTS; } catch (FormatException fe) { MessageBox.Show("This file was not recognize as a FaceSplit split file."); } catch (IndexOutOfRangeException iore) { MessageBox.Show("This file was not recognize as a FaceSplit split file."); } }
private void FillSplitSegments() { foreach (DataGridViewRow rows in segmentsGridView.Rows) { string segmentName = (rows.Cells[SEGMENT_NAME_ROW].Value == null) ? "-" : rows.Cells[SEGMENT_NAME_ROW].Value.ToString(); double splitTime = (rows.Cells[SEGMENT_SPLIT_TIME_ROW].Value == null) ? 0.0 : FaceSplitUtils.TimeParse(rows.Cells[SEGMENT_SPLIT_TIME_ROW].Value.ToString()); double segmentTime = (rows.Cells[SEGMENT_TIME_ROW].Value == null) ? 0.0 : FaceSplitUtils.TimeParse(rows.Cells[SEGMENT_TIME_ROW].Value.ToString()); double bestSegmentTime = (rows.Cells[SEGMENT_BEST_TIME_ROW].Value == null) ? 0.0 : FaceSplitUtils.TimeParse(rows.Cells[SEGMENT_BEST_TIME_ROW].Value.ToString()); BitmapFile icon = icons.ElementAt(rows.Index); split.Segments.Add(new Segment(segmentName, splitTime, segmentTime, bestSegmentTime, icon)); } }