private SectionQueryShapeResults <T> _create_output_for_shape <T>(short shapeid, ShapeCache shapecacheitems, VisioAutomation.Collections.ArraySegmentEnumerator <T> segreader) { int original_seg_count = segreader.Count; if (shapecacheitems == null) { throw new VisioAutomation.Exceptions.InternalAssertionException(); } var results_rows = new List <SectionShapeRows <T> >(shapecacheitems.Count); foreach (var shapecacheitem in shapecacheitems) { var secindex = shapecacheitem.SectionQueryColumns.SectionIndex; var sectionshaperows = new SectionShapeRows <T>(shapecacheitem.RowCount, shapeid, secindex); results_rows.Add(sectionshaperows); int num_cols = shapecacheitem.SectionQueryColumns.Count; foreach (int row_index in Enumerable.Range(0, shapecacheitem.RowCount)) { var cells = segreader.GetNextSegment(num_cols); var sec_res_row = new Row <T>(shapeid, secindex, cells); sectionshaperows.Add(sec_res_row); } } var results = new SectionQueryShapeResults <T>(shapeid, results_rows); // the difference in the segment count must match the total number of output cells int final_seg_count = segreader.Count; int segment_count_delta = final_seg_count - original_seg_count; int total_cell_count = shapecacheitems.CountCells(); if (segment_count_delta != total_cell_count) { throw new Exceptions.InternalAssertionException("Unexpected cursor"); } return(results); }
private Row <T> _shapedata_to_row <T>(short shapeid, VisioAutomation.Collections.ArraySegmentEnumerator <T> seg_enumerator) { // From the reader, pull as many cells as there are columns int numcols = this.Columns.Count; int original_seg_size = seg_enumerator.Count; var cells = seg_enumerator.GetNextSegment(numcols); // verify that nothing strange has happened int final_seg_size = seg_enumerator.Count; if ((final_seg_size - original_seg_size) != numcols) { throw new Exceptions.InternalAssertionException("Unexpected cursor"); } var sec_index = IVisio.VisSectionIndices.visSectionInval; var row = new Row <T>(shapeid, sec_index, cells); return(row); }