7 changed files with 405 additions and 7 deletions
@ -0,0 +1,90 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 13.02.2012 |
||||||
|
* Time: 19:46 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Collections.ObjectModel; |
||||||
|
using System.IO; |
||||||
|
using System.Reflection; |
||||||
|
using System.Windows; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
using ICSharpCode.CodeQuality.Engine.Dom; |
||||||
|
using ICSharpCode.Reports.Core; |
||||||
|
using ICSharpCode.Reports.Core.Exporter.ExportRenderer; |
||||||
|
using ICSharpCode.Reports.Core.WpfReportViewer; |
||||||
|
using Microsoft.Win32; |
||||||
|
|
||||||
|
namespace ICSharpCode.CodeQuality.Reporting |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of Overview.
|
||||||
|
/// </summary>
|
||||||
|
public class OverviewReport |
||||||
|
{ |
||||||
|
List<string> fileNames; |
||||||
|
public OverviewReport(List<string> fileNames) |
||||||
|
{ |
||||||
|
if (fileNames.Count > 0) |
||||||
|
{ |
||||||
|
this.fileNames = new List<string>(); |
||||||
|
this.fileNames.AddRange(fileNames); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public IReportCreator Run(ReadOnlyCollection<AssemblyNode> list) |
||||||
|
{ |
||||||
|
|
||||||
|
var r = from c in list |
||||||
|
select new OverviewViewModel { Node = c}; |
||||||
|
|
||||||
|
|
||||||
|
Uri uri = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase); |
||||||
|
var fullname = uri.LocalPath; |
||||||
|
var reportFileName = Path.GetDirectoryName(fullname) + Path.DirectorySeparatorChar + "Reporting" + Path.DirectorySeparatorChar + "Report1.srd"; |
||||||
|
|
||||||
|
var model = ReportEngine.LoadReportModel(reportFileName); |
||||||
|
var p = new ReportParameters(); |
||||||
|
p.Parameters.Add(new BasicParameter ("param1",fileNames[0])); |
||||||
|
|
||||||
|
ReportSettings = model.ReportSettings; |
||||||
|
|
||||||
|
|
||||||
|
IReportCreator creator = ReportEngine.CreatePageBuilder(model,r.ToList(),p); |
||||||
|
creator.BuildExportList(); |
||||||
|
return creator; |
||||||
|
} |
||||||
|
|
||||||
|
public ReportSettings ReportSettings {get;private set;} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
internal class OverviewViewModel |
||||||
|
{ |
||||||
|
public OverviewViewModel () |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public AssemblyNode Node {get;set;} |
||||||
|
|
||||||
|
public string Name |
||||||
|
{ |
||||||
|
get {return Node.Name;} |
||||||
|
} |
||||||
|
|
||||||
|
public int ChildCount |
||||||
|
{ |
||||||
|
get { |
||||||
|
|
||||||
|
return Node.Children.Count;} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,273 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<ReportModel> |
||||||
|
<ReportSettings> |
||||||
|
<ReportSettings> |
||||||
|
<ReportName>Overview</ReportName> |
||||||
|
<ReportType>DataReport</ReportType> |
||||||
|
<BottomMargin>50</BottomMargin> |
||||||
|
<TopMargin>50</TopMargin> |
||||||
|
<LeftMargin>50</LeftMargin> |
||||||
|
<RightMargin>50</RightMargin> |
||||||
|
<PageSize>827, 1169</PageSize> |
||||||
|
<Landscape>False</Landscape> |
||||||
|
<GraphicsUnit>Millimeter</GraphicsUnit> |
||||||
|
<Padding>5, 5, 5, 5</Padding> |
||||||
|
<AvailableFieldsCollection /> |
||||||
|
<SortColumnsCollection /> |
||||||
|
<GroupColumnsCollection /> |
||||||
|
<ParameterCollection> |
||||||
|
<BasicParameter> |
||||||
|
<ParameterName>param1</ParameterName> |
||||||
|
<Type>System.String</Type> |
||||||
|
</BasicParameter> |
||||||
|
</ParameterCollection> |
||||||
|
<SqlParameters /> |
||||||
|
<ConnectionString /> |
||||||
|
<CommandText /> |
||||||
|
<CommandType>Text</CommandType> |
||||||
|
<DataModel>PushData</DataModel> |
||||||
|
<NoDataMessage>No Data for this Report</NoDataMessage> |
||||||
|
<DefaultFont>Microsoft Sans Serif, 10pt</DefaultFont> |
||||||
|
<UseStandardPrinter>True</UseStandardPrinter> |
||||||
|
</ReportSettings> |
||||||
|
</ReportSettings> |
||||||
|
<SectionCollection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 50</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>False</VisibleInReport> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>130, 32</Location> |
||||||
|
<Size>542, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Segoe UI, 9pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>=Parameters!param1</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>ControlText</ForeColor> |
||||||
|
<Name>Param1</Name> |
||||||
|
</BaseTextItem> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>18, 32</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Segoe UI, 9pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>AssemblyAnalyzer</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>ControlText</ForeColor> |
||||||
|
<Name>BaseTextItem2147483646</Name> |
||||||
|
</BaseTextItem> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>313, 5</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Microsoft Sans Serif, 10pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<DataType>System.String</DataType> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>Overview Report</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<Name>Overview</Name> |
||||||
|
</BaseTextItem> |
||||||
|
</Items> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportHeader</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 125</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>False</VisibleInReport> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items> |
||||||
|
<BaseRowItem> |
||||||
|
<Location>14, 16</Location> |
||||||
|
<Size>658, 30</Size> |
||||||
|
<BackColor>LightGray</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<ForeColor>ControlText</ForeColor> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Items> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>363, 7</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Segoe UI, 9pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>Children</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>ControlText</ForeColor> |
||||||
|
<Name>BaseTextItem2147483645</Name> |
||||||
|
</BaseTextItem> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>4, 7</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Segoe UI, 9pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>Assembly:</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>ControlText</ForeColor> |
||||||
|
<Name>BaseTextItem2147483645</Name> |
||||||
|
</BaseTextItem> |
||||||
|
</Items> |
||||||
|
<AlternateBackColor /> |
||||||
|
<ChangeBackColorEveryNRow>0</ChangeBackColorEveryNRow> |
||||||
|
<Name>BaseRowItem2147483646</Name> |
||||||
|
</BaseRowItem> |
||||||
|
</Items> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportPageHeader</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 200</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>False</VisibleInReport> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items> |
||||||
|
<BaseRowItem> |
||||||
|
<Location>14, 14</Location> |
||||||
|
<Size>658, 30</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Items> |
||||||
|
<BaseDataItem> |
||||||
|
<Location>363, 4</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Segoe UI, 9pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>BaseDataItem2147483645</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<ColumnName>ChildCount</ColumnName> |
||||||
|
<Name>BaseDataItem2147483645</Name> |
||||||
|
</BaseDataItem> |
||||||
|
<BaseDataItem> |
||||||
|
<Location>3, 7</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Microsoft Sans Serif, 10pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>BaseDataItem1</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<ColumnName>Name</ColumnName> |
||||||
|
<Name>BaseDataItem1</Name> |
||||||
|
</BaseDataItem> |
||||||
|
</Items> |
||||||
|
<AlternateBackColor /> |
||||||
|
<ChangeBackColorEveryNRow>0</ChangeBackColorEveryNRow> |
||||||
|
<Name>BaseRowItem1</Name> |
||||||
|
</BaseRowItem> |
||||||
|
</Items> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportDetail</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 275</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>False</VisibleInReport> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items> |
||||||
|
<BaseTextItem> |
||||||
|
<Location>622, 5</Location> |
||||||
|
<Size>100, 20</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>True</VisibleInReport> |
||||||
|
<Font>Microsoft Sans Serif, 10pt</Font> |
||||||
|
<StringTrimming>None</StringTrimming> |
||||||
|
<ContentAlignment>TopLeft</ContentAlignment> |
||||||
|
<CanGrow>False</CanGrow> |
||||||
|
<CanShrink>False</CanShrink> |
||||||
|
<DataType>System.String</DataType> |
||||||
|
<RTL>No</RTL> |
||||||
|
<Text>=Globals!PageNumber</Text> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<ForeColor>Black</ForeColor> |
||||||
|
<Name>PageNumber1</Name> |
||||||
|
</BaseTextItem> |
||||||
|
</Items> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportPageFooter</Name> |
||||||
|
</BaseSection> |
||||||
|
<BaseSection> |
||||||
|
<Location>50, 350</Location> |
||||||
|
<Size>727, 60</Size> |
||||||
|
<BackColor>White</BackColor> |
||||||
|
<VisibleInReport>False</VisibleInReport> |
||||||
|
<SectionOffset>0</SectionOffset> |
||||||
|
<SectionMargin>0</SectionMargin> |
||||||
|
<DrawBorder>False</DrawBorder> |
||||||
|
<PageBreakAfter>False</PageBreakAfter> |
||||||
|
<Items /> |
||||||
|
<FrameColor>Black</FrameColor> |
||||||
|
<Name>ReportFooter</Name> |
||||||
|
</BaseSection> |
||||||
|
</SectionCollection> |
||||||
|
</ReportModel> |
||||||
Loading…
Reference in new issue