Пример #1
0
        private QueryOutput <T> _create_output_for_shape <T>(short shapeid, List <SectionInfo> section_infos, VisioAutomation.Utilities.ArraySegmentReader <T> segReader)
        {
            int original_seg_size = segReader.Count;

            var output = new QueryOutput <T>(shapeid);

            // Figure out the total cell count for this shape
            output.TotalCellCount = this.Cells.Count;
            if (section_infos != null)
            {
                output.TotalCellCount += section_infos.Select(x => x.RowCount * x.SubQuery.Columns.Count).Sum();
            }

            // First Copy the Query Cell Values into the output
            output.Cells = segReader.GetNextSegment(this.Cells.Count);;

            // Now copy the Section values over
            if (section_infos != null)
            {
                output.Sections = new List <SubQueryOutput <T> >(section_infos.Count);
                foreach (var section_info in section_infos)
                {
                    var subquery_output = new SubQueryOutput <T>(section_info.RowCount, section_info.SubQuery.SectionIndex);

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

                    output.Sections.Add(subquery_output);
                }
            }

            int final_seg_size = segReader.Count;

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

            return(output);
        }
Пример #2
0
 internal void Add(SubQueryOutputRow <T> r)
 {
     this._rows.Add(r);
 }