Browse Source

Added a new template for graphs from GraphSharp. Added new buttons for layouting. Replaced WPFExtension ZoomControl with ICSharpCode ZoomControl.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6037 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Tomáš Linhart 15 years ago
parent
commit
3b030c7398
  1. 17
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj
  2. 16
      src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.sln
  3. 290
      src/AddIns/Analysis/CodeQuality/Resources/GraphTemplate.xaml
  4. 21
      src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml
  5. 22
      src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs
  6. 6
      src/AddIns/Analysis/CodeQuality/Src/MetricsReader.cs

17
src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.csproj

@ -102,6 +102,10 @@ @@ -102,6 +102,10 @@
<Compile Include="Src\Method.cs" />
<Compile Include="Src\Namespace.cs" />
<Compile Include="Src\Type.cs" />
<Page Include="Resources\GraphTemplate.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Src\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -176,6 +180,19 @@ @@ -176,6 +180,19 @@
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>True</Private>
<EmbedInteropTypes>False</EmbedInteropTypes>
</ProjectReference>
<ProjectReference Include="..\..\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\WpfDesign.Designer.csproj">
<Project>{78CC29AC-CC79-4355-B1F2-97936DF198AC}</Project>
<Name>WpfDesign.Designer</Name>
<Private>True</Private>
<EmbedInteropTypes>False</EmbedInteropTypes>
</ProjectReference>
</ItemGroup>
<ItemGroup>

16
src/AddIns/Analysis/CodeQuality/CodeQualityAnalysis.sln

@ -9,6 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", @@ -9,6 +9,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.Presentation", "..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj", "{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.Designer", "..\..\DisplayBindings\WpfDesign\WpfDesign.Designer\Project\WpfDesign.Designer.csproj", "{78CC29AC-CC79-4355-B1F2-97936DF198AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Widgets", "..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj", "{8035765F-D51F-4A0C-A746-2FD100E19419}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -43,6 +47,18 @@ Global @@ -43,6 +47,18 @@ Global
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|Any CPU.Build.0 = Release|Any CPU
{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}.Release|x86.ActiveCfg = Release|Any CPU
{78CC29AC-CC79-4355-B1F2-97936DF198AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78CC29AC-CC79-4355-B1F2-97936DF198AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78CC29AC-CC79-4355-B1F2-97936DF198AC}.Debug|x86.ActiveCfg = Debug|Any CPU
{78CC29AC-CC79-4355-B1F2-97936DF198AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78CC29AC-CC79-4355-B1F2-97936DF198AC}.Release|Any CPU.Build.0 = Release|Any CPU
{78CC29AC-CC79-4355-B1F2-97936DF198AC}.Release|x86.ActiveCfg = Release|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|x86.ActiveCfg = Debug|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.Build.0 = Release|Any CPU
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

290
src/AddIns/Analysis/CodeQuality/Resources/GraphTemplate.xaml

@ -0,0 +1,290 @@ @@ -0,0 +1,290 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:GraphSharp_Controls="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
xmlns:Converters="clr-namespace:GraphSharp.Converters;assembly=GraphSharp.Controls"
xmlns:WPFExtensions_AttachedBehaviours="clr-namespace:WPFExtensions.AttachedBehaviours;assembly=WPFExtensions">
<Converters:EdgeRouteToPathConverter x:Key="routeToPathConverter" />
<SolidColorBrush x:Key="HighlightedVertexBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="HighlightedVertexBackgroundBrush" Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" />
<SolidColorBrush x:Key="HighlightedVertexForegroundBrush" Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}" />
<SolidColorBrush x:Key="SemiHighlightedSourceVertexBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="SemiHighlightedSourceVertexBackgroundBrush" Color="#FF1DBA00" />
<SolidColorBrush x:Key="SemiHighlightedTargetVertexBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="SemiHighlightedTargetVertexBackgroundBrush" Color="#FFD6A51C" />
<SolidColorBrush x:Key="HighlightedEdgeBrush" Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" />
<SolidColorBrush x:Key="SemiHighlightedInEdgeBrush" Color="#FF1DBA00" />
<SolidColorBrush x:Key="SemiHighlightedOutEdgeBrush" Color="#FFD6A51C" />
<!-- VERTEX CONTROL -->
<Style TargetType="{x:Type GraphSharp_Controls:VertexControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GraphSharp_Controls:VertexControl}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="10,10,10,10"
Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Vertex}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger" Value="{Binding Path=IsMouseOver, RelativeSource={RelativeSource Self}}"/>
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.IsDragEnabled" Value="True"/>
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.X" Value="{Binding Path=(GraphSharp_Controls:GraphCanvas.X), Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.Y" Value="{Binding Path=(GraphSharp_Controls:GraphCanvas.Y), Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>
<Setter Property="Background" Value="#FFE3E3E3"/>
<Setter Property="BorderThickness" Value="5,3,5,3"/>
<Setter Property="Padding" Value="10,5,10,5"/>
<Setter Property="BorderBrush" Value="#FF393939"/>
<Style.Triggers>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted" Value="True">
<Setter Property="BorderBrush" Value="{StaticResource HighlightedVertexBorderBrush}"/>
<Setter Property="Background" Value="{StaticResource HighlightedVertexBackgroundBrush}"/>
<Setter Property="Foreground" Value="{StaticResource HighlightedVertexForegroundBrush}"/>
</Trigger>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True">
<Setter Property="BorderBrush" Value="{StaticResource HighlightedVertexBorderBrush}"/>
<Setter Property="Background" Value="{StaticResource HighlightedVertexBackgroundBrush}"/>
<Setter Property="Foreground" Value="{StaticResource HighlightedVertexForegroundBrush}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True"/>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo" Value="Source"/>
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="{StaticResource SemiHighlightedSourceVertexBorderBrush}"/>
<Setter Property="Background" Value="{StaticResource SemiHighlightedSourceVertexBackgroundBrush}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted" Value="True"/>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo" Value="Target"/>
</MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="{StaticResource SemiHighlightedTargetVertexBorderBrush}"/>
<Setter Property="Background" Value="{StaticResource SemiHighlightedTargetVertexBackgroundBrush}"/>
</MultiTrigger>
</Style.Triggers>
</Style>
<!-- EDGE CONTROL -->
<Style TargetType="{x:Type GraphSharp_Controls:EdgeControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GraphSharp_Controls:EdgeControl}">
<Path Stroke="{TemplateBinding Foreground}"
MinWidth="1"
MinHeight="1"
ToolTip="{TemplateBinding ToolTip}"
x:Name="edgePath">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<MultiBinding Converter="{StaticResource routeToPathConverter}">
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Source.(GraphSharp_Controls:GraphCanvas.X)" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Source.(GraphSharp_Controls:GraphCanvas.Y)" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Source.ActualWidth" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Source.ActualHeight" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Target.(GraphSharp_Controls:GraphCanvas.X)" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Target.(GraphSharp_Controls:GraphCanvas.Y)" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Target.ActualWidth" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="Target.ActualHeight" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="RoutePoints" />
</MultiBinding>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger"
Value="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" />
<Setter Property="MinWidth"
Value="1" />
<Setter Property="MinHeight"
Value="1" />
<Setter Property="Background"
Value="Red" />
<Setter Property="Foreground"
Value="Silver" />
<Setter Property="Opacity"
Value="0.5" />
<Style.Triggers>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted"
Value="True">
<Setter Property="Foreground"
Value="{DynamicResource HighlightedEdgeBrush}" />
</Trigger>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True">
<Setter Property="Foreground"
Value="{DynamicResource HighlightedEdgeBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True" />
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
Value="InEdge" />
</MultiTrigger.Conditions>
<Setter Property="Foreground"
Value="{DynamicResource SemiHighlightedInEdgeBrush}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True" />
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
Value="OutEdge" />
</MultiTrigger.Conditions>
<Setter Property="Foreground"
Value="{DynamicResource SemiHighlightedOutEdgeBrush}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="10">
<GroupBox>
<GroupBox.Header>
adfajkdsfklad
</GroupBox.Header>
<ItemsControl x:Name="PART_InnerCanvas"
ItemsSource="{TemplateBinding Vertices}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</GroupBox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="GraphSharp_Controls:GraphElementBehaviour.HighlightTrigger"
Value="{Binding RelativeSource={RelativeSource Self},Path=IsMouseOver}" />
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.IsDragEnabled"
Value="True" />
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.X"
Value="{Binding RelativeSource={RelativeSource Self},Path=(GraphSharp_Controls:GraphCanvas.X),Mode=TwoWay}" />
<Setter Property="WPFExtensions_AttachedBehaviours:DragBehaviour.Y"
Value="{Binding RelativeSource={RelativeSource Self},Path=(GraphSharp_Controls:GraphCanvas.Y),Mode=TwoWay}" />
<Setter Property="BorderThickness"
Value="22" />
<Setter Property="BorderBrush"
Value="Silver" />
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0"
EndPoint="1,1">
<GradientStop Color="White"
Offset="0" />
<GradientStop Color="BurlyWood"
Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="LayoutMode"
Value="Automatic">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GraphSharp_Controls:CompoundVertexControl}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Padding="10">
<GroupBox>
<GroupBox.Header>
wdawew
</GroupBox.Header>
<ItemsControl x:Name="PART_InnerCanvas"
ItemsSource="{TemplateBinding Vertices}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<GraphSharp_Controls:GraphCanvas Background="White"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</GroupBox>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0"
EndPoint="1,1">
<GradientStop Color="White"
Offset="0" />
<GradientStop Color="Silver"
Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsHighlighted"
Value="True">
<Setter Property="BorderBrush"
Value="Orange" />
<Setter Property="BorderThickness"
Value="2" />
</Trigger>
<Trigger Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True">
<Setter Property="BorderBrush"
Value="Yellow" />
<Setter Property="BorderThickness"
Value="2" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True" />
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
Value="Source" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush"
Value="Red" />
<Setter Property="BorderThickness"
Value="2" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.IsSemiHighlighted"
Value="True" />
<Condition Property="GraphSharp_Controls:GraphElementBehaviour.SemiHighlightInfo"
Value="Target" />
</MultiTrigger.Conditions>
<Setter Property="BorderBrush"
Value="Blue" />
<Setter Property="BorderThickness"
Value="2" />
</MultiTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

21
src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml

@ -2,9 +2,17 @@ @@ -2,9 +2,17 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:graphsharp="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
xmlns:zoom="clr-namespace:WPFExtensions.Controls;assembly=WPFExtensions"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer"
Title="Code Quality Analysis"
x:Name="root">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/GraphTemplate.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -17,22 +25,23 @@ @@ -17,22 +25,23 @@
<ColumnDefinition Width="200px" />
</Grid.ColumnDefinitions>
<ToolBarTray Background="White" Grid.Row="0">
<ToolBarTray Background="White" Grid.Row="0" Grid.ColumnSpan="2">
<ToolBar>
<Button Name="btnOpenAssembly" Click="btnOpenAssembly_Click">Open Assembly</Button>
<Button Name="btnOpenAssembly" Click="btnOpenAssembly_Click" Margin="0 0 5 0">Open Assembly</Button>
<Button Name="btnRelayout" Click="btnRelayout_Click" Margin="0 0 5 0">Relayout</Button>
<Button Name="btnContinueLayout" Click="btnContinueLayout_Click">Continue Layout</Button>
</ToolBar>
</ToolBarTray>
<TreeView Name="definitionTree" Grid.Row="1" Grid.Column="0" SelectedItemChanged="definitionTree_SelectedItemChanged" />
<!-- gonna replace with ISharpDevelop ZoomControl -->
<zoom:ZoomControl ForceCursor="True" Grid.Row="1" Grid.Column="1" Name="zoom">
<Controls:ZoomControl Grid.Row="1" Grid.Column="1" Name="zoom" AlwaysShowZoomButtons="True" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<graphsharp:GraphLayout x:Name="graphLayout"
LayoutAlgorithmType="LinLog"
OverlapRemovalAlgorithmType="FSA"
HighlightAlgorithmType="Simple"
/>
</zoom:ZoomControl>
</Controls:ZoomControl>
<TextBlock Name="txbTypeInfo" Grid.Column="3" Grid.Row="1"/>
</Grid>

22
src/AddIns/Analysis/CodeQuality/Src/MainWindow.xaml.cs

@ -12,6 +12,7 @@ using System.Windows.Media.Imaging; @@ -12,6 +12,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ICSharpCode.Core.Presentation;
using ICSharpCode.WpfDesign.Designer.Controls;
using Microsoft.Win32;
using Mono.Cecil;
using Mono.Cecil.Cil;
@ -50,6 +51,16 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -50,6 +51,16 @@ namespace ICSharpCode.CodeQualityAnalysis
FillTree();
}
private void btnRelayout_Click(object sender, RoutedEventArgs e)
{
graphLayout.Relayout();
}
private void btnContinueLayout_Click(object sender, RoutedEventArgs e)
{
graphLayout.ContinueLayout();
}
/// <summary>
/// Fill tree with module, types and methods and fields
@ -130,10 +141,17 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -130,10 +141,17 @@ namespace ICSharpCode.CodeQualityAnalysis
select t).SingleOrDefault();*/
var graph = item.Dependency.BuildDependencyGraph();
if (graph != null && graph.VertexCount > 0)
try
{
graphLayout.Graph = graph;
if (graph != null && graph.VertexCount > 0)
{
graphLayout.Graph = graph;
}
}
catch
{
} // ignore it if it fails
}
}

6
src/AddIns/Analysis/CodeQuality/Src/MetricsReader.cs

@ -342,10 +342,10 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -342,10 +342,10 @@ namespace ICSharpCode.CodeQualityAnalysis
{
var instr = ReadInstruction(instruction);
if (instr is MethodDefinition && method.ReturnType != null) // null means outside assembly
if (instr is MethodDefinition)
{
var md = instr as MethodDefinition;
var type = (from n in method.ReturnType.Namespace.Module.Namespaces
var type = (from n in method.Owner.Namespace.Module.Namespaces
from t in n.Types
where t.Name == FormatTypeName(md.DeclaringType) &&
n.Name == t.Namespace.Name
@ -364,7 +364,7 @@ namespace ICSharpCode.CodeQualityAnalysis @@ -364,7 +364,7 @@ namespace ICSharpCode.CodeQualityAnalysis
if (instr is FieldDefinition)
{
var fd = instr as FieldDefinition;
var field = (from f in method.ReturnType.Fields
var field = (from f in method.Owner.Fields
where f.Name == fd.Name
select f).SingleOrDefault();

Loading…
Cancel
Save