Beispiel #1
0
        private SectionsQueryOutput <T> _create_output_for_shape <T>(short shapeid, List <SectionInfo> section_infos, VisioAutomation.Utilities.ArraySegmentReader <T> segReader)
        {
            int original_seg_size = segReader.Count;

            int results_cell_count = 0;

            if (section_infos != null)
            {
                results_cell_count += section_infos.Select(x => x.RowCount * x.Query.Columns.Count).Sum();
            }

            List <SectionQueryOutput <T> > sections = null;

            if (section_infos != null)
            {
                sections = new List <SectionQueryOutput <T> >(section_infos.Count);
                foreach (var section_info in section_infos)
                {
                    var section_output = new SectionQueryOutput <T>(section_info.RowCount, section_info.Query.SectionIndex);

                    int num_cols = section_info.Query.Columns.Count;
                    foreach (int row_index in section_info.RowIndexes)
                    {
                        var segment     = segReader.GetNextSegment(num_cols);
                        var sec_res_row = new SectionQueryOutputRow <T>(segment, section_info.Query.SectionIndex, row_index);
                        section_output.Rows.Add(sec_res_row);
                    }

                    sections.Add(section_output);
                }
            }

            var output = new SectionsQueryOutput <T>(shapeid, results_cell_count, sections);

            int final_seg_size = segReader.Count;

            if ((final_seg_size - original_seg_size) != output.__totalcellcount)
            {
                throw new VisioAutomation.Exceptions.InternalAssertionException("Unexpected cursor");
            }

            return(output);
        }
 internal void Add(SectionQueryOutputRow <T> r)
 {
     this._rows.Add(r);
 }