Browse Source

Merge branch 'xmlForms' into newNR

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
e38b6afe09
  1. 7
      src/AddIns/Analysis/CodeAnalysis/CodeAnalysis.addin
  2. 35
      src/AddIns/Analysis/CodeAnalysis/CodeAnalysis.csproj
  3. 0
      src/AddIns/Analysis/CodeAnalysis/Resources/old_AnalysisIdeOptionPanel.xfrm
  4. 20
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml
  5. 64
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  6. 87
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml
  7. 308
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs
  8. 289
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsTreeNodes.cs
  9. 2
      src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisIdeOptionsPanel.cs
  10. 2
      src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptions.Designer.cs
  11. 8
      src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptions.cs
  12. 0
      src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptions.resx
  13. 2
      src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptionsPanel.cs
  14. 8
      src/AddIns/Analysis/CodeCoverage/CodeCoverage.sln
  15. 6
      src/AddIns/Analysis/CodeCoverage/Project/CodeCoverage.addin
  16. 51
      src/AddIns/Analysis/CodeCoverage/Project/CodeCoverage.csproj
  17. 47
      src/AddIns/Analysis/CodeCoverage/Project/Resources/CodeCoverageProjectOptionsPanel.xfrm
  18. 38
      src/AddIns/Analysis/CodeCoverage/Project/Resources/old_CodeCoverageOptionsPanel.xfrm
  19. 38
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageControl.cs
  20. 59
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageMethod.cs
  21. 68
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageMethodElement.cs
  22. 81
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageOptionsPanelXaml.xaml
  23. 111
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageOptionsPanelXaml.xaml.cs
  24. 101
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.cs
  25. 35
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.xaml
  26. 89
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.xaml.cs
  27. 14
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProperty.cs
  28. 102
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageResults.cs
  29. 16
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageSequencePoint.cs
  30. 10
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageTestRunner.cs
  31. 41
      src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverApplication.cs
  32. 28
      src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverSettings.cs
  33. 18
      src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverSettingsFactory.cs
  34. 2
      src/AddIns/Analysis/CodeCoverage/Project/Src/old_CodeCoverageOptionsPanel.cs
  35. 26
      src/AddIns/Analysis/CodeCoverage/Test/CodeCoverage.Tests.csproj
  36. 176
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageMethodElementTests.cs
  37. 19
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoveragePropertyCollectionWithGetterAndSetterTestFixture.cs
  38. 26
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoveragePropertyTestFixture.cs
  39. 69
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsMissingFileIdTestFixture.cs
  40. 98
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsPropertyFlagsTestFixture.cs
  41. 45
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsTestFixture.cs
  42. 32
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsWithEmptyMethodElementTestFixture.cs
  43. 102
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/GetSequencePointsForFileNameTestFixture.cs
  44. 57
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/InvalidSequencePointDataTestFixture.cs
  45. 104
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/ModuleVisitedSequencePointsTestFixture.cs
  46. 32
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/OpenCoverSettingsFactoryTests.cs
  47. 10
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/OpenCoverSettingsMissingRulePrefixTestFixture.cs
  48. 18
      src/AddIns/Analysis/CodeCoverage/Test/Coverage/OpenCoverSettingsTestFixture.cs
  49. 29
      src/AddIns/Analysis/CodeCoverage/Test/Gui/PropertiesInCodeCoverageTreeView.cs
  50. 39
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/AddCodeCoverageMarkersTestFixture.cs
  51. 39
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersCoverMultipleLinesTestFixture.cs
  52. 39
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersCoverTwoLinesTestFixture.cs
  53. 41
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidEndColumnTestFixture.cs
  54. 40
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidEndLineTestFixture.cs
  55. 39
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidStartColumnTestFixture.cs
  56. 39
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidStartLineTestFixture.cs
  57. 39
      src/AddIns/Analysis/CodeCoverage/Test/Highlighting/RemoveCodeCoverageMarkersTestFixture.cs
  58. 34
      src/AddIns/Analysis/CodeCoverage/Test/Testing/CodeCoverageTestRunnerTests.cs
  59. 82
      src/AddIns/Analysis/CodeCoverage/Test/Testing/OpenCoverApplicationTests.cs
  60. 38
      src/AddIns/Analysis/CodeCoverage/Test/Testing/RunTestWithCodeCoverageCommandTests.cs
  61. 110
      src/AddIns/Analysis/CodeCoverage/Test/Utils/CodeCoverageMethodXElementBuilder.cs
  62. 21
      src/AddIns/Analysis/CodeCoverage/Test/Utils/XElementExtensions.cs
  63. 0
      src/AddIns/Analysis/SourceAnalysis/Resources/old_AnalysisIdeOptionPanel.xfrm
  64. 13
      src/AddIns/Analysis/SourceAnalysis/SourceAnalysis.addin
  65. 40
      src/AddIns/Analysis/SourceAnalysis/SourceAnalysis.csproj
  66. 25
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml
  67. 103
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  68. 38
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml
  69. 129
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
  70. 2
      src/AddIns/Analysis/SourceAnalysis/Src/CheckCurrentProjectCommand.cs
  71. 4
      src/AddIns/Analysis/SourceAnalysis/Src/StyleCopWrapper.cs
  72. 8
      src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisIdeOptionsPanel.cs
  73. 2
      src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptions.Designer.cs
  74. 2
      src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptions.cs
  75. 0
      src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptions.resx
  76. 4
      src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptionsPanel.cs
  77. 1
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/WebProjectOptions/WebProjectOptionsPanel.xaml.cs
  78. 16
      src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj
  79. 13
      src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
  80. 16
      src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj
  81. 398
      src/AddIns/BackendBindings/CSharpBinding/Project/Resources/BuildOptions.xfrm
  82. 61
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.cs
  83. 343
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml
  84. 406
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
  85. 32
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/HexValidator.cs
  86. 17
      src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.addin
  87. 49
      src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj
  88. 381
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
  89. 134
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.xaml
  90. 37
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/BuildEventOptions.cs
  91. 102
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ItemDefinitionGroupBinding.cs
  92. 57
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.cs
  93. 89
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml
  94. 188
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs
  95. 48
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ObservedBinding.cs
  96. 64
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/OpenStringListEditorEvent.cs
  97. 51
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.cs
  98. 63
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml
  99. 156
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs
  100. 93
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.Designer.cs
  101. Some files were not shown because too many files have changed in this diff Show More

7
src/AddIns/Analysis/CodeAnalysis/CodeAnalysis.addin

@ -20,9 +20,14 @@ @@ -20,9 +20,14 @@
</Path>
<Path name = "/SharpDevelop/BackendBindings/ProjectOptions/AllManaged">
<!--<OptionPanel id = "CodeAnalysis"
label = "${res:ICSharpCode.CodeAnalysis}"
class = "ICSharpCode.CodeAnalysis.AnalysisProjectOptionsPanel"/>-->
<OptionPanel id = "CodeAnalysis"
label = "${res:ICSharpCode.CodeAnalysis}"
class = "ICSharpCode.CodeAnalysis.AnalysisProjectOptionsPanel"/>
class = "ICSharpCode.CodeAnalysis.AnalysisProjectOptionsPanelXaml"/>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions">

35
src/AddIns/Analysis/CodeAnalysis/CodeAnalysis.csproj

@ -39,12 +39,18 @@ @@ -39,12 +39,18 @@
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<None Include="CodeAnalysis.addin">
@ -54,21 +60,30 @@ @@ -54,21 +60,30 @@
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Src\AnalysisProjectOptionsPanel.cs" />
<Compile Include="Src\AnalysisProjectOptions.Designer.cs">
<DependentUpon>AnalysisProjectOptions.cs</DependentUpon>
<Compile Include="Src\AnalysisIdeOptionsPanel.xaml.cs">
<DependentUpon>AnalysisIdeOptionsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\AnalysisProjectOptions.cs" />
<EmbeddedResource Include="Src\AnalysisProjectOptions.resx">
<DependentUpon>AnalysisProjectOptions.cs</DependentUpon>
<Compile Include="Src\old_AnalysisProjectOptionsPanel.cs" />
<Compile Include="Src\old_AnalysisProjectOptions.Designer.cs">
<DependentUpon>old_AnalysisProjectOptions.cs</DependentUpon>
</Compile>
<Compile Include="Src\old_AnalysisProjectOptions.cs" />
<EmbeddedResource Include="Src\old_AnalysisProjectOptions.resx">
<DependentUpon>old_AnalysisProjectOptions.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Src\AnalysisProjectOptionsPanelXaml.xaml.cs">
<DependentUpon>AnalysisProjectOptionsPanelXaml.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\AnalysisProjectOptionsTreeNodes.cs" />
<Compile Include="Src\FxCopWrapper.cs" />
<Compile Include="Src\FxCopRule.cs" />
<Compile Include="Src\CheckCurrentProjectCommand.cs" />
<Compile Include="Src\FxCopLogger.cs" />
<Compile Include="Src\SuppressMessageCommand.cs" />
<Compile Include="Src\AnalysisIdeOptionsPanel.cs" />
<EmbeddedResource Include="Resources\AnalysisIdeOptionPanel.xfrm" />
<Compile Include="Src\old_AnalysisIdeOptionsPanel.cs" />
<EmbeddedResource Include="Resources\old_AnalysisIdeOptionPanel.xfrm" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
@ -87,5 +102,9 @@ @@ -87,5 +102,9 @@
</ProjectReference>
<Folder Include="Resources" />
</ItemGroup>
<ItemGroup>
<Page Include="Src\AnalysisIdeOptionsPanel.xaml" />
<Page Include="Src\AnalysisProjectOptionsPanelXaml.xaml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

0
src/AddIns/Analysis/CodeAnalysis/Resources/AnalysisIdeOptionPanel.xfrm → src/AddIns/Analysis/CodeAnalysis/Resources/old_AnalysisIdeOptionPanel.xfrm

20
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
<gui:OptionPanel x:Class="ICSharpCode.CodeAnalysis.AnalysisIdeOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
<GroupBox Header="{core:Localize ICSharpCode.CodeAnalysis.IdeOptions.FxCopPath}">
<StackPanel>
<TextBlock Margin="3,5,3,20" x:Name="status"
HorizontalAlignment="Center" TextWrapping="Wrap"
Text="(showing current FxCop path)"></TextBlock>
<Button Content="{core:Localize ICSharpCode.CodeAnalysis.IdeOptions.FindFxCopPath}"
HorizontalAlignment="Center"
Click="FindFxCopPath_Click"
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button>
</StackPanel>
</GroupBox>
</gui:OptionPanel>

64
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 19.07.2012
* Time: 21:27
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
namespace ICSharpCode.CodeAnalysis
{
/// <summary>
/// Interaction logic for AnalysisIdeOptionsPanelXaml.xaml
/// </summary>
public partial class AnalysisIdeOptionsPanel : OptionPanel
{
public AnalysisIdeOptionsPanel()
{
InitializeComponent();
ShowStatus();
}
private void ShowStatus()
{
string path = FxCopWrapper.FindFxCopPath();
if (path == null) {
status.Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopNotFound}");
} else {
status.Text = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.IdeOptions.FxCopFoundInPath}")
+ Environment.NewLine + path;
}
}
private void FindFxCopPath_Click(object sender, System.Windows.RoutedEventArgs e)
{
string fn = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;");
if (!String.IsNullOrEmpty(fn)) {
string path = Path.GetDirectoryName(fn);
if (FxCopWrapper.IsFxCopPath(path)) {
FxCopPath = path;
} else {
MessageService.ShowError("${res:ICSharpCode.CodeAnalysis.IdeOptions.DirectoryDoesNotContainFxCop}");
}
}
ShowStatus();
}
public static string FxCopPath {
get {
return PropertyService.Get("CodeAnalysis.FxCopPath");
}
set {
PropertyService.Set("CodeAnalysis.FxCopPath", value);
}
}
}
}

87
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CodeAnalysis.AnalysisProjectOptionsPanelXaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:tv="http://icsharpcode.net/sharpdevelop/treeview"
xmlns:local="clr-namespace:ICSharpCode.CodeAnalysis"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<optionpanels:StorageLocationPicker Location="{Binding RunCodeAnalysis.Location}"></optionpanels:StorageLocationPicker>
<CheckBox Grid.Column="1" VerticalAlignment="Center" Grid.ColumnSpan="2"
IsChecked="{Binding RunCodeAnalysis.Value}"
Content="{core:Localize ICSharpCode.CodeAnalysis.ProjectOptions.RunOnBuild}"></CheckBox>
<Button Grid.Row="1" VerticalAlignment="Center" Grid.ColumnSpan="2" Margin="0,10,0,10"
Style="{x:Static core:GlobalStyles.ButtonStyle}"
Click="ChangeRuleAssembliesButtonClick"
Content="{core:Localize ICSharpCode.CodeAnalysis.ProjectOptions.AddRemoveRuleAssembly}"></Button>
<tv:SharpTreeView x:Name="ruleTreeView" ShowRoot="False" ShowLines="False" IsSynchronizedWithCurrentItem="True"
Grid.Row="2" Grid.ColumnSpan="3">
<ListView.View>
<tv:SharpGridView >
<tv:SharpGridView.Columns>
<GridViewColumn Width="500" Header="ID">
<GridViewColumn.CellTemplate>
<DataTemplate>
<tv:SharpTreeNodeView />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Action">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ComboBox Background="Transparent" Width="100"
HorizontalAlignment="Center" VerticalAlignment="Center"
ItemsSource="{Binding Path=RuleState}"
IsSynchronizedWithCurrentItem="True"
IsReadOnly="False"
SelectedIndex="{Binding Index}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image VerticalAlignment="Center" Height="15" Margin="3,0,5,0"
Source="{Binding Item1}"></Image>
<TextBlock VerticalAlignment="Center" Text="{Binding Item2}"></TextBlock>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</tv:SharpGridView.Columns>
</tv:SharpGridView>
</ListView.View>
</tv:SharpTreeView>
</Grid>
</ScrollViewer>
</optionpanels:ProjectOptionPanel>

308
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs

@ -0,0 +1,308 @@ @@ -0,0 +1,308 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 06/09/2012
* Time: 18:27
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using Gui.Dialogs.OptionPanels.ProjectOptions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.TreeView;
namespace ICSharpCode.CodeAnalysis
{
/// <summary>
/// Interaction logic for AnalysisProjectOptionsPanelXaml.xaml
/// </summary>
public partial class AnalysisProjectOptionsPanelXaml : ProjectOptionPanel
{
private bool initSuccess;
private bool userCheck;
private Dictionary<string, RuleTreeNode> rules = new Dictionary<string, RuleTreeNode>();
public AnalysisProjectOptionsPanelXaml()
{
InitializeComponent();
DataContext = this;
}
public ProjectProperty<bool> RunCodeAnalysis {
get { return GetProperty("RunCodeAnalysis", false); }
}
public ProjectProperty<string> CodeAnalysisRuleAssemblies {
get { return GetProperty("CodeAnalysisRuleAssemblies","",TextBoxEditMode.EditEvaluatedProperty); }
}
public ProjectProperty<string> CodeAnalysisRules {
get { return GetProperty("CodeAnalysisRules","",TextBoxEditMode.EditEvaluatedProperty); }
}
#region Rule Assemblies Property
string ruleAssemblies;
const string DefaultRuleAssemblies = @"$(FxCopDir)\rules";
public string RuleAssemblies {
get {
return ruleAssemblies;
}
set {
if (string.IsNullOrEmpty(value)) {
value = DefaultRuleAssemblies;
}
if (ruleAssemblies != value) {
ruleAssemblies = value;
if (initSuccess) {
ReloadRuleList();
}
}
}
}
#endregion
#region Rule string Property
string CreateRuleString()
{
StringBuilder b = new StringBuilder();
foreach (SharpTreeNode category in ruleTreeView.Items) {
foreach (RuleTreeNode rule in category.Children) {
if (!(bool)rule.IsChecked || rule.isError) {
if (b.Length > 0)
b.Append(';');
if ((bool)rule.IsChecked)
b.Append('+');
else
b.Append('-');
if (rule.isError)
b.Append('!');
b.Append(rule.Identifier);
}
}
}
return b.ToString();
}
void ReadRuleString()
{
userCheck = false;
foreach (SharpTreeNode cat in ruleTreeView.Root.Children) {
foreach (RuleTreeNode rtn in cat.Children) {
rtn.IsChecked = true;
rtn.isError = false;
}
}
foreach (string rule2 in ruleString.Split(';')) {
string rule = rule2;
if (rule.Length == 0) continue;
bool active = true;
bool error = false;
if (rule.StartsWith("-")) {
active = false;
rule = rule.Substring(1);
} else if (rule.StartsWith("+")) {
rule = rule.Substring(1);
}
if (rule.StartsWith("!")) {
error = true;
rule = rule.Substring(1);
}
RuleTreeNode ruleNode;
if (rules.TryGetValue(rule, out ruleNode)) {
ruleNode.IsChecked = active;
//ruleNode.isError = error;
ruleNode.Index = 1;
}
}
userCheck = true;
SetCategoryIcon();
}
void SetCategoryIcon() {
Console.WriteLine("SetCategoryicon");
foreach (CategoryTreeNode categoryNode in ruleTreeView.Root.Children) {
categoryNode.CheckMode();
/*
if (!categoryNode.NewErrorState.HasValue) {
Console.WriteLine ("\t{0} is Mixed Mode",categoryNode.Text);
categoryNode.AddMixedMode();
} else{
if (categoryNode.NewErrorState == true) {
Console.WriteLine ("\t{0} is Error",categoryNode.Text);
// categoryNode.Index = 1;
} else {
Console.WriteLine ("\t{0} is Warning",categoryNode.Text);
// categoryNode.Index = ;
}
}
*/
}
Console.WriteLine("--------------");
}
string ruleString = "";
public string RuleString {
get {
if (initSuccess)
return CreateRuleString();
else
return ruleString;
}
set {
ruleString = value;
if (initSuccess) {
ReadRuleString();
}
}
}
#endregion
#region overrides
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
RuleString = this.CodeAnalysisRules.Value;
RuleAssemblies = CodeAnalysisRuleAssemblies.Value;
ReloadRuleList();
}
protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
{
this.CodeAnalysisRules.Value = RuleString;
return base.Save(project, configuration, platform);
}
#endregion
#region RuleList
void ReloadRuleList()
{
ruleTreeView.Root = new SharpTreeNode();
FxCopWrapper.GetRuleList(GetRuleAssemblyList(true), Callback);
if (ruleTreeView.Root.Children.Count == 0) {
ruleTreeView.Root.Children.Add(new MessageNode(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.LoadingRules}")));
}
}
void Callback(List<FxCopCategory> ruleList)
{
if (WorkbenchSingleton.InvokeRequired) {
WorkbenchSingleton.SafeThreadAsyncCall((Action<List<FxCopCategory>>)Callback, ruleList);
} else {
ruleTreeView.Root = new SharpTreeNode();
rules.Clear();
if (ruleList == null || ruleList.Count == 0) {
ruleTreeView.Root.Children.Add(new MessageNode(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.CannotFindFxCop}")));
ruleTreeView.Root.Children.Add(new MessageNode(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.SpecifyFxCopPath}")));
} else {
foreach (FxCopCategory cat in ruleList) {
CategoryTreeNode catNode = new CategoryTreeNode(cat);
catNode.PropertyChanged += OnPropertyChanged;
ruleTreeView.Root.Children.Add(catNode);
foreach (RuleTreeNode ruleNode in catNode.Children) {
ruleNode.PropertyChanged += OnPropertyChanged;
rules[ruleNode.Identifier] = ruleNode;
}
}
ReadRuleString();
initSuccess = true;
}
}
}
private void OnPropertyChanged(object sender,System.ComponentModel.PropertyChangedEventArgs e)
{
if (initSuccess) {
Console.WriteLine("OnPropertyChanged {0}",e.PropertyName);
if (e.PropertyName == "Index") {
base.IsDirty = true;
}
}
}
private string[] GetRuleAssemblyList(bool replacePath)
{
List<string> list = new List<string>();
string fxCopPath = FxCopWrapper.FindFxCopPath();
foreach (string dir in ruleAssemblies.Split(';')) {
if (string.Equals(dir, "$(FxCopDir)\\rules", StringComparison.OrdinalIgnoreCase))
continue;
if (string.Equals(dir, "$(FxCopDir)/rules", StringComparison.OrdinalIgnoreCase))
continue;
if (replacePath && !string.IsNullOrEmpty(fxCopPath)) {
list.Add(Regex.Replace(dir, @"\$\(FxCopDir\)", fxCopPath, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase));
} else {
list.Add(dir);
}
}
return list.ToArray();
}
private void ChangeRuleAssembliesButtonClick( object sender, RoutedEventArgs e)
{
var stringListDialog = new StringListEditorDialog();
stringListDialog.BrowseForDirectory = true;
stringListDialog.TitleText = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.ChooseRuleAssemblyDirectory}");
stringListDialog.LoadList(GetRuleAssemblyList(false));
stringListDialog.ShowDialog();
if (stringListDialog.DialogResult ?? false) {
StringBuilder b = new StringBuilder(DefaultRuleAssemblies);
foreach (string asm in stringListDialog.GetList()) {
b.Append(';');
b.Append(asm);
}
bool oldInitSuccess = initSuccess;
initSuccess = true;
try {
this.RuleAssemblies = b.ToString();
} finally {
initSuccess = oldInitSuccess;
}
}
}
#endregion
}
}

289
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsTreeNodes.cs

@ -0,0 +1,289 @@ @@ -0,0 +1,289 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 30.06.2012
* Time: 20:55
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ICSharpCode.Core;
using ICSharpCode.Core.Presentation;
using ICSharpCode.TreeView;
namespace ICSharpCode.CodeAnalysis
{
/// <summary>
/// Description of AnalysisProjectOptionsTreeNodes.
/// </summary>
public class BaseTree:SharpTreeNode
{
private int index;
public BaseTree()
{
RuleState = new ObservableCollection<Tuple<ImageSource,string>>();
Icon icon = SystemIcons.Warning;
ImageSource imageSource = ToImageSource(icon);
this.RuleState.Add(Tuple.Create<ImageSource,string>(imageSource,
ResourceService.GetString("Global.WarningText")));
icon = SystemIcons.Error;
imageSource = ToImageSource(icon);
this.RuleState.Add(Tuple.Create<ImageSource,string>(imageSource,
ResourceService.GetString("Global.ErrorText")));
// bla.Add(Tuple.Create<Icon,string>(null,"None"));
}
private static ImageSource ToImageSource( Icon icon)
{
Bitmap bitmap = icon.ToBitmap();
IntPtr hBitmap = bitmap.GetHbitmap();
ImageSource wpfBitmap = Imaging.CreateBitmapSourceFromHBitmap(
hBitmap,
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
return wpfBitmap;
}
public ObservableCollection<Tuple<ImageSource,string>> RuleState {get;set;}
private Tuple<Icon,string> selectedItem;
public Tuple<Icon, string> SelectedNode {
get { return selectedItem; }
set { selectedItem = value; }
}
public virtual int Index {
get { return index; }
set {
index = value;
}
}
}
public class CategoryTreeNode : BaseTree
{
internal FxCopCategory category;
private Tuple<ImageSource,string> mixedModeTuple;
public CategoryTreeNode(FxCopCategory category):base()
{
this.category = category;
foreach (FxCopRule rule in category.Rules) {
this.Children.Add(new RuleTreeNode(rule));
}
CheckMode();
}
public override bool IsCheckable {
get { return true; }
}
public override object Text {
get { return category.DisplayName; }
}
bool ignoreCheckMode;
public override int Index {
get { return base.Index; }
set {
if (value != base.Index) {
base.Index = value;
if (mixedModeTuple == null) {
Console.WriteLine("Set all to index");
ignoreCheckMode = true;
foreach (RuleTreeNode rule in this.Children) {
rule.Index = Index;
}
ignoreCheckMode = false;
// CheckMode();
// base.RaisePropertyChanged("Index");
// foreach (RuleTreeNode rule in this.Children) {
// Console.WriteLine(rule.Index.ToString());
// }
}
}
}
}
private void AddMixedMode()
{
Console.WriteLine("AddMixedMode");
if (!RuleState.Contains(mixedModeTuple)) {
var image = PresentationResourceService.GetBitmapSource("Icons.16x16.ClosedFolderBitmap");
mixedModeTuple = Tuple.Create<ImageSource,string>(image,
StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.WarningErrorMixed}"));
RuleState.Add(mixedModeTuple);
Index = RuleState.Count -1;
base.RaisePropertyChanged("Index");
CheckMode();
}
}
private void RemoveMixedMode()
{
Console.WriteLine("RemoveMixedMode(");
if (mixedModeTuple != null) {
if (RuleState.Contains(mixedModeTuple)) {
RuleState.Remove(mixedModeTuple);
mixedModeTuple = null;
base.RaisePropertyChanged("Index");
CheckMode();
}
}
}
public void CheckMode ()
{
if (! ignoreCheckMode) {
Console.WriteLine("CheckMode");
if (!NewErrorState.HasValue) {
Console.WriteLine ("\t{0} is Mixed Mode",Text);
AddMixedMode();
}
else{
RemoveMixedMode();
/*
if (NewErrorState == true) {
Console.WriteLine ("\t{0} is Error",Text);
// Index = 1;
} else {
Console.WriteLine ("\t{0} is Warning",Text);
// categoryNode.Index = ;
}
*/
}
}
}
public Nullable<bool> NewErrorState {
get {
bool allWarn = true;
bool allErr = true;
foreach (RuleTreeNode tn in Children) {
if (tn.isError)
allWarn = false;
else
allErr = false;
}
if (allErr)
return true;
else if (allWarn)
return false;
else
return null;
}
}
/*
internal int ErrorState {
get {
bool allWarn = true;
bool allErr = true;
foreach (RuleTreeNode tn in Children) {
if (tn.isError)
allWarn = false;
else
allErr = false;
}
if (allErr)
return 1;
else if (allWarn)
return 0;
else
return -1;
}
}
*/
}
public class RuleTreeNode :BaseTree
{
internal FxCopRule rule;
bool error;
internal bool isError {
get { return error; }
set {
error = value;
// Index = 1;
}
}
public RuleTreeNode(FxCopRule rule):base()
{
this.rule = rule;
}
public override bool IsCheckable {
get { return true; }
}
public override object Text {
get { return rule.CheckId + " : " + rule.DisplayName; }
}
public string Identifier {
get {
return rule.CategoryName + "#" + rule.CheckId;
}
}
public override int Index {
get { return base.Index; }
set {
if (base.Index != value) {
isError = value == 1;
base.Index = value;
RaisePropertyChanged("Index");
var p = Parent as CategoryTreeNode;
p.CheckMode();
Console.WriteLine ("RuleNode {0} - index {1} - error {2}",rule.DisplayName,Index, isError);
}
}
}
}
public class MessageNode : SharpTreeNode
{
private string message;
public MessageNode (string message)
{
this.message = message;
}
public override object Text {
get { return message; }
}
}
}

2
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.cs → src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisIdeOptionsPanel.cs

@ -14,7 +14,7 @@ namespace ICSharpCode.CodeAnalysis @@ -14,7 +14,7 @@ namespace ICSharpCode.CodeAnalysis
/// <summary>
/// Option panel to choose the FxCop path from.
/// </summary>
public class AnalysisIdeOptionsPanel : XmlFormsOptionPanel
public class old_AnalysisIdeOptionsPanel : XmlFormsOptionPanel
{
public override void LoadPanelContents()
{

2
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptions.Designer.cs → src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptions.Designer.cs generated

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
namespace ICSharpCode.CodeAnalysis
{
partial class AnalysisProjectOptions : System.Windows.Forms.UserControl
partial class old_AnalysisProjectOptions : System.Windows.Forms.UserControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.

8
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptions.cs → src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptions.cs

@ -14,11 +14,11 @@ using ICSharpCode.SharpDevelop.Project; @@ -14,11 +14,11 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CodeAnalysis
{
public partial class AnalysisProjectOptions
public partial class old_AnalysisProjectOptions
{
Dictionary<string, RuleTreeNode> rules = new Dictionary<string, RuleTreeNode>();
public AnalysisProjectOptions()
public old_AnalysisProjectOptions()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
@ -286,9 +286,9 @@ namespace ICSharpCode.CodeAnalysis @@ -286,9 +286,9 @@ namespace ICSharpCode.CodeAnalysis
class ConfigBinding : ConfigurationGuiBinding
{
readonly AnalysisProjectOptions po;
readonly old_AnalysisProjectOptions po;
public ConfigBinding(AnalysisProjectOptions po)
public ConfigBinding(old_AnalysisProjectOptions po)
{
this.po = po;
this.TreatPropertyValueAsLiteral = false;

0
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptions.resx → src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptions.resx

2
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.cs → src/AddIns/Analysis/CodeAnalysis/Src/old_AnalysisProjectOptionsPanel.cs

@ -14,7 +14,7 @@ namespace ICSharpCode.CodeAnalysis @@ -14,7 +14,7 @@ namespace ICSharpCode.CodeAnalysis
{
InitializeHelper();
AnalysisProjectOptions po = new AnalysisProjectOptions();
old_AnalysisProjectOptions po = new old_AnalysisProjectOptions();
po.Dock = DockStyle.Fill;
Controls.Add(po);

8
src/AddIns/Analysis/CodeCoverage/CodeCoverage.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.0.0.6131
# SharpDevelop 4.2.1.8805
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage", "Project\CodeCoverage.csproj", "{08CE9972-283B-44F4-82FA-966F7DFA6B7A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage.Tests", "Test\CodeCoverage.Tests.csproj", "{A5C0E8F8-9D04-46ED-91D6-1DEF1575313B}"
@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.AvalonEdit", ". @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.AvalonEdit", ".
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting.Tests", "..\UnitTesting\Test\UnitTesting.Tests.csproj", "{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "..\..\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -68,5 +70,9 @@ Global @@ -68,5 +70,9 @@ Global
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.Build.0 = Release|Any CPU
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.Build.0 = Release|Any CPU
{0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal

6
src/AddIns/Analysis/CodeCoverage/Project/CodeCoverage.addin

@ -1,12 +1,13 @@ @@ -1,12 +1,13 @@
<AddIn name = "CodeCoverageAddIn"
author = "Matt Ward"
copyright = "prj:///doc/copyright.txt"
description = "Code Coverage AddIn for SharpDevelop using PartCover"
description = "Code Coverage AddIn for SharpDevelop using OpenCover"
addInManagerHidden = "preinstalled">
<Manifest>
<Identity name = "ICSharpCode.CodeCoverage"/>
<Dependency addin = "ICSharpCode.UnitTesting" requirePreload = "true"/>
<Dependency addin = "ICSharpCode.AvalonEdit" requirePreload = "true"/>
</Manifest>
<Runtime>
@ -48,7 +49,7 @@ @@ -48,7 +49,7 @@
</Path>
<Path name = "/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<OptionPanel id = "CodeCoverageOptionsPanel"
<OptionPanel id = "CodeCoverageOptionsPanel1"
label = "${res:ICSharpCode.UnitTesting.CodeCoverage}"
insertafter = "CodeAnalysisOptionPanel"
class = "ICSharpCode.CodeCoverage.CodeCoverageOptionsPanel"/>
@ -108,6 +109,7 @@ @@ -108,6 +109,7 @@
<OptionPanel id = "CodeCoverage"
label = "${res:ICSharpCode.UnitTesting.CodeCoverage}"
class = "ICSharpCode.CodeCoverage.CodeCoverageProjectOptionsPanel"/>
</Path>
<Path name = "/SharpDevelop/Workbench/MainMenu/Edit/Format">

51
src/AddIns/Analysis/CodeCoverage/Project/CodeCoverage.csproj

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<AssemblyName>CodeCoverage</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{08ce9972-283b-44f4-82fa-966f7dfa6b7a}</ProjectGuid>
<ProjectGuid>{08CE9972-283B-44F4-82FA-966F7DFA6B7A}</ProjectGuid>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<RegisterForComInterop>False</RegisterForComInterop>
@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<RunCodeAnalysis>False</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\..\..\AddIns\Analysis\CodeCoverage\</OutputPath>
@ -51,6 +52,7 @@ @@ -51,6 +52,7 @@
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
@ -59,7 +61,18 @@ @@ -59,7 +61,18 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Src\CodeCoverageControl.cs" />
<Compile Include="Src\CodeCoverageControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\CodeCoverageMethodElement.cs" />
<Compile Include="Src\CodeCoverageOptionsPanelXaml.xaml.cs">
<DependentUpon>CodeCoverageOptionsPanelXaml.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\CodeCoverageProjectOptionsPanel.xaml.cs">
<DependentUpon>CodeCoverageProjectOptionsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\CodeCoveragePad.cs" />
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\CodeCoverageModule.cs" />
@ -72,7 +85,9 @@ @@ -72,7 +85,9 @@
<Compile Include="Src\CodeCoverageTestRunner.cs" />
<Compile Include="Src\CodeCoverageTestRunnerContext.cs" />
<Compile Include="Src\CodeCoverageTestRunnerFactory.cs" />
<Compile Include="Src\CodeCoverageTreeView.cs" />
<Compile Include="Src\CodeCoverageTreeView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Src\CodeCoverageModuleTreeNode.cs" />
<Compile Include="Src\CodeCoverageTreeNode.cs" />
<Compile Include="Src\CodeCoverageMethodTreeNode.cs" />
@ -82,20 +97,18 @@ @@ -82,20 +97,18 @@
<Compile Include="Src\FileSystem.cs" />
<Compile Include="Src\ICodeCoverageTestRunnerFactory.cs" />
<Compile Include="Src\IFileSystem.cs" />
<Compile Include="Src\PartCoverApplication.cs" />
<Compile Include="Src\PartCoverSettings.cs" />
<Compile Include="Src\PartCoverSettingsFactory.cs" />
<Compile Include="Src\OpenCoverApplication.cs" />
<Compile Include="Src\OpenCoverSettings.cs" />
<Compile Include="Src\OpenCoverSettingsFactory.cs" />
<Compile Include="Src\RunAllTestsWithCodeCoverageCommand.cs" />
<Compile Include="Src\SequencePointListViewSorter.cs" />
<Compile Include="Src\ToggleCodeCoverageCommand.cs" />
<Compile Include="Src\CodeCoverageHighlighter.cs" />
<Compile Include="Src\CodeCoverageOptions.cs" />
<Compile Include="Src\CodeCoverageOptionsPanel.cs" />
<EmbeddedResource Include="Resources\CodeCoverageOptionsPanel.xfrm" />
<Compile Include="Src\old_CodeCoverageOptionsPanel.cs" />
<EmbeddedResource Include="Resources\old_CodeCoverageOptionsPanel.xfrm" />
<Compile Include="Src\CodeCoverageDisplayItem.cs" />
<Compile Include="Src\ColorPickerComboBox.cs" />
<Compile Include="Src\CodeCoverageProjectOptionsPanel.cs" />
<EmbeddedResource Include="Resources\CodeCoverageProjectOptionsPanel.xfrm" />
<Compile Include="Src\CodeCoverageService.cs" />
<Compile Include="Src\RunTestWithCodeCoverageCommand.cs" />
<None Include="CodeCoverage.addin">
@ -127,11 +140,25 @@ @@ -127,11 +140,25 @@
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj">
<Project>{0162E499-42D0-409B-AA25-EED21F75336B}</Project>
<Name>AvalonEdit.AddIn</Name>
<Private>False</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>
</ProjectReference>
<ProjectReference Include="..\..\UnitTesting\UnitTesting.csproj">
<Project>{1F261725-6318-4434-A1B1-6C70CE4CD324}</Project>
<Name>UnitTesting</Name>
@ -143,5 +170,9 @@ @@ -143,5 +170,9 @@
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="Src\CodeCoverageOptionsPanelXaml.xaml" />
<Page Include="Src\CodeCoverageProjectOptionsPanel.xaml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

47
src/AddIns/Analysis/CodeCoverage/Project/Resources/CodeCoverageProjectOptionsPanel.xfrm

@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="CodeCoverageProjectOptionsPanel" />
<ClientSize value="{Width=342, Height=396}" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="excludeListTextBox" />
<TabIndex value="3" />
<Location value="12, 229" />
<WordWrap value="False" />
<Anchor value="Top, Left, Right" />
<ScrollBars value="Vertical" />
<AcceptsReturn value="True" />
<Size value="317, 154" />
<Multiline value="True" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="excludeListLabel" />
<Location value="12, 206" />
<Text value="${res:ICSharpCode.CodeCoverage.ProjectOptionsPanel.ExcludeListLabel}:" />
<Size value="317, 20" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="includeListTextBox" />
<TabIndex value="1" />
<Location value="12, 36" />
<WordWrap value="False" />
<Anchor value="Top, Left, Right" />
<ScrollBars value="Vertical" />
<AcceptsReturn value="True" />
<Size value="317, 154" />
<Multiline value="True" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="includeListLabel" />
<Location value="12, 12" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:ICSharpCode.CodeCoverage.ProjectOptionsPanel.IncludeListLabel}:" />
<Size value="317, 21" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

38
src/AddIns/Analysis/CodeCoverage/Project/Resources/CodeCoverageOptionsPanel.xfrm → src/AddIns/Analysis/CodeCoverage/Project/Resources/old_CodeCoverageOptionsPanel.xfrm

@ -18,28 +18,11 @@ @@ -18,28 +18,11 @@
<DrawMode value="OwnerDrawFixed" />
<Location value="177, 91" />
<Anchor value="Top, Left, Right" />
<MinimumSize value="116, 21" />
<Size value="116, 21" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
<SelectedColor value="Color [Black]" />
<Items>
<System.Drawing.Color value="Color [Black]" />
<System.Drawing.Color value="Color [White]" />
<System.Drawing.Color value="Color [Maroon]" />
<System.Drawing.Color value="Color [Green]" />
<System.Drawing.Color value="Color [Olive]" />
<System.Drawing.Color value="Color [Navy]" />
<System.Drawing.Color value="Color [Purple]" />
<System.Drawing.Color value="Color [Teal]" />
<System.Drawing.Color value="Color [Silver]" />
<System.Drawing.Color value="Color [Gray]" />
<System.Drawing.Color value="Color [Red]" />
<System.Drawing.Color value="Color [Lime]" />
<System.Drawing.Color value="Color [Yellow]" />
<System.Drawing.Color value="Color [Blue]" />
<System.Drawing.Color value="Color [Magenta]" />
<System.Drawing.Color value="Color [Cyan]" />
</Items>
</ICSharpCode.CodeCoverage.ColorPickerComboBox>
<ICSharpCode.CodeCoverage.ColorPickerComboBox>
<Name value="foregroundColorPickerComboBox" />
@ -48,27 +31,10 @@ @@ -48,27 +31,10 @@
<Location value="179, 44" />
<Anchor value="Top, Left, Right" />
<Size value="116, 21" />
<MinimumSize value="116, 21" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
<SelectedColor value="Color [Black]" />
<Items>
<System.Drawing.Color value="Color [Black]" />
<System.Drawing.Color value="Color [White]" />
<System.Drawing.Color value="Color [Maroon]" />
<System.Drawing.Color value="Color [Green]" />
<System.Drawing.Color value="Color [Olive]" />
<System.Drawing.Color value="Color [Navy]" />
<System.Drawing.Color value="Color [Purple]" />
<System.Drawing.Color value="Color [Teal]" />
<System.Drawing.Color value="Color [Silver]" />
<System.Drawing.Color value="Color [Gray]" />
<System.Drawing.Color value="Color [Red]" />
<System.Drawing.Color value="Color [Lime]" />
<System.Drawing.Color value="Color [Yellow]" />
<System.Drawing.Color value="Color [Blue]" />
<System.Drawing.Color value="Color [Magenta]" />
<System.Drawing.Color value="Color [Cyan]" />
</Items>
</ICSharpCode.CodeCoverage.ColorPickerComboBox>
<System.Windows.Forms.Label>
<Name value="sampleTextLabel" />

38
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageControl.cs

@ -3,13 +3,19 @@ @@ -3,13 +3,19 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.AddIn;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
namespace ICSharpCode.CodeCoverage
@ -232,8 +238,14 @@ namespace ICSharpCode.CodeCoverage @@ -232,8 +238,14 @@ namespace ICSharpCode.CodeCoverage
{
CodeCoverageClassTreeNode classNode = node as CodeCoverageClassTreeNode;
CodeCoverageMethodTreeNode methodNode = node as CodeCoverageMethodTreeNode;
CodeCoveragePropertyTreeNode propertyNode = node as CodeCoveragePropertyTreeNode;
if (classNode != null && classNode.Nodes.Count > 0) {
methodNode = (CodeCoverageMethodTreeNode)classNode.Nodes[0];
propertyNode = classNode.Nodes[0] as CodeCoveragePropertyTreeNode;
methodNode = classNode.Nodes[0] as CodeCoverageMethodTreeNode;
}
if (propertyNode != null && propertyNode.Nodes.Count > 0) {
methodNode = propertyNode.Nodes[0] as CodeCoverageMethodTreeNode;
}
if (methodNode != null && methodNode.Method.SequencePoints.Count > 0) {
@ -279,7 +291,6 @@ namespace ICSharpCode.CodeCoverage @@ -279,7 +291,6 @@ namespace ICSharpCode.CodeCoverage
foreach (CodeCoverageSequencePoint sequencePoint in sequencePoints) {
AddSequencePoint(sequencePoint);
}
}
void AddSequencePoint(CodeCoverageSequencePoint sequencePoint)
@ -308,13 +319,19 @@ namespace ICSharpCode.CodeCoverage @@ -308,13 +319,19 @@ namespace ICSharpCode.CodeCoverage
{
if (fileName != textEditorFileName) {
textEditor.Load(fileName);
textEditor.SyntaxHighlighting = GetSyntaxHighlighting(fileName);
}
textEditor.ScrollToEnd();
textEditor.TextArea.Caret.Location = new ICSharpCode.AvalonEdit.Document.TextLocation(line, column);
textEditor.TextArea.Caret.Location = new TextLocation(line, column);
textEditor.ScrollToLine(line);
CodeCoverageService.ShowCodeCoverage(new AvalonEditTextEditorAdapter(textEditor), fileName);
}
IHighlightingDefinition GetSyntaxHighlighting(string fileName)
{
return HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(fileName));
}
void CreateTreeView()
{
if (treeView != null) {
@ -488,9 +505,16 @@ namespace ICSharpCode.CodeCoverage @@ -488,9 +505,16 @@ namespace ICSharpCode.CodeCoverage
}
textEditor = AvalonEditTextEditorAdapter.CreateAvalonEditInstance();
textEditor.IsReadOnly = true;
textEditor.MouseDoubleClick += TextEditorDoubleClick;
var adapter = new AvalonEditTextEditorAdapter(textEditor);
var textMarkerService = new TextMarkerService(adapter.TextEditor.Document);
adapter.TextEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
adapter.TextEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
adapter.TextEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);
textEditorHost = new ElementHost();
textEditorHost.Dock = DockStyle.Fill;
textEditorHost.Child = textEditor;
@ -546,5 +570,13 @@ namespace ICSharpCode.CodeCoverage @@ -546,5 +570,13 @@ namespace ICSharpCode.CodeCoverage
DisposeTreeView();
}
}
protected override void Dispose(bool disposing)
{
if (textEditor != null) {
DisposeTextEditor();
}
base.Dispose(disposing);
}
}
}

59
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageMethod.cs

@ -5,6 +5,7 @@ using System; @@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
using ICSharpCode.Core;
namespace ICSharpCode.CodeCoverage
@ -15,20 +16,12 @@ namespace ICSharpCode.CodeCoverage @@ -15,20 +16,12 @@ namespace ICSharpCode.CodeCoverage
string className = String.Empty;
string fullClassName = String.Empty;
string classNamespace = String.Empty;
int methodBodySize;
MethodAttributes methodAttributes;
List<CodeCoverageSequencePoint> sequencePoints = new List<CodeCoverageSequencePoint>();
public CodeCoverageMethod(string name, string className)
: this(name, className, MethodAttributes.Public)
{
}
public CodeCoverageMethod(string name, string className, MethodAttributes methodAttributes)
{
this.name = name;
this.fullClassName = className;
this.methodAttributes = methodAttributes;
int index = fullClassName.LastIndexOf('.');
if (index > 0) {
@ -39,53 +32,29 @@ namespace ICSharpCode.CodeCoverage @@ -39,53 +32,29 @@ namespace ICSharpCode.CodeCoverage
}
}
public CodeCoverageMethod(string className, XmlReader reader)
: this(GetMethodName(reader), className, GetMethodAttributes(reader))
{
ReadMethodBodySize(reader);
}
static string GetMethodName(XmlReader reader)
public CodeCoverageMethod(string className, XElement reader)
: this(className, new CodeCoverageMethodElement(reader))
{
return reader.GetAttribute("name");
}
static MethodAttributes GetMethodAttributes(XmlReader reader)
public CodeCoverageMethod(string className, CodeCoverageMethodElement element)
: this(element.MethodName, className)
{
string flags = reader.GetAttribute("flags");
if (flags != null) {
try {
return (MethodAttributes)Enum.Parse(typeof(MethodAttributes), flags);
} catch (ArgumentException) { }
}
return MethodAttributes.Public;
}
void ReadMethodBodySize(XmlReader reader)
{
string bodySizeAsString = reader.GetAttribute("bodysize");
if (bodySizeAsString != null) {
methodBodySize = Int32.Parse(bodySizeAsString);
}
IsProperty = element.IsProperty && IsPropertyMethodName();
IsGetter = element.IsGetter;
IsSetter = element.IsSetter;
}
/// <summary>
/// Returns true if the method is a getter or setter method for a property.
/// </summary>
public bool IsProperty {
get {
return IsSpecialMethodName() && IsPropertyMethodName();
}
}
bool IsSpecialMethodName()
{
return (methodAttributes & MethodAttributes.SpecialName) == MethodAttributes.SpecialName;
}
public bool IsProperty { get; private set; }
public bool IsGetter { get; private set; }
public bool IsSetter { get; private set; }
bool IsPropertyMethodName()
{
return name.StartsWith("get_") || name.StartsWith("set_");
return name.Contains("get_") || name.Contains("set_");
}
public string Name {
@ -161,10 +130,6 @@ namespace ICSharpCode.CodeCoverage @@ -161,10 +130,6 @@ namespace ICSharpCode.CodeCoverage
public int GetUnvisitedCodeLength()
{
if (sequencePoints.Count == 0) {
return methodBodySize;
}
int total = 0;
foreach (CodeCoverageSequencePoint sequencePoint in sequencePoints) {
if (sequencePoint.VisitCount == 0) {

68
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageMethodElement.cs

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Xml.Linq;
namespace ICSharpCode.CodeCoverage
{
public class CodeCoverageMethodElement
{
XElement element;
public CodeCoverageMethodElement(XElement element)
{
this.element = element;
Init();
}
public bool IsGetter { get; private set; }
public bool IsSetter { get; private set; }
public string MethodName { get; private set; }
public bool IsProperty {
get { return IsGetter || IsSetter; }
}
void Init()
{
IsGetter = GetBooleanAttributeValue("isGetter");
IsSetter = GetBooleanAttributeValue("isSetter");
MethodName = GetMethodName();
}
bool GetBooleanAttributeValue(string name)
{
return GetBooleanAttributeValue(element.Attribute(name));
}
bool GetBooleanAttributeValue(XAttribute attribute)
{
if (attribute != null) {
bool value = false;
if (Boolean.TryParse(attribute.Value, out value)) {
return value;
}
}
return false;
}
string GetMethodName()
{
XElement nameElement = element.Element("Name");
if (nameElement != null) {
return GetMethodName(nameElement.Value);
}
return String.Empty;
}
string GetMethodName(string methodSignature)
{
int startIndex = methodSignature.IndexOf("::");
int endIndex = methodSignature.IndexOf('(', startIndex);
return methodSignature
.Substring(startIndex, endIndex - startIndex)
.Substring(2);
}
}
}

81
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageOptionsPanelXaml.xaml

@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<gui:OptionPanel
x:Class="ICSharpCode.CodeCoverage.CodeCoverageOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
<GroupBox
Header="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.CodeCoverageColoursGroupBoxText}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label
Content="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.DisplayItemsLabel}"></Label>
<Label
Grid.Column="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Content="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.ItemForegroundLabel}"></Label>
<gui:ColorPickerButton
Grid.Row="1" Grid.Column="3" VerticalAlignment="Center"
Value="{Binding ForeGroundColor}"
Text="...">
</gui:ColorPickerButton>
<Label
Grid.Row="2"
Grid.Column="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Content="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.ItemBackgroundLabel}"></Label>
<gui:ColorPickerButton
Grid.Row="3" Grid.Column="3" VerticalAlignment="Center"
Value="{Binding BackGroundColor}"
Text="...">
</gui:ColorPickerButton>
<ListView x:Name="displayItemsListBox"
Grid.Row="1" Grid.ColumnSpan="2" Grid.RowSpan="3"
ItemsSource="{Binding DisplayItems}"
SelectedIndex="0"
SelectedItem="{Binding DisplayItem}"
IsSynchronizedWithCurrentItem="True"></ListView>
<TextBlock
Grid.Row="6"
Grid.ColumnSpan="3"
Text="{core:Localize ICSharpCode.CodeCoverage.OptionsPanel.SampleText}"
TextAlignment="Center"
FontSize="15"
VerticalAlignment="Center">
<TextBlock.Foreground>
<SolidColorBrush Color="{Binding ForeGroundColor}"></SolidColorBrush>
</TextBlock.Foreground>
<TextBlock.Background>
<SolidColorBrush Color="{Binding BackGroundColor}"></SolidColorBrush>
</TextBlock.Background>
</TextBlock>
</Grid>
</GroupBox>
</gui:OptionPanel>

111
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageOptionsPanelXaml.xaml.cs

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 09.06.2012
* Time: 17:03
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Widgets;
namespace ICSharpCode.CodeCoverage
{
/// <summary>
/// Interaction logic for CodeCoverageOptionsPanelXaml.xaml
/// </summary>
public partial class CodeCoverageOptionsPanel : OptionPanel
{
public CodeCoverageOptionsPanel()
{
InitializeComponent();
DataContext = this;
DisplayItems = new ObservableCollection<CodeCoverageDisplayItem>();
DisplayItems.Add(new CodeCoverageDisplayItem(StringParser.Parse("${res:ICSharpCode.CodeCoverage.CodeCovered}"), CodeCoverageOptions.VisitedColorProperty, CodeCoverageOptions.VisitedColor, CodeCoverageOptions.VisitedForeColorProperty, CodeCoverageOptions.VisitedForeColor));
DisplayItems.Add(new CodeCoverageDisplayItem(StringParser.Parse("${res:ICSharpCode.CodeCoverage.CodeNotCovered}"), CodeCoverageOptions.NotVisitedColorProperty, CodeCoverageOptions.NotVisitedColor, CodeCoverageOptions.NotVisitedForeColorProperty, CodeCoverageOptions.NotVisitedForeColor));
DisplayItem = DisplayItems[0];
}
CodeCoverageDisplayItem displayItem;
public CodeCoverageDisplayItem DisplayItem {
get { return displayItem; }
set { displayItem = value;
base.RaisePropertyChanged(() => DisplayItem);
ShowColors();
}
}
private System.Windows.Media.Color foreGroundColor;
public Color ForeGroundColor {
get { return foreGroundColor; }
set {
foreGroundColor = value;
RaisePropertyChanged(() => ForeGroundColor);
DisplayItem.ForeColor = SetColor(ForeGroundColor);
}
}
private System.Windows.Media.Color backGroundColor;
public Color BackGroundColor {
get { return backGroundColor; }
set { backGroundColor = value;
RaisePropertyChanged(() => BackGroundColor);
DisplayItem.BackColor = SetColor(BackGroundColor);
}
}
public override bool SaveOptions()
{
bool codeCoverageColorsChanged = false;
foreach (CodeCoverageDisplayItem item in displayItemsListBox.Items) {
if (item.HasChanged) {
CodeCoverageOptions.Properties.Set<System.Drawing.Color>(item.ForeColorPropertyName, item.ForeColor);
CodeCoverageOptions.Properties.Set<System.Drawing.Color>(item.BackColorPropertyName, item.BackColor);
codeCoverageColorsChanged = true;
}
}
if (codeCoverageColorsChanged) {
CodeCoverageService.RefreshCodeCoverageHighlights();
}
return base.SaveOptions();
}
private void ShowColors()
{
System.Drawing.Color clr = DisplayItem.ForeColor;
ForeGroundColor = System.Windows.Media.Color.FromArgb(clr.A, clr.R, clr.G, clr.B);
clr = DisplayItem.BackColor;
BackGroundColor = System.Windows.Media.Color.FromArgb(clr.A, clr.R, clr.G, clr.B);
}
private System.Drawing.Color SetColor (System.Windows.Media.Color color)
{
return System.Drawing.Color.FromArgb(color.A,color.R,color.G,color.B);
}
public ObservableCollection<CodeCoverageDisplayItem> DisplayItems {get; private set;}
}
}

101
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.cs

@ -1,101 +0,0 @@ @@ -1,101 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
namespace ICSharpCode.CodeCoverage
{
public class CodeCoverageProjectOptionsPanel : AbstractXmlFormsProjectOptionPanel
{
static readonly string IncludeListTextBoxName = "includeListTextBox";
static readonly string ExcludeListTextBoxName = "excludeListTextBox";
TextBox includeListTextBox;
TextBox excludeListTextBox;
public CodeCoverageProjectOptionsPanel()
{
}
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.CodeCoverage.Resources.CodeCoverageProjectOptionsPanel.xfrm"));
InitializeHelper();
includeListTextBox = (TextBox)ControlDictionary[IncludeListTextBoxName];
excludeListTextBox = (TextBox)ControlDictionary[ExcludeListTextBoxName];
ReadPartCoverSettings();
includeListTextBox.TextChanged += TextBoxTextChanged;
excludeListTextBox.TextChanged += TextBoxTextChanged;
}
public override bool StorePanelContents()
{
SavePartCoverSettings();
IsDirty = false;
return true;
}
void TextBoxTextChanged(object sender, EventArgs e)
{
IsDirty = true;
}
void SavePartCoverSettings()
{
PartCoverSettings settings = new PartCoverSettings();
settings.Include.AddRange(RemoveEmptyStrings(includeListTextBox.Lines));
settings.Exclude.AddRange(RemoveEmptyStrings(excludeListTextBox.Lines));
settings.Save(PartCoverSettings.GetFileName(project));
}
void ReadPartCoverSettings()
{
string settingsFileName = PartCoverSettings.GetFileName(project);
if (File.Exists(settingsFileName)) {
PartCoverSettings settings = new PartCoverSettings(settingsFileName);
includeListTextBox.Text = ConvertToMultLineString(settings.Include);
excludeListTextBox.Text = ConvertToMultLineString(settings.Exclude);
}
}
/// <summary>
/// Each item in the string collection is added as a separate line
/// followed by a carriage return and line feed except the last
/// item.
/// </summary>
static string ConvertToMultLineString(StringCollection items)
{
StringBuilder text = new StringBuilder();
foreach (String item in items) {
text.Append(item);
text.Append("\r\n");
}
return text.ToString().Trim();
}
/// <summary>
/// Creates a new string array but with any lines that are empty
/// in the original lines array removed from it.
/// </summary>
static string[] RemoveEmptyStrings(string[] lines)
{
List<string> convertedLines = new List<string>();
foreach (string line in lines) {
if (line.Trim().Length > 0) {
convertedLines.Add(line);
}
}
return convertedLines.ToArray();
}
}
}

35
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.xaml

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CodeCoverage.CodeCoverageProjectOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
</Grid.RowDefinitions>
<Label Content="{core:Localize ICSharpCode.CodeCoverage.ProjectOptionsPanel.IncludeListLabel}"></Label>
<TextBox x:Name="includeListTextBox" Grid.Row="1" Margin="5,0,5,0"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
TextChanged="TextBox_TextChanged"
TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto">
</TextBox>
<Label Grid.Row="2" Content="{core:Localize ICSharpCode.CodeCoverage.ProjectOptionsPanel.ExcludeListLabel}"></Label>
<TextBox x:Name="excludeListTextBox" Grid.Row="3" Margin="5,0,5,0"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
TextChanged="TextBox_TextChanged"
TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" >
</TextBox>
</Grid>
</ScrollViewer>
</optionpanels:ProjectOptionPanel>

89
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.xaml.cs

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 09.06.2012
* Time: 15:01
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using System.Windows.Controls;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CodeCoverage
{
/// <summary>
/// Interaction logic for CodeCoverageOptionsPanelXaml.xaml
/// </summary>
public partial class CodeCoverageProjectOptionsPanel : ProjectOptionPanel
{
public CodeCoverageProjectOptionsPanel()
{
InitializeComponent();
}
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
ReadPartCoverSettings();
base.Load(project, configuration, platform);
}
protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
{
SavePartCoverSettings();
return base.Save(project, configuration, platform);
}
void ReadPartCoverSettings()
{
string settingsFileName = OpenCoverSettings.GetFileName(base.Project);
if (File.Exists(settingsFileName)) {
OpenCoverSettings settings = new OpenCoverSettings(settingsFileName);
includeListTextBox.Text = ConvertToMultLineString(settings.Include);
excludeListTextBox.Text = ConvertToMultLineString(settings.Exclude);
}
}
private void SavePartCoverSettings()
{
OpenCoverSettings settings = new OpenCoverSettings();
settings.Include.AddRange(MakeStringArray(includeListTextBox.Text));
settings.Exclude.AddRange(MakeStringArray(excludeListTextBox.Text));
settings.Save(OpenCoverSettings.GetFileName(base.Project));
}
private string[] MakeStringArray(string str)
{
return str.Split(new char[]{'\r','\n'}, StringSplitOptions.RemoveEmptyEntries);
}
/// <summary>
/// Each item in the string collection is added as a separate line
/// followed by a carriage return and line feed except the last
/// item.
/// </summary>
private static string ConvertToMultLineString(StringCollection items)
{
StringBuilder text = new StringBuilder();
foreach (String item in items) {
text.Append(item);
text.Append("\r\n");
}
return text.ToString().Trim();
}
void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
IsDirty = true;
}
}
}

14
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProperty.cs

@ -54,7 +54,7 @@ namespace ICSharpCode.CodeCoverage @@ -54,7 +54,7 @@ namespace ICSharpCode.CodeCoverage
public void AddMethod(CodeCoverageMethod method)
{
name = GetPropertyName(method);
if (CodeCoverageProperty.IsGetter(method)) {
if (method.IsGetter) {
getter = method;
} else {
setter = method;
@ -66,20 +66,10 @@ namespace ICSharpCode.CodeCoverage @@ -66,20 +66,10 @@ namespace ICSharpCode.CodeCoverage
/// </summary>
public static string GetPropertyName(CodeCoverageMethod method)
{
if (IsGetter(method) || IsSetter(method)) {
if (method.IsProperty) {
return method.Name.Substring(4);
}
return String.Empty;
}
public static bool IsGetter(CodeCoverageMethod method)
{
return method.Name.StartsWith("get_");
}
public static bool IsSetter(CodeCoverageMethod method)
{
return method.Name.StartsWith("set_");
}
}
}

102
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageResults.cs

@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Linq;
using System.Xml.Linq;
namespace ICSharpCode.CodeCoverage
{
@ -23,13 +23,13 @@ namespace ICSharpCode.CodeCoverage @@ -23,13 +23,13 @@ namespace ICSharpCode.CodeCoverage
{
}
public CodeCoverageResults(XmlReader reader)
public CodeCoverageResults(XContainer reader)
{
ReadResults(reader);
}
public CodeCoverageResults(TextReader reader)
: this(new XmlTextReader(reader))
: this(XDocument.Load(reader))
{
}
@ -46,60 +46,76 @@ namespace ICSharpCode.CodeCoverage @@ -46,60 +46,76 @@ namespace ICSharpCode.CodeCoverage
get { return modules; }
}
void ReadResults(XmlReader reader)
void ReadResults(XContainer reader)
{
CodeCoverageModule currentModule = null;
CodeCoverageMethod currentMethod = null;
string currentClassName = String.Empty;
while (reader.Read()) {
switch (reader.NodeType) {
case XmlNodeType.Element:
if (reader.Name == "Type") {
currentModule = AddModule(reader);
currentClassName = reader.GetAttribute("name");
} else if ((reader.Name == "Method") && (currentModule != null)) {
currentMethod = AddMethod(currentModule, currentClassName, reader);
} else if ((reader.Name == "pt") && (currentMethod != null)) {
AddSequencePoint(currentMethod, reader);
} else if (reader.Name == "File") {
AddFileName(reader);
} else if (reader.Name == "Assembly") {
AddAssembly(reader);
IEnumerable<XElement> modules = reader.Descendants("Module").Where(m => m.Attribute("skippedDueTo") == null);
foreach (XElement file in reader.Descendants("File")) {
AddFileName(file);
}
foreach (XElement assembly in modules) {
AddAssembly(assembly);
RegisterAssembly(assembly);
}
break;
}
private void RegisterAssembly(XElement assembly)
{
var classNames =
assembly.Elements("Classes").Elements("Class").Where(
c =>
!c.Element("FullName").Value.Contains("__") && !c.Element("FullName").Value.Contains("<") &&
!c.Element("FullName").Value.Contains("/") && c.Attribute("skippedDueTo") == null).Select(
c => c.Element("FullName").Value).Distinct().OrderBy(name => name);
foreach (string className in classNames) {
AddModule(assembly, className);
}
reader.Close();
}
/// <summary>
/// Add module if it does not already exist.
/// </summary>
CodeCoverageModule AddModule(XmlReader reader)
CodeCoverageModule AddModule(XElement reader, string className)
{
string assemblyName = GetAssemblyName(reader);
CodeCoverageModule module = null;
foreach (CodeCoverageModule existingModule in modules) {
if (existingModule.Name == assemblyName) {
return existingModule;
module = existingModule;
break;
}
}
CodeCoverageModule module = new CodeCoverageModule(assemblyName);
if (module == null) {
module = new CodeCoverageModule(assemblyName);
modules.Add(module);
}
var methods = reader
.Elements("Classes")
.Elements("Class")
.Where(c => c.Element("FullName").Value.StartsWith(className, StringComparison.Ordinal))
.Elements("Methods")
.Elements("Method");
foreach (XElement method in methods) {
AddMethod(module, className, method);
}
return module;
}
string GetAssemblyName(XmlReader reader)
string GetAssemblyName(XElement reader)
{
string id = reader.GetAttribute("asmref");
string id = reader.Attribute("hash").Value;
return GetAssembly(id);
}
CodeCoverageMethod AddMethod(CodeCoverageModule module, string className, XmlReader reader)
CodeCoverageMethod AddMethod(CodeCoverageModule module, string className, XElement reader)
{
CodeCoverageMethod method = new CodeCoverageMethod(className, reader);
module.Methods.Add(method);
var points = reader
.Elements("SequencePoints")
.Elements("SequencePoint");
foreach (XElement point in points) {
AddSequencePoint(method, point, reader);
}
return method;
}
@ -109,20 +125,20 @@ namespace ICSharpCode.CodeCoverage @@ -109,20 +125,20 @@ namespace ICSharpCode.CodeCoverage
/// for types that are not part of the project but types from
/// the .NET framework.
/// </summary>
void AddSequencePoint(CodeCoverageMethod method, XmlReader reader)
void AddSequencePoint(CodeCoverageMethod method, XElement reader, XElement methodNode)
{
string fileName = GetFileName(reader);
string fileName = GetFileName(methodNode);
CodeCoverageSequencePoint sequencePoint =
new CodeCoverageSequencePoint(fileName, reader);
method.SequencePoints.Add(sequencePoint);
}
string GetFileName(XmlReader reader)
string GetFileName(XElement reader)
{
string fileId = reader.GetAttribute("fid");
XElement fileId = reader.Element("FileRef");
if (fileId != null) {
return GetFileName(fileId);
return GetFileName(fileId.Attribute("uid").Value);
}
return String.Empty;
}
@ -156,20 +172,20 @@ namespace ICSharpCode.CodeCoverage @@ -156,20 +172,20 @@ namespace ICSharpCode.CodeCoverage
/// <summary>
/// Saves the filename and its associated id for reference.
/// </summary>
void AddFileName(XmlReader reader)
void AddFileName(XElement reader)
{
string id = reader.GetAttribute("id");
string fileName = reader.GetAttribute("url");
string id = reader.Attribute("uid").Value;
string fileName = reader.Attribute("fullPath").Value;
fileNames.Add(id, fileName);
}
/// <summary>
/// Saves the assembly and its associated id for reference.
/// </summary>
void AddAssembly(XmlReader reader)
void AddAssembly(XElement reader)
{
string id = reader.GetAttribute("id");
string name = reader.GetAttribute("name");
string id = reader.Attribute("hash").Value;
string name = reader.Element("ModuleName").Value;
assemblies.Add(id, name);
}
}

16
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageSequencePoint.cs

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Xml;
using System.Xml.Linq;
namespace ICSharpCode.CodeCoverage
{
@ -25,28 +25,28 @@ namespace ICSharpCode.CodeCoverage @@ -25,28 +25,28 @@ namespace ICSharpCode.CodeCoverage
this.Column = column;
this.EndLine = endLine;
this.EndColumn = endColumn;
this.Length = length;
this.Length = 1;
}
public CodeCoverageSequencePoint(string document, XmlReader reader)
public CodeCoverageSequencePoint(string document, XElement reader)
{
this.Document = document;
Read(reader);
}
void Read(XmlReader reader)
void Read(XElement reader)
{
VisitCount = GetInteger(reader, "visit");
VisitCount = GetInteger(reader, "vc");
Line = GetInteger(reader, "sl");
Column = GetInteger(reader, "sc");
EndLine = GetInteger(reader, "el");
EndColumn = GetInteger(reader, "ec");
Length = GetInteger(reader, "len");
Length = 1; // TODO: need to find a way to get this. GetInteger(reader, "len");
}
int GetInteger(XmlReader reader, string attributeName)
int GetInteger(XElement reader, string attributeName)
{
string attributeValue = reader.GetAttribute(attributeName);
string attributeValue = reader.Attribute(attributeName).Value;
return GetInteger(attributeValue);
}

10
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageTestRunner.cs

@ -14,8 +14,8 @@ namespace ICSharpCode.CodeCoverage @@ -14,8 +14,8 @@ namespace ICSharpCode.CodeCoverage
{
UnitTestingOptions options;
IFileSystem fileSystem;
PartCoverApplication partCoverApplication;
PartCoverSettingsFactory settingsFactory;
OpenCoverApplication partCoverApplication;
OpenCoverSettingsFactory settingsFactory;
public CodeCoverageTestRunner()
: this(new CodeCoverageTestRunnerContext())
@ -27,7 +27,7 @@ namespace ICSharpCode.CodeCoverage @@ -27,7 +27,7 @@ namespace ICSharpCode.CodeCoverage
{
this.options = context.Options;
this.fileSystem = context.CodeCoverageFileSystem;
settingsFactory = new PartCoverSettingsFactory(fileSystem);
settingsFactory = new OpenCoverSettingsFactory(fileSystem);
}
public bool HasCodeCoverageResults()
@ -66,8 +66,8 @@ namespace ICSharpCode.CodeCoverage @@ -66,8 +66,8 @@ namespace ICSharpCode.CodeCoverage
NUnitConsoleApplication nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options);
nunitConsoleApp.Results = base.TestResultsMonitor.FileName;
PartCoverSettings settings = settingsFactory.CreatePartCoverSettings(selectedTests.Project);
partCoverApplication = new PartCoverApplication(nunitConsoleApp, settings);
OpenCoverSettings settings = settingsFactory.CreateOpenCoverSettings(selectedTests.Project);
partCoverApplication = new OpenCoverApplication(nunitConsoleApp, settings);
}
void RemoveExistingCodeCoverageResultsFile()

41
src/AddIns/Analysis/CodeCoverage/Project/Src/PartCoverApplication.cs → src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverApplication.cs

@ -12,14 +12,14 @@ using ICSharpCode.UnitTesting; @@ -12,14 +12,14 @@ using ICSharpCode.UnitTesting;
namespace ICSharpCode.CodeCoverage
{
public class PartCoverApplication
public class OpenCoverApplication
{
string fileName = String.Empty;
NUnitConsoleApplication nunitConsoleApp;
PartCoverSettings settings;
OpenCoverSettings settings;
StringBuilder arguments;
public PartCoverApplication(string fileName, NUnitConsoleApplication nunitConsoleApp, PartCoverSettings settings)
public OpenCoverApplication(string fileName, NUnitConsoleApplication nunitConsoleApp, OpenCoverSettings settings)
{
this.fileName = fileName;
this.nunitConsoleApp = nunitConsoleApp;
@ -30,18 +30,18 @@ namespace ICSharpCode.CodeCoverage @@ -30,18 +30,18 @@ namespace ICSharpCode.CodeCoverage
}
}
public PartCoverApplication(NUnitConsoleApplication nunitConsoleApp, PartCoverSettings settings)
public OpenCoverApplication(NUnitConsoleApplication nunitConsoleApp, OpenCoverSettings settings)
: this(null, nunitConsoleApp, settings)
{
}
void GetPartCoverApplicationFileName()
{
fileName = Path.Combine(FileUtility.ApplicationRootPath, @"bin\Tools\PartCover\PartCover.exe");
fileName = Path.Combine(FileUtility.ApplicationRootPath, @"bin\Tools\OpenCover\OpenCover.Console.exe");
fileName = Path.GetFullPath(fileName);
}
public PartCoverSettings Settings {
public OpenCoverSettings Settings {
get { return settings; }
}
@ -76,7 +76,7 @@ namespace ICSharpCode.CodeCoverage @@ -76,7 +76,7 @@ namespace ICSharpCode.CodeCoverage
string GetOutputDirectory(IProject project)
{
return Path.Combine(project.Directory, "PartCover");
return Path.Combine(project.Directory, "OpenCover");
}
public ProcessStartInfo GetProcessStartInfo()
@ -89,37 +89,44 @@ namespace ICSharpCode.CodeCoverage @@ -89,37 +89,44 @@ namespace ICSharpCode.CodeCoverage
string GetArguments()
{
arguments = new StringBuilder();
// IMPORTANT: https://github.com/sawilde/opencover/wiki/Usage
arguments = new StringBuilder("-register:user ");
AppendTarget();
AppendTargetWorkingDirectory();
AppendTargetArguments();
AppendCodeCoverageResultsFileName();
AppendIncludedItems();
AppendExcludedItems();
AppendFilter();
return arguments.ToString().Trim();
}
void AppendTarget()
{
arguments.AppendFormat("--target \"{0}\" ", Target);
arguments.AppendFormat("-target:\"{0}\" ", Target);
}
void AppendTargetWorkingDirectory()
{
arguments.AppendFormat("--target-work-dir \"{0}\" ", GetTargetWorkingDirectory());
arguments.AppendFormat("-targetdir:\"{0}\" ", GetTargetWorkingDirectory());
}
void AppendTargetArguments()
{
string targetArguments = GetTargetArguments();
arguments.AppendFormat("--target-args \"{0}\" ", targetArguments.Replace("\"", "\\\""));
arguments.AppendFormat("-targetargs:\"{0}\" ", targetArguments.Replace("\"", "\\\""));
}
void AppendCodeCoverageResultsFileName()
{
arguments.AppendFormat("--output \"{0}\" ", CodeCoverageResultsFileName);
arguments.AppendFormat("-output:\"{0}\" ", CodeCoverageResultsFileName);
}
void AppendFilter()
{
arguments.Append("-filter:\"");
AppendIncludedItems();
AppendExcludedItems();
arguments.Append("\"");
}
void AppendIncludedItems()
@ -128,13 +135,13 @@ namespace ICSharpCode.CodeCoverage @@ -128,13 +135,13 @@ namespace ICSharpCode.CodeCoverage
if (includedItems.Count == 0) {
includedItems.Add("[*]*");
}
AppendItems("--include", includedItems);
AppendItems("+", includedItems);
}
void AppendExcludedItems()
{
AppendEmptySpace();
AppendItems("--exclude", settings.Exclude);
AppendItems("-", settings.Exclude);
}
void AppendEmptySpace()

28
src/AddIns/Analysis/CodeCoverage/Project/Src/PartCoverSettings.cs → src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverSettings.cs

@ -12,43 +12,43 @@ using ICSharpCode.SharpDevelop.Project; @@ -12,43 +12,43 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CodeCoverage
{
/// <summary>
/// File that stores PartCover settings. This file has the same format as
/// PartCover requires, but is actually just used by the Code Coverage addin
/// File that stores OpenCover settings. This file has the same format as
/// OpenCover requires, but is actually just used by the Code Coverage addin
/// as a place to store the include and exclude regular expressions that the
/// user may set up on a per project basis.
/// </summary>
public class PartCoverSettings
public class OpenCoverSettings
{
static readonly string RootElementName = "PartCoverSettings";
static readonly string RootElementName = "OpenCoverSettings";
static readonly string RuleElementName = "Rule";
StringCollection include = new StringCollection();
StringCollection exclude = new StringCollection();
public PartCoverSettings()
public OpenCoverSettings()
{
}
public PartCoverSettings(string fileName)
public OpenCoverSettings(string fileName)
: this(new StreamReader(fileName, true))
{
}
public PartCoverSettings(XmlReader reader)
public OpenCoverSettings(XmlReader reader)
{
ReadSettings(reader);
}
public PartCoverSettings(TextReader reader)
public OpenCoverSettings(TextReader reader)
: this(new XmlTextReader(reader))
{
}
/// <summary>
/// Gets the NCover settings filename for the specified project.
/// Gets the OpenCover settings filename for the specified project.
/// </summary>
public static string GetFileName(IProject project)
{
return Path.ChangeExtension(project.FileName, "PartCover.Settings");
return Path.ChangeExtension(project.FileName, "OpenCover.Settings");
}
/// <summary>
@ -66,7 +66,7 @@ namespace ICSharpCode.CodeCoverage @@ -66,7 +66,7 @@ namespace ICSharpCode.CodeCoverage
}
/// <summary>
/// Writes the PartCover settings to the specified text writer.
/// Writes the OpenCover settings to the specified text writer.
/// </summary>
public void Save(TextWriter writer)
{
@ -74,7 +74,7 @@ namespace ICSharpCode.CodeCoverage @@ -74,7 +74,7 @@ namespace ICSharpCode.CodeCoverage
}
/// <summary>
/// Saves the PartCover settings to the specified file.
/// Saves the OpenCover settings to the specified file.
/// </summary>
public void Save(string fileName)
{
@ -82,7 +82,7 @@ namespace ICSharpCode.CodeCoverage @@ -82,7 +82,7 @@ namespace ICSharpCode.CodeCoverage
}
/// <summary>
/// Writes the PartCover settings to the specified XmlTextWriter.
/// Writes the OpenCover settings to the specified XmlTextWriter.
/// </summary>
public void Save(XmlTextWriter writer)
{
@ -98,7 +98,7 @@ namespace ICSharpCode.CodeCoverage @@ -98,7 +98,7 @@ namespace ICSharpCode.CodeCoverage
/// <summary>
/// Reads the include and exclude regular expressions from the
/// PartCover settings xml.
/// OpenCover settings xml.
/// </summary>
void ReadSettings(XmlReader reader)
{

18
src/AddIns/Analysis/CodeCoverage/Project/Src/PartCoverSettingsFactory.cs → src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverSettingsFactory.cs

@ -7,33 +7,33 @@ using ICSharpCode.SharpDevelop.Project; @@ -7,33 +7,33 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CodeCoverage
{
public class PartCoverSettingsFactory
public class OpenCoverSettingsFactory
{
IFileSystem fileSystem;
public PartCoverSettingsFactory(IFileSystem fileSystem)
public OpenCoverSettingsFactory(IFileSystem fileSystem)
{
this.fileSystem = fileSystem;
}
public PartCoverSettingsFactory()
public OpenCoverSettingsFactory()
: this(new FileSystem())
{
}
public PartCoverSettings CreatePartCoverSettings(IProject project)
public OpenCoverSettings CreateOpenCoverSettings(IProject project)
{
string fileName = PartCoverSettings.GetFileName(project);
string fileName = OpenCoverSettings.GetFileName(project);
if (fileSystem.FileExists(fileName)) {
return CreatePartCoverSettingsFromFile(fileName);
return CreateOpenCoverSettingsFromFile(fileName);
}
return new PartCoverSettings();
return new OpenCoverSettings();
}
PartCoverSettings CreatePartCoverSettingsFromFile(string fileName)
OpenCoverSettings CreateOpenCoverSettingsFromFile(string fileName)
{
TextReader reader = fileSystem.CreateTextReader(fileName);
return new PartCoverSettings(reader);
return new OpenCoverSettings(reader);
}
}
}

2
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageOptionsPanel.cs → src/AddIns/Analysis/CodeCoverage/Project/Src/old_CodeCoverageOptionsPanel.cs

@ -10,7 +10,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -10,7 +10,7 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.CodeCoverage
{
public class CodeCoverageOptionsPanel : XmlFormsOptionPanel
public class old_CodeCoverageOptionsPanel : XmlFormsOptionPanel
{
static readonly string foregroundCustomColourButtonName = "foregroundCustomColourButton";
static readonly string backgroundCustomColourButtonName = "backgroundCustomColourButton";

26
src/AddIns/Analysis/CodeCoverage/Test/CodeCoverage.Tests.csproj

@ -51,12 +51,16 @@ @@ -51,12 +51,16 @@
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Microsoft.Build.Engine" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Coverage\CodeCoverageMethodElementTests.cs" />
<Compile Include="Coverage\CodeCoverageNamespaceTestFixture.cs" />
<Compile Include="Coverage\CodeCoveragePropertyCollectionWithGetterAndSetterTestFixture.cs" />
<Compile Include="Coverage\CodeCoveragePropertyTestFixture.cs" />
@ -69,9 +73,9 @@ @@ -69,9 +73,9 @@
<Compile Include="Coverage\InvalidSequencePointDataTestFixture.cs" />
<Compile Include="Coverage\MethodHasNoNamespaceTestFixture.cs" />
<Compile Include="Coverage\ModuleVisitedSequencePointsTestFixture.cs" />
<Compile Include="Coverage\PartCoverSettingsFactoryTests.cs" />
<Compile Include="Coverage\PartCoverSettingsMissingRulePrefixTestFixture.cs" />
<Compile Include="Coverage\PartCoverSettingsTestFixture.cs" />
<Compile Include="Coverage\OpenCoverSettingsFactoryTests.cs" />
<Compile Include="Coverage\OpenCoverSettingsMissingRulePrefixTestFixture.cs" />
<Compile Include="Coverage\OpenCoverSettingsTestFixture.cs" />
<Compile Include="Coverage\RemoveTaskMarkerTests.cs" />
<Compile Include="Coverage\SequencePointTests.cs" />
<Compile Include="Coverage\SimilarRootNamespaceTestFixture.cs" />
@ -88,17 +92,21 @@ @@ -88,17 +92,21 @@
<Compile Include="Highlighting\CodeCoverageMarkersInvalidStartLineTestFixture.cs" />
<Compile Include="Highlighting\RemoveCodeCoverageMarkersTestFixture.cs" />
<Compile Include="Testing\CodeCoverageTestRunnerTests.cs" />
<Compile Include="Testing\PartCoverApplicationTests.cs" />
<Compile Include="Testing\OpenCoverApplicationTests.cs" />
<Compile Include="Testing\RunTestWithCodeCoverageCommandTests.cs" />
<Compile Include="Utils\CodeCoverageMethodXElementBuilder.cs" />
<Compile Include="Utils\DerivedCodeCoverageTestRunner.cs" />
<Compile Include="Utils\DerivedRunTestWithCodeCoverageCommand.cs" />
<Compile Include="Gui\ClassWithNoNamespaceInTreeViewTestFixture.cs" />
<Compile Include="Gui\CodeCoverageTreeViewTestFixture.cs" />
<Compile Include="Gui\ListViewSortingTestFixture.cs" />
<Compile Include="Gui\TreeViewAfterSelectTestFixture.cs" />
<Compile Include="Utils\DerivedCodeCoverageTreeView.cs" />
<Compile Include="Utils\DerivedCodeCoverageTreeView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Utils\MockCodeCoverageTestRunnerFactory.cs" />
<Compile Include="Utils\MockFileSystem.cs" />
<Compile Include="Utils\XElementExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
@ -135,13 +143,7 @@ @@ -135,13 +143,7 @@
<Name>ICSharpCode.SharpDevelop.Dom</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Coverage" />
<Folder Include="Highlighting" />
<Folder Include="Testing" />
<Folder Include="Utils" />
<Folder Include="Gui" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="..\..\..\..\..\AddIns\Analysis\UnitTesting\UnitTesting.dll">
<Link>UnitTesting.dll</Link>

176
src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageMethodElementTests.cs

@ -0,0 +1,176 @@ @@ -0,0 +1,176 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Xml.Linq;
using ICSharpCode.CodeCoverage.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.CodeCoverage.Tests.Coverage
{
[TestFixture]
public class CodeCoverageMethodElementTests
{
CodeCoverageMethodElement methodElement;
void CreateMethod(string name)
{
XElement element = CodeCoverageMethodXElementBuilder.CreateMethod("MyClass", name);
CreateMethod(element);
}
void CreateMethod(XElement element)
{
methodElement = new CodeCoverageMethodElement(element);
}
void CreatePropertyGetterMethod(string propertyName)
{
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertyGetter("MyClass", propertyName);
CreateMethod(element);
}
void CreatePropertySetterMethod(string propertyName)
{
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertySetter("MyClass", propertyName);
CreateMethod(element);
}
void CreatePropertyGetterWithInvalidAttributeValue(string propertyName)
{
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertyGetter("MyClass", propertyName);
element.SetIsGetterAttributeValue("INVALID");
CreateMethod(element);
}
void CreatePropertySetterWithInvalidAttributeValue(string propertyName)
{
XElement element = CodeCoverageMethodXElementBuilder.CreateIntegerPropertySetter("MyClass", propertyName);
element.SetIsSetterAttributeValue("INVALID");
CreateMethod(element);
}
void CreateMethodWithSignature(string methodSignature)
{
var builder = new CodeCoverageMethodXElementBuilder(methodSignature);
CreateMethod(builder.MethodElement);
}
void CreateMethodElementThatHasNoNameElement()
{
var builder = new CodeCoverageMethodXElementBuilder(String.Empty);
builder.MethodElement.RemoveNodes();
CreateMethod(builder.MethodElement);
}
[Test]
public void IsGetter_MethodIsNotProperty_ReturnsFalse()
{
CreateMethod("MyMethod");
bool result = methodElement.IsGetter;
Assert.IsFalse(result);
}
[Test]
public void IsProperty_MethodIsNotProperty_ReturnsFalse()
{
CreateMethod("MyMethod");
bool result = methodElement.IsProperty;
Assert.IsFalse(result);
}
[Test]
public void IsGetter_MethodIsPropertyGetter_ReturnsTrue()
{
CreatePropertyGetterMethod("Count");
bool result = methodElement.IsGetter;
Assert.IsTrue(result);
}
[Test]
public void IsGetter_MethodIsPropertyGetterButAttributeValueIsNotValidBooleanValue_ReturnsFalse()
{
CreatePropertyGetterWithInvalidAttributeValue("Count");
bool result = methodElement.IsGetter;
Assert.IsFalse(result);
}
[Test]
public void IsProperty_MethodIsPropertyGetter_ReturnsTrue()
{
CreatePropertyGetterMethod("Count");
bool result = methodElement.IsProperty;
Assert.IsTrue(result);
}
[Test]
public void IsSetter_MethodIsNotProperty_ReturnsFalse()
{
CreateMethod("MyMethod");
bool result = methodElement.IsSetter;
Assert.IsFalse(result);
}
[Test]
public void IsSetter_MethodIsPropertySetter_ReturnsTrue()
{
CreatePropertySetterMethod("Count");
bool result = methodElement.IsSetter;
Assert.IsTrue(result);
}
[Test]
public void IsProperty_MethodIsPropertySetter_ReturnsTrue()
{
CreatePropertySetterMethod("Count");
bool result = methodElement.IsProperty;
Assert.IsTrue(result);
}
[Test]
public void IsSetter_MethodIsPropertySetterButAttributeValueIsNotValidBooleanValue_ReturnsFalse()
{
CreatePropertySetterWithInvalidAttributeValue("Count");
bool result = methodElement.IsSetter;
Assert.IsFalse(result);
}
[Test]
public void MethodName_ElementHasFullMethodSignature_ReturnsMethodName()
{
CreateMethodWithSignature("System.Void MyClass::MyMethod(System.Int32)");
string methodName = methodElement.MethodName;
Assert.AreEqual("MyMethod", methodName);
}
[Test]
public void MethodName_ElementHasNoNameElement_ReturnsEmptyString()
{
CreateMethodElementThatHasNoNameElement();
string methodName = methodElement.MethodName;
Assert.AreEqual(String.Empty, methodName);
}
}
}

19
src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoveragePropertyCollectionWithGetterAndSetterTestFixture.cs

@ -3,7 +3,10 @@ @@ -3,7 +3,10 @@
using System;
using System.Reflection;
using System.Xml.Linq;
using ICSharpCode.CodeCoverage;
using ICSharpCode.CodeCoverage.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.CodeCoverage.Tests.Coverage
@ -20,12 +23,24 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -20,12 +23,24 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
CodeCoverageMethod setterMethod;
CodeCoverageProperty property;
XElement CreatePropertySetter(string className, string propertyName)
{
return CodeCoverageMethodXElementBuilder.CreatePropertySetter(className, propertyName, "System.Int32");
}
XElement CreatePropertyGetter(string className, string propertyName)
{
return CodeCoverageMethodXElementBuilder.CreatePropertyGetter(className, propertyName, "System.Int32");
}
[TestFixtureSetUp]
public void SetUpFixture()
{
properties = new CodeCoveragePropertyCollection();
getterMethod = new CodeCoverageMethod("get_Count", "MyTests", MethodAttributes.SpecialName);
setterMethod = new CodeCoverageMethod("set_Count", "MyTests", MethodAttributes.SpecialName);
XElement getterElement = CreatePropertyGetter("MyTests", "Count");
getterMethod = new CodeCoverageMethod("MyTests", getterElement);
XElement setterElement = CreatePropertySetter("MyTests", "Count");
setterMethod = new CodeCoverageMethod("MyTests", setterElement);
properties.Add(getterMethod);
properties.Add(setterMethod);

26
src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoveragePropertyTestFixture.cs

@ -4,7 +4,9 @@ @@ -4,7 +4,9 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Xml.Linq;
using ICSharpCode.CodeCoverage;
using ICSharpCode.CodeCoverage.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.CodeCoverage.Tests.Coverage
@ -18,8 +20,20 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -18,8 +20,20 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
[SetUp]
public void Init()
{
getter = new CodeCoverageMethod("get_Count", "MyTest", MethodAttributes.SpecialName);
setter = new CodeCoverageMethod("set_Count", "MyTest", MethodAttributes.SpecialName);
XElement getterElement = CreateGetterElement("MyTest", "Count");
getter = new CodeCoverageMethod("MyTest", getterElement);
XElement setterElement = CreateSetterElement("MyTest", "Count");
setter = new CodeCoverageMethod("MyTest", setterElement);
}
XElement CreateGetterElement(string className, string propertyName)
{
return CodeCoverageMethodXElementBuilder.CreateIntegerPropertyGetter(className, propertyName);
}
XElement CreateSetterElement(string className, string propertyName)
{
return CodeCoverageMethodXElementBuilder.CreateIntegerPropertySetter(className, propertyName);
}
[Test]
@ -44,13 +58,17 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -44,13 +58,17 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
[Test]
public void GetterMethodIsGetterProperty()
{
Assert.IsTrue(CodeCoverageProperty.IsGetter(getter));
bool result = getter.IsGetter;
Assert.IsTrue(result);
}
[Test]
public void SetterMethodIsSetterProperty()
{
Assert.IsTrue(CodeCoverageProperty.IsSetter(setter));
bool result = setter.IsSetter;
Assert.IsTrue(result);
}
[Test]

69
src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsMissingFileIdTestFixture.cs

@ -20,26 +20,55 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -20,26 +20,55 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
[SetUp]
public void SetUpFixture()
{
string xml = "<PartCoverReport ver=\"1.0.2796.35184\">\r\n" +
"<File id=\"1\" url=\"c:\\test\\MyTests\\Class1.cs\" />\r\n" +
"<Assembly id=\"1\" name=\"MyTests.Tests\" module=\"C:\\Projects\\Test\\MyTests\\bin\\MyTests.DLL\" domain=\"test-domain-MyTests.dll\" domainIdx=\"1\" />\r\n" +
"<Assembly id=\"2\" name=\"nunit.framework\" module=\"C:\\Projects\\Test\\MyTests\\bin\\nunit.framework.DLL\" domain=\"test-domain-nunit.framework.dll\" domainIdx=\"1\" />\r\n" +
"<Type asmref=\"2\" name=\"NUnit.Framework.NotEqualAsserter\" flags=\"1233408\">\r\n" +
" <Method name=\"Fail\" sig=\"bool ()\" flags=\"134\" iflags=\"0\">\r\n" +
" <pt visit=\"1\" pos=\"11\" len=\"1\" />\r\n" +
" <pt visit=\"0\" pos=\"6\" len=\"5\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"6\" />\r\n" +
" </Method>\r\n" +
"</Type>\r\n" +
"<Type asmref=\"1\" name=\"MyClass\" flags=\"1233248\">\r\n" +
" <Method name=\".ctor\" sig=\"void ()\" flags=\"6278\" iflags=\"0\">\r\n" +
" <pt visit=\"0\" pos=\"8\" len=\"2\" fid=\"1\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
" <pt visit=\"0\" pos=\"7\" len=\"1\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"7\" fid=\"1\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"7\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
" </Method>\r\n" +
"</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7B\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\MyTests\\bin\\nunit.framework.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>nunit.framework</ModuleName>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>NUnit.Framework.NotEqualAsserter</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Boolean NUnit.Framework.NotEqualAsserter::Fail()</Name>\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\MyTests\\bin\\MyTests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>MyTests.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\test\\MyTests\\Class1.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>MyTests.Tests.MyClass</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void MyTests.Tests.MyClass::.ctor()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
base.CreateCodeCoverageResults(xml);
}

98
src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsPropertyFlagsTestFixture.cs

@ -19,36 +19,74 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -19,36 +19,74 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void SetUpFixture()
{
string xml =
"<PartCoverReport ver=\"1.0.2796.35184\">\r\n" +
" <File id=\"1\" url=\"d:\\Projects\\test\\TestFixture1.cs\" />\r\n" +
" <Assembly id=\"1\" name=\"MyTests\" module=\"C:\\Projects\\Test\\MyTests\\bin\\MyTests.DLL\" domain=\"test-domain-MyTests.dll\" domainIdx=\"1\" />\r\n" +
" <Type asmref=\"1\" name=\"MyTests.Class1\" flags=\"2606412\">\r\n" +
" <Method name=\"set_Count\" sig=\"void (int)\" flags=\"2182\" iflags=\"0\">\r\n" +
" <pt visit=\"0\" pos=\"9\" len=\"1\" fid=\"1\" sl=\"34\" sc=\"4\" el=\"34\" ec=\"5\" />\r\n" +
" <pt visit=\"0\" pos=\"1\" len=\"8\" fid=\"1\" sl=\"33\" sc=\"5\" el=\"33\" ec=\"12\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"32\" sc=\"8\" el=\"32\" ec=\"9\" />\r\n" +
" </Method>\r\n" +
" <Method name=\"get_Count\" sig=\"int ()\" flags=\"2182\" iflags=\"0\">\r\n" +
" <pt visit=\"0\" pos=\"6\" len=\"2\" fid=\"1\" sl=\"31\" sc=\"4\" el=\"31\" ec=\"5\" />\r\n" +
" <pt visit=\"0\" pos=\"1\" len=\"5\" fid=\"1\" sl=\"30\" sc=\"5\" el=\"30\" ec=\"15\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"29\" sc=\"8\" el=\"29\" ec=\"9\" />\r\n" +
" </Method>\r\n" +
" <Method name=\"get_NotAProperty\" sig=\"void ()\" flags=\"134\" iflags=\"0\">\r\n" +
" <pt visit=\"0\" pos=\"1\" len=\"1\" fid=\"1\" sl=\"26\" sc=\"3\" el=\"26\" ec=\"4\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"25\" sc=\"3\" el=\"25\" ec=\"4\" />\r\n" +
" </Method>\r\n" +
" <Method name=\"PropertyFlagsButJustAMethod\" sig=\"void ()\" flags=\"2182\" iflags=\"0\">\r\n" +
" <pt visit=\"0\" pos=\"8\" len=\"2\" fid=\"1\" sl=\"22\" sc=\"3\" el=\"22\" ec=\"4\" />\r\n" +
" <pt visit=\"0\" pos=\"7\" len=\"1\" fid=\"1\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"7\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"18\" />\r\n" +
" </Method>\r\n" +
" <Method name=\"InvalidFlags\" sig=\"void ()\" flags=\"\" iflags=\"0\">\r\n" +
" <pt visit=\"0\" pos=\"8\" len=\"2\" fid=\"1\" sl=\"22\" sc=\"3\" el=\"22\" ec=\"4\" />\r\n" +
" <pt visit=\"0\" pos=\"7\" len=\"1\" fid=\"1\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"7\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"18\" />\r\n" +
" </Method>\r\n" +
" </Type>\r\n" +
"</PartCoverReport>";
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7B\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\MyTests\\bin\\MyTests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>MyTests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"d:\\Projects\\test\\TestFixture1.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>MyTests.Class1</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"true\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void MyTests.MyClass1::set_Count(System.Int32)</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"34\" sc=\"4\" el=\"34\" ec=\"5\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"33\" sc=\"5\" el=\"33\" ec=\"12\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"32\" sc=\"8\" el=\"32\" ec=\"9\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"true\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Int32 MyTests.MyClass1::get_Count())</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"31\" sc=\"4\" el=\"31\" ec=\"5\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"30\" sc=\"5\" el=\"30\" ec=\"15\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"29\" sc=\"8\" el=\"29\" ec=\"9\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void MyTests.MyClass1::get_NotAProperty())</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"true\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void MyTests.Tests.MyClass::PropertyFlagsButJustAMethod()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"\" isStatic=\"false\" isGetter=\"\" isSetter=\"\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void MyTests.Tests.MyClass::InvalidFlags()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"21\" sc=\"3\" el=\"21\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"19\" sc=\"3\" el=\"19\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
base.CreateCodeCoverageResults(xml);
}

45
src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsTestFixture.cs

@ -15,17 +15,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -15,17 +15,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void SetUpFixture()
{
string xml =
"<PartCoverReport date=\"2008-07-10T02:59:13.7198656+01:00\">\r\n" +
" <File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
" <Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" +
" <Type asmref=\"1\" name=\"Foo.Tests.FooTestFixture\" flags=\"1232592\">\r\n" +
" <Method name=\"SimpleTest\" sig=\"void ()\" bodysize=\"42\" flags=\"2182\" iflags=\"0\">\r\n" +
" <pt visit=\"1\" pos=\"0\" len=\"2\" fid=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
" <pt visit=\"1\" pos=\"0\" len=\"1\" fid=\"1\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" />\r\n" +
" <pt visit=\"0\" pos=\"0\" len=\"4\" fid=\"1\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" />\r\n" +
" </Method>\r\n" +
" </Type>\r\n" +
"</PartCoverReport>";
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
base.CreateCodeCoverageResults(xml);
}
@ -101,7 +118,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -101,7 +118,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
point.EndColumn = 4;
point.Line = 20;
point.EndLine = 20;
point.Length = 2;
point.Length = 1;
Assert.AreEqual(point, FirstModuleFirstMethodFirstSequencePoint);
}
@ -138,14 +155,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -138,14 +155,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void GetVisitedCodeLength_FirstMethod_ReturnsSummedLengthOfVisitedSequencePoints()
{
int length = FirstModuleFirstMethod.GetVisitedCodeLength();
Assert.AreEqual(3, length);
Assert.AreEqual(2, length);
}
[Test]
public void GetUnvisitedCodeLength_FirstMethod_ReturnsSummedLengthOfUnvisitedSequencePoints()
{
int length = FirstModuleFirstMethod.GetUnvisitedCodeLength();
Assert.AreEqual(4, length);
Assert.AreEqual(1, length);
}
}
}

32
src/AddIns/Analysis/CodeCoverage/Test/Coverage/CodeCoverageResultsWithEmptyMethodElementTestFixture.cs

@ -15,13 +15,29 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -15,13 +15,29 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void SetUpFixture()
{
string xml =
"<PartCoverReport date=\"2008-07-10T02:59:13.7198656+01:00\">\r\n" +
" <File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
" <Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" +
" <Type asmref=\"1\" name=\"Foo.Tests.FooTestFixture\" flags=\"1232592\">\r\n" +
" <Method name=\"SimpleTest\" sig=\"void ()\" bodysize=\"42\" flags=\"2182\" iflags=\"0\" />\r\n" +
" </Type>\r\n" +
"</PartCoverReport>";
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::.SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
base.CreateCodeCoverageResults(xml);
}
@ -37,7 +53,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -37,7 +53,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void MethodUnvisitedCodeLength_MethodWithNoSequencePoints_ReturnsBodySize()
{
int unvisitedCodeLength = FirstModuleFirstMethod.GetUnvisitedCodeLength();
int expectedUnvisitedCodeLength = 42;
int expectedUnvisitedCodeLength = 0;
Assert.AreEqual(expectedUnvisitedCodeLength, unvisitedCodeLength);
}
}

102
src/AddIns/Analysis/CodeCoverage/Test/Coverage/GetSequencePointsForFileNameTestFixture.cs

@ -16,33 +16,81 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -16,33 +16,81 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void SetUpFixture()
{
string xml =
"<PartCoverReport>\r\n" +
" <File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
" <File id=\"2\" url=\"c:\\Projects\\Foo\\SimpleTestFixture.cs\" />\r\n" +
" <File id=\"3\" url=\"c:\\Projects\\Foo\\BarTestFixture.cs\" />\r\n" +
" <Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" +
" <Assembly id=\"2\" name=\"Bar.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Bar.Tests.DLL\" domain=\"test-domain-Bar.Tests.dll\" domainIdx=\"1\" />\r\n" +
" <Type name=\"Foo.Tests.FooTestFixture\" asmref=\"1\">\r\n" +
" <Method name=\"FooTest\">\r\n" +
" <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"1\" />\r\n" +
" </Method>\r\n" +
" </Type>\r\n" +
" <Type name=\"Foo.Tests.SimpleTestFixture2\" asmref=\"1\">\r\n" +
" <Method name=\"SimpleTest2\">\r\n" +
" <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"2\" />\r\n" +
" </Method>\r\n" +
" </Type>\r\n" +
" <Type name=\"Foo.Tests.SimpleTestFixture3\" asmref=\"1\">\r\n" +
" <Method name=\"SimpleTest3\">\r\n" +
" <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"2\" />\r\n" +
" </Method>\r\n" +
" </Type>\r\n" +
" <Type name=\"Foo.Tests.BarTestFixture\" asmref=\"2\">\r\n" +
" <Method name=\"SimpleTest2\">\r\n" +
" <pt visit=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"3\" />\r\n" +
" </Method>\r\n" +
" </Type>\r\n" +
"</PartCoverReport>";
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t\t<File uid=\"2\" fullPath=\"c:\\Projects\\Foo\\SimpleTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::FooTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.SimpleTestFixture2</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.SimpleTestFixture2::SimpleTest2()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"2\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.SimpleTestFixture3</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.SimpleTestFixture3::SimpleTest3()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"2\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7B\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Bar.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Bar.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"3\" fullPath=\"c:\\Projects\\Foo\\BarTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.BarTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.BarTestFixture::.SimpleTest2()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"3\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
base.CreateCodeCoverageResults(xml);
}

57
src/AddIns/Analysis/CodeCoverage/Test/Coverage/InvalidSequencePointDataTestFixture.cs

@ -16,21 +16,48 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -16,21 +16,48 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void SetUpFixture()
{
string xml =
"<PartCoverReport>\r\n" +
"\t<File id=\"1\" url=\"c:\\Projects\\Foo\\SimpleTestFixture.cs\"/>\r\n" +
"\t<Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type name=\"Foo.Tests.FooTestFixture\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"InvalidVisitCount\">\r\n" +
"\t\t\t<pt visit=\"a\" fid=\"1\" sl=\"10\" sc=\"3\" el=\"20\" ec=\"4\"/>\r\n" +
"\t\t</Method>\r\n" +
"\t\t<Method name=\"InvalidLine\">\r\n" +
"\t\t\t<pt visit=\"2\" fid=\"1\" sl=\"b\" sc=\"3\" el=\"20\" ec=\"4\"/>\r\n" +
"\t\t</Method>\r\n" +
"\t\t<Method name=\"InvalidColumn\">\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"20\" sc=\"c\" el=\"d\" ec=\"e\"/>\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\SimpleTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::InvalidVisitCount()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"a\" sl=\"10\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::InvalidLine()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"2\" sl=\"b\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::InvalidColumn()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"a\" sl=\"10\" sc=\"c\" el=\"d\" ec=\"e\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
base.CreateCodeCoverageResults(xml);
}

104
src/AddIns/Analysis/CodeCoverage/Test/Coverage/ModuleVisitedSequencePointsTestFixture.cs

@ -15,34 +15,74 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -15,34 +15,74 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void SetUpFixture()
{
string xml =
"<PartCoverReport>\r\n" +
"\t<File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\"/>\r\n" +
"\t<File id=\"2\" url=\"c:\\Projects\\Foo\\FooTestFixture2.cs\"/>\r\n" +
"\t<File id=\"3\" url=\"c:\\Projects\\Foo\\BarTestFixture.cs\"/>\r\n" +
"\t<Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Assembly id=\"2\" name=\"Bar.Tests\" module=\"C:\\Projects\\Test\\bin\\Bar.Tests.DLL\" domain=\"test-domain-Bar.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type name=\"Foo.Tests.FooTestFixture1\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"SimpleTest1\">\r\n" +
"\t\t\t<pt visit=\"12\" len=\"2\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"1\" />\r\n" +
"\t\t\t<pt visit=\"4\" len=\"3\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" fid=\"1\" />\r\n" +
"\t\t\t<pt visit=\"0\" len=\"1\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" fid=\"1\"/>\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"\t<Type name=\"Foo.Tests.FooTestFixture2\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"SimpleTest2\">\r\n" +
"\t\t\t<pt visit=\"1\" len=\"3\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"2\" />\r\n" +
"\t\t\t<pt visit=\"10\" len=\"1\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" fid=\"2\"/>\r\n" +
"\t\t\t<pt visit=\"0\" len=\"2\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" fid=\"2\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"\t<Type name=\"Bar.Tests.FooTestFixture3\" asmref=\"2\">\r\n" +
"\t\t<Method name=\"SimpleTest3\">\r\n" +
"\t\t\t<pt visit=\"5\" len=\"6\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" fid=\"3\" />\r\n" +
"\t\t\t<pt visit=\"1\" len=\"5\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" fid=\"3\" />\r\n" +
"\t\t\t<pt visit=\"0\" len=\"4\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" fid=\"3\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t\t<File uid=\"2\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture2.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture1</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest1()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"12\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"4\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture2</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture2::SimpleTest2()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"2\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"10\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7B\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Bar.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Bar.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"3\" fullPath=\"c:\\Projects\\Foo\\BarTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture3</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.BarTestFixture::.SimpleTest3()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"3\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"5\" sl=\"20\" sc=\"3\" el=\"20\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"21\" sc=\"13\" el=\"21\" ec=\"32\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"24\" sc=\"3\" el=\"24\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
base.CreateCodeCoverageResults(xml);
}
@ -59,7 +99,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -59,7 +99,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void ModuleGetVisitedCodeLength_FooModule_ReturnsTotalLengthOfAllVisitedMethodSequencePoints()
{
int length = FooModule.GetVisitedCodeLength();
int expectedLength = 9;
int expectedLength = 4;
Assert.AreEqual(expectedLength, length);
}
@ -67,7 +107,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -67,7 +107,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void ModuleGetUnvisitedCodeLength_FooModule_ReturnsTotalLengthOfAllNonVisitedMethodSequencePoints()
{
int length = FooModule.GetUnvisitedCodeLength();
int expectedLength = 3;
int expectedLength = 2;
Assert.AreEqual(expectedLength, length);
}
@ -75,7 +115,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -75,7 +115,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void ModuleGetVisitedCodeLength_BarModule_ReturnsTotalLengthOfAllVisitedMethodSequencePoints()
{
int length = BarModule.GetVisitedCodeLength();
int expectedLength = 11;
int expectedLength = 2;
Assert.AreEqual(expectedLength, length);
}
@ -83,7 +123,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -83,7 +123,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void ModuleGetUnvisitedCodeLength_BarModule_ReturnsTotalLengthOfAllNonVisitedMethodSequencePoints()
{
int length = BarModule.GetUnvisitedCodeLength();
int expectedLength = 4;
int expectedLength = 1;
Assert.AreEqual(expectedLength, length);
}

32
src/AddIns/Analysis/CodeCoverage/Test/Coverage/PartCoverSettingsFactoryTests.cs → src/AddIns/Analysis/CodeCoverage/Test/Coverage/OpenCoverSettingsFactoryTests.cs

@ -12,10 +12,10 @@ using UnitTesting.Tests.Utils; @@ -12,10 +12,10 @@ using UnitTesting.Tests.Utils;
namespace ICSharpCode.CodeCoverage.Tests.Coverage
{
[TestFixture]
public class PartCoverSettingsFactoryTests
public class OpenCoverSettingsFactoryTests
{
PartCoverSettingsFactory factory;
PartCoverSettings partCoverSettings;
OpenCoverSettingsFactory factory;
OpenCoverSettings openCoverSettings;
MockCSharpProject project;
MockFileSystem fileSystem;
@ -23,38 +23,38 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -23,38 +23,38 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
public void Init()
{
fileSystem = new MockFileSystem();
factory = new PartCoverSettingsFactory(fileSystem);
factory = new OpenCoverSettingsFactory(fileSystem);
project = new MockCSharpProject();
}
[Test]
public void CreatePartCoverSettingsWhenFileDoesNotExistCreatesSettingsWithNoPartCoverIncludes()
public void CreateOpenCoverSettingsWhenFileDoesNotExistCreatesSettingsWithNoPartCoverIncludes()
{
fileSystem.FileExistsReturnValue = false;
CreatePartCoverSettingsFromFactory();
Assert.AreEqual(0, partCoverSettings.Include.Count);
CreateOpenCoverSettingsFromFactory();
Assert.AreEqual(0, openCoverSettings.Include.Count);
}
void CreatePartCoverSettingsFromFactory()
void CreateOpenCoverSettingsFromFactory()
{
partCoverSettings = factory.CreatePartCoverSettings(project);
openCoverSettings = factory.CreateOpenCoverSettings(project);
}
[Test]
public void CreatePartCoverSettingsWhenFileExistsCreatesSettingsFromFile()
public void CreateOpenCoverSettingsWhenFileExistsCreatesSettingsFromFile()
{
string partCoverSettingsXml =
"<PartCoverSettings>\r\n" +
string openCoverSettingsXml =
"<OpenCoverSettings>\r\n" +
" <Rule>+test</Rule>\r\n" +
"</PartCoverSettings>";
"</OpenCoverSettings>";
StringReader reader = new StringReader(partCoverSettingsXml);
StringReader reader = new StringReader(openCoverSettingsXml);
fileSystem.CreateTextReaderReturnValue = reader;
fileSystem.FileExistsReturnValue = true;
CreatePartCoverSettingsFromFactory();
Assert.AreEqual("test", partCoverSettings.Include[0]);
CreateOpenCoverSettingsFromFactory();
Assert.AreEqual("test", openCoverSettings.Include[0]);
}
}
}

10
src/AddIns/Analysis/CodeCoverage/Test/Coverage/PartCoverSettingsMissingRulePrefixTestFixture.cs → src/AddIns/Analysis/CodeCoverage/Test/Coverage/OpenCoverSettingsMissingRulePrefixTestFixture.cs

@ -13,19 +13,19 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -13,19 +13,19 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
/// range exception when the Rule elements are empty strings.
/// </summary>
[TestFixture]
public class PartCoverSettingsMissingRulePrefixTestFixture
public class OpenCoverSettingsMissingRulePrefixTestFixture
{
PartCoverSettings settings;
OpenCoverSettings settings;
[TestFixtureSetUp]
public void SetUpFixture()
{
string xml = "<PartCoverSettings>\r\n" +
string xml = "<OpenCoverSettings>\r\n" +
" <Rule/>\r\n" +
" <Rule></Rule>\r\n" +
"</PartCoverSettings>";
"</OpenCoverSettings>";
settings = new PartCoverSettings(new StringReader(xml));
settings = new OpenCoverSettings(new StringReader(xml));
}
[Test]

18
src/AddIns/Analysis/CodeCoverage/Test/Coverage/PartCoverSettingsTestFixture.cs → src/AddIns/Analysis/CodeCoverage/Test/Coverage/OpenCoverSettingsTestFixture.cs

@ -21,24 +21,24 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -21,24 +21,24 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
/// that PartCover uses.
/// </summary>
[TestFixture]
public class PartCoverSettingsTestFixture
public class OpenCoverSettingsTestFixture
{
PartCoverSettings settings;
PartCoverSettings savedSettings;
OpenCoverSettings settings;
OpenCoverSettings savedSettings;
StringBuilder savedSettingsXml;
XmlDocument doc;
[SetUp]
public void Init()
{
settings = new PartCoverSettings();
settings = new OpenCoverSettings();
settings.Include.Add("[a]*");
settings.Include.Add("[b]*");
settings.Exclude.Add("[c]*");
settings.Exclude.Add("[d]*");
savedSettingsXml = new StringBuilder();
settings.Save(new StringWriter(savedSettingsXml));
savedSettings = new PartCoverSettings(new StringReader(savedSettingsXml.ToString()));
savedSettings = new OpenCoverSettings(new StringReader(savedSettingsXml.ToString()));
doc = new XmlDocument();
doc.LoadXml(savedSettingsXml.ToString());
@ -57,7 +57,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -57,7 +57,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
}
[Test]
public void PartCoverSettingsFileName()
public void OpenCoverSettingsFileName()
{
MSBuildBasedProject project = new MSBuildBasedProject(
new ProjectCreateInformation {
@ -66,19 +66,19 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage @@ -66,19 +66,19 @@ namespace ICSharpCode.CodeCoverage.Tests.Coverage
ProjectName = "test"
});
Assert.AreEqual(@"C:\temp\test.PartCover.Settings", PartCoverSettings.GetFileName(project));
Assert.AreEqual(@"C:\temp\test.OpenCover.Settings", OpenCoverSettings.GetFileName(project));
}
[Test]
public void FourRuleElements()
{
Assert.AreEqual(4, doc.SelectNodes("/PartCoverSettings/Rule").Count);
Assert.AreEqual(4, doc.SelectNodes("/OpenCoverSettings/Rule").Count);
}
[Test]
public void FirstRuleElement()
{
Assert.IsNotNull(doc.SelectSingleNode("/PartCoverSettings/Rule[text()='+[a]*']"));
Assert.IsNotNull(doc.SelectSingleNode("/OpenCoverSettings/Rule[text()='+[a]*']"));
}
}
}

29
src/AddIns/Analysis/CodeCoverage/Test/Gui/PropertiesInCodeCoverageTreeView.cs

@ -1,13 +1,16 @@ @@ -1,13 +1,16 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.CodeCoverage;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
using System.Xml.Linq;
using ICSharpCode.CodeCoverage;
using ICSharpCode.CodeCoverage.Tests.Utils;
using ICSharpCode.SharpDevelop.Gui;
using NUnit.Framework;
namespace ICSharpCode.CodeCoverage.Tests.Gui
{
@ -27,16 +30,29 @@ namespace ICSharpCode.CodeCoverage.Tests.Gui @@ -27,16 +30,29 @@ namespace ICSharpCode.CodeCoverage.Tests.Gui
CodeCoverageMethod fooGetterMethod;
CodeCoverageMethod fooSetterMethod;
XElement CreateSetterElement(string className, string propertyName)
{
return CodeCoverageMethodXElementBuilder.CreateIntegerPropertySetter(className, propertyName);
}
XElement CreateGetterElement(string className, string propertyName)
{
return CodeCoverageMethodXElementBuilder.CreateIntegerPropertyGetter(className, propertyName);
}
[TestFixtureSetUp]
public void SetUpFixture()
{
List<CodeCoverageModule> modules = new List<CodeCoverageModule>();
CodeCoverageModule fooModule = new CodeCoverageModule("Tests");
fooSetterMethod = new CodeCoverageMethod("set_Count", "Tests.FooTest", MethodAttributes.SpecialName);
XElement setterMethod = CreateSetterElement("Tests.FooTest", "Count");
fooSetterMethod = new CodeCoverageMethod("Tests.FooTest", setterMethod);
fooSetterMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTest.cs", 1, 2, 2, 3, 4, 2));
fooSetterMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTest.cs", 0, 3, 4, 4, 4, 1));
fooGetterMethod = new CodeCoverageMethod("get_Count", "Tests.FooTest", MethodAttributes.SpecialName);
XElement getterMethod = CreateGetterElement("Tests.FooTest", "Count");
fooGetterMethod = new CodeCoverageMethod("Tests.FooTest", getterMethod);
fooGetterMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTest.cs", 1, 1, 0, 2, 1, 1));
fooModule.Methods.Add(fooGetterMethod);
@ -49,7 +65,6 @@ namespace ICSharpCode.CodeCoverage.Tests.Gui @@ -49,7 +65,6 @@ namespace ICSharpCode.CodeCoverage.Tests.Gui
fooModuleNode = (CodeCoverageModuleTreeNode)treeView.Nodes[0];
}
fooModuleNode.Expanding();
fooTestsNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooModuleNode.Nodes[0];
@ -94,12 +109,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Gui @@ -94,12 +109,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Gui
}
[Test]
[Ignore("Visited length not implemented with OpenCover")]
public void PropertyTreeNodeVisitedCodeLength_CountPropertyTreeNode_ReturnsThree()
{
Assert.AreEqual(3, countPropertyTreeNode.VisitedCodeLength);
}
[Test]
[Ignore("Visited length not implemented with OpenCover")]
public void VisitedCodeLength_PropertyTreeNode_ReturnsThree()
{
int count = countPropertyTreeNode.VisitedCodeLength;

39
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/AddCodeCoverageMarkersTestFixture.cs

@ -35,17 +35,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -35,17 +35,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
document.Text = code;
markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
string xml = "<PartCoverReport>\r\n" +
"<File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"<Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type asmref=\"1\" name=\"Foo.Tests.FooTestFixture\" flags=\"1232592\">\r\n" +
"\t\t<Method name=\"SimpleTest\">\r\n" +
"\t\t\t<pt visit=\"1\" sl=\"1\" fid=\"1\" sc=\"3\" el=\"1\" ec=\"4\" document=\"c:\\Projects\\Foo\\Foo1TestFixture.cs\" />\r\n" +
"\t\t\t<pt visit=\"1\" sl=\"2\" fid=\"1\" sc=\"4\" el=\"2\" ec=\"18\" document=\"c:\\Projects\\Foo\\Foo1TestFixture.cs\" />\r\n" +
"\t\t\t<pt visit=\"0\" sl=\"3\" fid=\"1\" sc=\"3\" el=\"3\" ec=\"4\" document=\"c:\\Projects\\Foo\\Foo1TestFixture.cs\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"2\" sc=\"4\" el=\"2\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"3\" sc=\"3\" el=\"3\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];
CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter();

39
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersCoverMultipleLinesTestFixture.cs

@ -41,17 +41,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -41,17 +41,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
document.Text = code;
ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
string xml = "<PartCoverReport>\r\n" +
"\t<File id=\"1\" url=\"c:\\Projects\\XmlEditor\\Test\\Schema\\SingleElementSchemaTestFixture.cs\" />\r\n" +
"\t<Assembly id=\"1\" name=\"XmlEditor.Tests\" module=\"C:\\Projects\\Test\\XmlEditor.Tests\\bin\\XmlEditor.Tests.DLL\" domain=\"test-domain-XmlEditor.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type asmref=\"XmlEditor.Tests\" name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" flags=\"1232592\">\r\n" +
"\t\t<Method name=\"GetSchema\">\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"2\" sc=\"4\" el=\"9\" ec=\"20\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"10\" sc=\"3\" el=\"10\" ec=\"4\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"2\" sc=\"4\" el=\"9\" ec=\"20\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"10\" sc=\"3\" el=\"10\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];

39
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersCoverTwoLinesTestFixture.cs

@ -35,17 +35,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -35,17 +35,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
"\t\t}\r\n";
document.Text = code;
string xml = "<PartCoverReport>\r\n" +
"\t<file id=\"1\" url=\"c:\\Projects\\XmlEditor\\Test\\Schema\\SingleElementSchemaTestFixture.cs\" />\r\n" +
"\t<Assembly id=\"1\" name=\"XmlEditor.Tests\" module=\"C:\\Projects\\Test\\XmlEditor.Tests\\bin\\XmlEditor.Tests.DLL\" domain=\"test-domain-XmlEditor.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type asmref=\"1\" name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\">\r\n" +
"\t\t<Method name=\"NoteElementHasNoChildElements\">\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"2\" sc=\"4\" el=\"3\" ec=\"57\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"4\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"2\" sc=\"4\" el=\"3\" ec=\"57\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"4\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];

41
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidEndColumnTestFixture.cs

@ -29,18 +29,35 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -29,18 +29,35 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
document.Text = "abcdefg\r\nabc";
string xml = "<PartCoverReport>\r\n" +
"\t<File id=\"1\" url=\"c:\\Projects\\XmlEditor\\Test\\Schema\\SingleElementSchemaTestFixture.cs\" />\r\n" +
"\t<Assembly id=\"1\" name=\"XmlEditor.Tests\" module=\"C:\\Projects\\Test\\XmlEditor.Tests\\bin\\XmlEditor.Tests.DLL\" domain=\"test-domain-XmlEditor.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"GetSchema\">\r\n" +
"\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"1\" el=\"1\" ec=\"9\"/>\r\n" +
"\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"1\" el=\"1\" ec=\"0\" />\r\n" +
"\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"1\" el=\"1\" ec=\"-1\" />\r\n" +
"\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"2\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"1\" el=\"1\" ec=\"9\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"1\" el=\"1\" ec=\"0\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"1\" el=\"1\" ec=\"-1\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"2\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];

40
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidEndLineTestFixture.cs

@ -30,17 +30,35 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -30,17 +30,35 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
// Give doc 3 lines (end line seems to be counted as an extra line).
document.Text = "abc\r\ndef";
string xml = "<Coverage>\r\n" +
"\t<Assembly id=\"1\" name=\"XmlEditor.Tests\" module=\"C:\\Projects\\Test\\XmlEditor.Tests\\bin\\XmlEditor.Tests.DLL\" domain=\"test-domain-XmlEditor.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"GetSchema\">\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"3\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"5\" ec=\"20\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"-1\" ec=\"20\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"4\" el=\"0\" ec=\"20\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</Coverage>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"3\" sc=\"3\" el=\"4\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"4\" el=\"5\" ec=\"20\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"4\" el=\"-1\" ec=\"20\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"4\" el=\"0\" ec=\"20\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];

39
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidStartColumnTestFixture.cs

@ -29,17 +29,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -29,17 +29,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
document.Text = "abcdefg\r\nabcdefg";
string xml = "<PartCoverReport>\r\n" +
"\t<File id=\"1\" url=\"c:\\Projects\\Test\\Test.cs\" />\r\n" +
"\t<Assembly id=\"1\" name=\"XmlEditor.Tests\" module=\"C:\\Projects\\Test\\XmlEditor.Tests\\bin\\XmlEditor.Tests.DLL\" domain=\"test-domain-XmlEditor.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"GetSchema\">\r\n" +
"\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"0\" el=\"1\" ec=\"1\" />\r\n" +
"\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"-1\" el=\"1\" ec=\"1\" />\r\n" +
"\t\t<pt visit=\"1\" fid=\"1\" sl=\"1\" sc=\"8\" el=\"1\" ec=\"20\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"0\" el=\"1\" ec=\"1\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"-1\" el=\"1\" ec=\"1\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"8\" el=\"1\" ec=\"20\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];

39
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/CodeCoverageMarkersInvalidStartLineTestFixture.cs

@ -28,17 +28,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -28,17 +28,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
IDocument document = MockTextMarkerService.CreateDocumentWithMockService();
ITextMarkerService markerStrategy = document.GetService(typeof(ITextMarkerService)) as ITextMarkerService;
string xml = "<PartCoverReport>\r\n" +
"\t<File id=\"1\" url=\"c:\\Projects\\XmlEditor\\Test\\Schema\\SingleElementSchemaTestFixture.cs\"/>\r\n" +
"\t<Assembly id=\"1\" name=\"XmlEditor.Tests\" module=\"C:\\Projects\\Test\\XmlEditor.Tests\\bin\\XmlEditor.Tests.DLL\" domain=\"test-domain-XmlEditor.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type name=\"XmlEditor.Tests.Schema.SingleElementSchemaTestFixture\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"GetSchema\">\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"0\" sc=\"3\" el=\"0\" ec=\"4\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"-1\" sc=\"4\" el=\"9\" ec=\"20\" />\r\n" +
"\t\t\t<pt visit=\"1\" fid=\"1\" sl=\"10\" sc=\"3\" el=\"10\" ec=\"4\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"0\" sc=\"3\" el=\"0\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"-1\" sc=\"4\" el=\"9\" ec=\"20\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"10\" sc=\"3\" el=\"10\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];

39
src/AddIns/Analysis/CodeCoverage/Test/Highlighting/RemoveCodeCoverageMarkersTestFixture.cs

@ -33,17 +33,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting @@ -33,17 +33,34 @@ namespace ICSharpCode.CodeCoverage.Tests.Highlighting
"\t\t}\r\n";
document.Text = code;
string xml = "<PartCoverReport>\r\n" +
"\t<File id=\"1\" url=\"c:\\Projects\\Foo\\FooTestFixture.cs\"/>\r\n" +
"\t<Assembly id=\"1\" name=\"Foo.Tests\" module=\"C:\\Projects\\Test\\bin\\Foo.Tests.DLL\" domain=\"test-domain-Foo.Tests.dll\" domainIdx=\"1\" />\r\n" +
"\t<Type name=\"Foo.Tests.FooTestFixture\" asmref=\"1\">\r\n" +
"\t\t<Method name=\"SimpleTest\">\r\n" +
"\t\t\t<pt visit=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" fid=\"1\" />\r\n" +
"\t\t\t<pt visit=\"1\" sl=\"2\" sc=\"4\" el=\"2\" ec=\"18\" fid=\"1\" />\r\n" +
"\t\t\t<pt visit=\"0\" sl=\"3\" sc=\"3\" el=\"3\" ec=\"4\" fid=\"1\" />\r\n" +
"\t\t</Method>\r\n" +
"\t</Type>\r\n" +
"</PartCoverReport>";
string xml = "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
"\t<Modules>\r\n" +
"\t\t<Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
"\t\t\t<FullName>C:\\Projects\\Test\\Foo.Tests\\bin\\Foo.Tests.DLL</FullName>\r\n" +
"\t\t\t<ModuleName>Foo.Tests</ModuleName>\r\n" +
"\t\t\t<Files>\r\n" +
"\t\t\t\t<File uid=\"1\" fullPath=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" +
"\t\t\t</Files>\r\n" +
"\t\t\t<Classes>\r\n" +
"\t\t\t\t<Class>\r\n" +
"\t\t\t\t\t<FullName>Foo.Tests.FooTestFixture</FullName>\r\n" +
"\t\t\t\t\t<Methods>\r\n" +
"\t\t\t\t\t\t<Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
"\t\t\t\t\t\t\t<MetadataToken>100663297</MetadataToken>\r\n" +
"\t\t\t\t\t\t\t<Name>System.Void Foo.Tests.FooTestFixture::SimpleTest()</Name>\r\n" +
"\t\t\t\t\t\t\t<FileRef uid=\"1\" />\r\n" +
"\t\t\t\t\t\t\t<SequencePoints>\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"1\" sc=\"3\" el=\"1\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"1\" sl=\"2\" sc=\"4\" el=\"2\" ec=\"18\" />\r\n" +
"\t\t\t\t\t\t\t\t<SequencePoint vc=\"0\" sl=\"3\" sc=\"3\" el=\"3\" ec=\"4\" />\r\n" +
"\t\t\t\t\t\t\t</SequencePoints>\r\n" +
"\t\t\t\t\t\t</Method>\r\n" +
"\t\t\t\t\t</Methods>\r\n" +
"\t\t\t\t</Class>\r\n" +
"\t\t\t</Classes>\r\n" +
"\t\t</Module>\r\n" +
"\t</Modules>\r\n" +
"</CoverageSession>";
CodeCoverageResults results = new CodeCoverageResults(new StringReader(xml));
CodeCoverageMethod method = results.Modules[0].Methods[0];
CodeCoverageHighlighter highlighter = new CodeCoverageHighlighter();

34
src/AddIns/Analysis/CodeCoverage/Test/Testing/CodeCoverageTestRunnerTests.cs

@ -79,7 +79,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -79,7 +79,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
testRunner.HasCodeCoverageResults();
string expectedFileName =
@"c:\projects\MyTests\PartCover\coverage.xml";
@"c:\projects\MyTests\OpenCover\coverage.xml";
Assert.AreEqual(expectedFileName, fileSystem.FileExistsPathParameter);
}
@ -96,7 +96,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -96,7 +96,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
testRunner.ReadCodeCoverageResults();
string expectedFileName =
@"c:\projects\MyTests\PartCover\coverage.xml";
@"c:\projects\MyTests\OpenCover\coverage.xml";
Assert.AreEqual(expectedFileName, fileSystem.CreateTextReaderPathParameter);
}
@ -116,18 +116,18 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -116,18 +116,18 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
ProcessStartInfo processStartInfo = testRunner.CallGetProcessStartInfo(tests);
string expectedCommandLine =
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml /results=\\\"d:\\temp\\results.txt\\\"\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [MyTests]*";
"-register:user -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " +
"-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml /results=\\\"d:\\temp\\results.txt\\\"\" " +
"-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " +
"-filter:\"+[MyTests]* \"";
Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments);
}
TextReader CreatePartCoverSettingsTextReader()
{
PartCoverSettings settings = new PartCoverSettings();
OpenCoverSettings settings = new OpenCoverSettings();
settings.Include.Add("[MyTests]*");
StringBuilder text = new StringBuilder();
StringWriter writer = new StringWriter(text);
@ -151,7 +151,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -151,7 +151,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
fileSystem.CreateTextReaderReturnValue = new StringReader("<abc/>");
StartTestRunner();
string expectedFileName = @"c:\projects\MyTests\PartCover\coverage.xml";
string expectedFileName = @"c:\projects\MyTests\OpenCover\coverage.xml";
Assert.AreEqual(expectedFileName, fileSystem.DeleteFilePathParameter);
}
@ -170,7 +170,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -170,7 +170,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
fileSystem.DirectoryExistsReturnValue = false;
StartTestRunner();
string expectedDirectory = @"c:\projects\MyTests\PartCover";
string expectedDirectory = @"c:\projects\MyTests\OpenCover";
Assert.AreEqual(expectedDirectory, fileSystem.CreateDirectoryPathParameter);
}
@ -180,7 +180,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -180,7 +180,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
fileSystem.DirectoryExistsReturnValue = true;
StartTestRunner();
string expectedDirectory = @"c:\projects\MyTests\PartCover";
string expectedDirectory = @"c:\projects\MyTests\OpenCover";
Assert.AreEqual(expectedDirectory, fileSystem.DirectoryExistsPathParameter);
}
@ -215,12 +215,12 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -215,12 +215,12 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
string GetCodeCoverageCommandLine()
{
return
"\"d:\\sharpdevelop\\bin\\Tools\\PartCover\\PartCover.exe\" " +
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [*]*";
"\"d:\\sharpdevelop\\bin\\Tools\\OpenCover\\OpenCover.Console.exe\" -register:user " +
"-target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " +
"-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " +
"-filter:\"+[*]* \"";
}
[Test]

82
src/AddIns/Analysis/CodeCoverage/Test/Testing/PartCoverApplicationTests.cs → src/AddIns/Analysis/CodeCoverage/Test/Testing/OpenCoverApplicationTests.cs

@ -12,27 +12,27 @@ using UnitTesting.Tests.Utils; @@ -12,27 +12,27 @@ using UnitTesting.Tests.Utils;
namespace ICSharpCode.CodeCoverage.Tests.Testing
{
[TestFixture]
public class PartCoverApplicationTests
public class OpenCoverApplicationTests
{
NUnitConsoleApplication nunitConsoleApp;
SelectedTests selectedTests;
UnitTestingOptions options;
PartCoverApplication partCoverApp;
PartCoverSettings partCoverSettings;
OpenCoverApplication openCoverApp;
OpenCoverSettings openCoverSettings;
[Test]
public void FileNameWhenPartCoverApplicationConstructedWithFileNameParameterMatchesFileNameParameter()
{
string expectedFileName = @"d:\projects\PartCover.exe";
CreatePartCoverApplication(expectedFileName);
Assert.AreEqual(expectedFileName, partCoverApp.FileName);
CreateOpenCoverApplication(expectedFileName);
Assert.AreEqual(expectedFileName, openCoverApp.FileName);
}
void CreatePartCoverApplication(string fileName)
void CreateOpenCoverApplication(string fileName)
{
CreateNUnitConsoleApplication();
partCoverSettings = new PartCoverSettings();
partCoverApp = new PartCoverApplication(fileName, nunitConsoleApp, partCoverSettings);
openCoverSettings = new OpenCoverSettings();
openCoverApp = new OpenCoverApplication(fileName, nunitConsoleApp, openCoverSettings);
}
void CreateNUnitConsoleApplication()
@ -49,14 +49,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -49,14 +49,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
{
FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
CreatePartCoverApplicationWithoutFileName();
string expectedPath = @"d:\sharpdevelop\bin\Tools\PartCover\PartCover.exe";
Assert.AreEqual(expectedPath, partCoverApp.FileName);
string expectedPath = @"d:\sharpdevelop\bin\Tools\OpenCover\OpenCover.Console.exe";
Assert.AreEqual(expectedPath, openCoverApp.FileName);
}
void CreatePartCoverApplicationWithoutFileName()
{
CreateNUnitConsoleApplication();
partCoverApp = new PartCoverApplication(nunitConsoleApp, new PartCoverSettings());
openCoverApp = new OpenCoverApplication(nunitConsoleApp, new OpenCoverSettings());
}
[Test]
@ -64,28 +64,28 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -64,28 +64,28 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
{
FileUtility.ApplicationRootPath = @"d:\sharpdevelop\..\sharpdevelop";
CreatePartCoverApplicationWithoutFileName();
string expectedPath = @"d:\sharpdevelop\bin\Tools\PartCover\PartCover.exe";
Assert.AreEqual(expectedPath, partCoverApp.FileName);
string expectedPath = @"d:\sharpdevelop\bin\Tools\OpenCover\OpenCover.Console.exe";
Assert.AreEqual(expectedPath, openCoverApp.FileName);
}
[Test]
public void TargetIsNUnitConsoleApplicationFileName()
{
CreatePartCoverApplication();
Assert.AreEqual(nunitConsoleApp.FileName, partCoverApp.Target);
Assert.AreEqual(nunitConsoleApp.FileName, openCoverApp.Target);
}
void CreatePartCoverApplication()
{
string fileName = @"d:\partcover\PartCover.exe";
CreatePartCoverApplication(fileName);
CreateOpenCoverApplication(fileName);
}
[Test]
public void GetTargetArgumentsReturnsNUnitConsoleApplicationCommandLineArguments()
{
CreatePartCoverApplication();
Assert.AreEqual(nunitConsoleApp.GetArguments(), partCoverApp.GetTargetArguments());
Assert.AreEqual(nunitConsoleApp.GetArguments(), openCoverApp.GetTargetArguments());
}
[Test]
@ -93,7 +93,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -93,7 +93,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
{
CreatePartCoverApplication();
string expectedTargetWorkingDirectory = @"c:\projects\MyTests\bin\Debug";
Assert.AreEqual(expectedTargetWorkingDirectory, partCoverApp.GetTargetWorkingDirectory());
Assert.AreEqual(expectedTargetWorkingDirectory, openCoverApp.GetTargetWorkingDirectory());
}
[Test]
@ -101,24 +101,24 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -101,24 +101,24 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
{
CreatePartCoverApplication();
string expectedOutputDirectory =
@"c:\projects\MyTests\PartCover\coverage.xml";
@"c:\projects\MyTests\OpenCover\coverage.xml";
Assert.AreEqual(expectedOutputDirectory, partCoverApp.CodeCoverageResultsFileName);
Assert.AreEqual(expectedOutputDirectory, openCoverApp.CodeCoverageResultsFileName);
}
[Test]
public void SettingsReturnsPartCoverSettingsPassedToConstructor()
{
CreatePartCoverApplication();
Assert.AreEqual(partCoverSettings, partCoverApp.Settings);
Assert.AreEqual(openCoverSettings, openCoverApp.Settings);
}
[Test]
public void GetProcessStartInfoReturnsStartInfoWhereFileNameIsPartCoverAppFileName()
{
string partCoverAppFileName = @"d:\projects\partcover.exe";
CreatePartCoverApplication(partCoverAppFileName);
ProcessStartInfo processStartInfo = partCoverApp.GetProcessStartInfo();
CreateOpenCoverApplication(partCoverAppFileName);
ProcessStartInfo processStartInfo = openCoverApp.GetProcessStartInfo();
Assert.AreEqual(partCoverAppFileName, processStartInfo.FileName);
}
@ -128,14 +128,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -128,14 +128,14 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
{
FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
CreatePartCoverApplication();
ProcessStartInfo processStartInfo = partCoverApp.GetProcessStartInfo();
ProcessStartInfo processStartInfo = openCoverApp.GetProcessStartInfo();
string expectedCommandLine =
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [*]*";
"-register:user -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " +
"-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " +
"-filter:\"+[*]* \"";
Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments);
}
@ -146,23 +146,23 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -146,23 +146,23 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
CreatePartCoverApplication();
partCoverSettings.Include.Add("[MyTests]*");
partCoverSettings.Include.Add("[MoreTests]*");
openCoverSettings.Include.Add("[MyTests]*");
openCoverSettings.Include.Add("[MoreTests]*");
partCoverSettings.Exclude.Add("[NUnit.Framework]*");
partCoverSettings.Exclude.Add("[MyProject]*");
openCoverSettings.Exclude.Add("[NUnit.Framework]*");
openCoverSettings.Exclude.Add("[MyProject]*");
ProcessStartInfo processStartInfo = partCoverApp.GetProcessStartInfo();
ProcessStartInfo processStartInfo = openCoverApp.GetProcessStartInfo();
string expectedCommandLine =
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [MyTests]* " +
"--include [MoreTests]* " +
"--exclude [NUnit.Framework]* " +
"--exclude [MyProject]*";
"-register:user -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " +
"-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " +
"-filter:\"+[MyTests]* " +
"+[MoreTests]* " +
"-[NUnit.Framework]* " +
"-[MyProject]*\"";
Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments);
}

38
src/AddIns/Analysis/CodeCoverage/Test/Testing/RunTestWithCodeCoverageCommandTests.cs

@ -3,9 +3,6 @@ @@ -3,9 +3,6 @@
using System;
using System.IO;
using System.Text;
using ICSharpCode.CodeCoverage;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.UnitTesting;
@ -189,15 +186,32 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -189,15 +186,32 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
TextReader CreateCodeCoverageResultsTextReader()
{
string xml =
"<PartCoverReport>\r\n" +
" <File id='1' url='c:\\Projects\\MyTests\\MyTestFixture.cs'/>\r\n" +
" <Assembly id='1' name='MyTests' module='C:\\Projects\\MyTests\\bin\\MyTests.DLL' domain='test-domain.Tests.dll' domainIdx='1' />\r\n" +
" <Type name='MyTests.Tests.MyTestFixture' asmref='1'>\r\n" +
" <Method name='SimpleTest1'>\r\n" +
" <pt visit='12' sl='20' sc='3' el='20' ec='4' fid='1' />\r\n" +
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
" <Modules>\r\n" +
" <Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
" <FullName>C:\\Projects\\MyTests\\bin\\MyTests.DLL</FullName>\r\n" +
" <ModuleName>MyTests</ModuleName>\r\n" +
" <Files>\r\n" +
" <File uid=\"1\" fullPath=\"c:\\Projects\\MyTests\\MyTestFixture.cs\" />\r\n" +
" </Files>\r\n" +
" <Classes>\r\n" +
" <Class>\r\n" +
" <FullName>MyTests.Tests.MyTestFixture</FullName>\r\n" +
" <Methods>\r\n" +
" <Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
" <MetadataToken>100663297</MetadataToken>\r\n" +
" <Name>System.Void MyTests.Tests.MyTestFixture::SimpleTest1()</Name>\r\n" +
" <FileRef uid=\"1\" />\r\n" +
" <SequencePoints>\r\n" +
" <SequencePoint vc='12' sl='20' sc='3' el='20' ec='4'/>\r\n" +
" </SequencePoints>\r\n" +
" </Method>\r\n" +
" </Type>\r\n" +
"</PartCoverReport>";
" </Methods>\r\n" +
" </Class>\r\n" +
" </Classes>\r\n" +
" </Module>\r\n" +
" </Modules>\r\n" +
"</CoverageSession>";
return new StringReader(xml);
}
@ -245,7 +259,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -245,7 +259,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
ActionArguments<Task> args = CreateTestRunnerAndFirePartCoverProcessExitEventWhenNoCoverageFileProduced();
Task task = args.Arg;
string description = @"No code coverage results file generated. c:\projects\MyTests\PartCover\coverage.xml";
string description = @"No code coverage results file generated. c:\projects\MyTests\OpenCover\coverage.xml";
int column = 1;
int line = 1;
Task expectedTask = new Task(null, description, column, line, TaskType.Error);

110
src/AddIns/Analysis/CodeCoverage/Test/Utils/CodeCoverageMethodXElementBuilder.cs

@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Xml.Linq;
namespace ICSharpCode.CodeCoverage.Tests.Utils
{
public class CodeCoverageMethodXElementBuilder
{
public XElement MethodElement { get; private set; }
public CodeCoverageMethodXElementBuilder(string methodSignature)
{
MethodElement = new XElement("Method");
var nameElement = new XElement("Name");
nameElement.Value = methodSignature;
MethodElement.Add(nameElement);
}
public void MakePropertyGetter()
{
SetGetterAttribute(true);
}
void SetGetterAttribute(bool value)
{
SetBooleanAttribute("isGetter", value);
}
void SetBooleanAttribute(string name, bool value)
{
SetAttributeValue(name, value.ToString().ToLowerInvariant());
}
void SetAttributeValue(string name, object value)
{
MethodElement.SetAttributeValue(name, value);
}
public void MakePropertySetter()
{
SetSetterAttribute(true);
}
void SetSetterAttribute(bool value)
{
SetBooleanAttribute("isSetter", value);
}
public static XElement CreatePropertySetterWithMethodSignature(string methodSignature)
{
var builder = new CodeCoverageMethodXElementBuilder(methodSignature);
builder.SetSetterAttribute(true);
builder.SetGetterAttribute(false);
return builder.MethodElement;
}
public static XElement CreatePropertyGetterWithMethodSignature(string methodSignature)
{
var builder = new CodeCoverageMethodXElementBuilder(methodSignature);
builder.SetSetterAttribute(false);
builder.SetGetterAttribute(true);
return builder.MethodElement;
}
/// <summary>
/// Generates a setter method signature from the property name and type
/// (e.g. "System.Void set_PROPERTYNAME(PROPERTYTYPE)"
/// </summary>
public static XElement CreatePropertySetter(string className, string propertyName, string propertyType)
{
string methodSignature = String.Format("System.Void {0}::set_{1}({2})", className, propertyName, propertyType);
return CreatePropertySetterWithMethodSignature(methodSignature);
}
public static XElement CreateIntegerPropertySetter(string className, string propertyName)
{
return CreatePropertySetter(className, propertyName, "System.Int32");
}
/// <summary>
/// Generates a getter method signature from the property name and type
/// (e.g. "PROPERTYTYPE get_PROPERTYNAME()"
/// </summary>
public static XElement CreatePropertyGetter(string className, string propertyName, string propertyType)
{
string methodSignature = String.Format("{0} {1}::get_{2}()", propertyType, className, propertyName);
return CreatePropertyGetterWithMethodSignature(methodSignature);
}
public static XElement CreateIntegerPropertyGetter(string className, string propertyName)
{
return CreatePropertyGetter(className, propertyName, "System.Int32");
}
public static XElement CreateMethod(string className, string methodName)
{
return CreateMethod(className, methodName, "System.Void");
}
public static XElement CreateMethod(string className, string methodName, string returnType)
{
string methodSignature = String.Format("{0} {1}::{2}()", returnType, className, methodName);
var builder = new CodeCoverageMethodXElementBuilder(methodSignature);
return builder.MethodElement;
}
}
}

21
src/AddIns/Analysis/CodeCoverage/Test/Utils/XElementExtensions.cs

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Xml.Linq;
namespace ICSharpCode.CodeCoverage.Tests.Utils
{
public static class XElementExtensions
{
public static void SetIsGetterAttributeValue(this XElement element, object value)
{
element.SetAttributeValue("isGetter", value);
}
public static void SetIsSetterAttributeValue(this XElement element, object value)
{
element.SetAttributeValue("isSetter", value);
}
}
}

0
src/AddIns/Analysis/SourceAnalysis/Resources/AnalysisIdeOptionPanel.xfrm → src/AddIns/Analysis/SourceAnalysis/Resources/old_AnalysisIdeOptionPanel.xfrm

13
src/AddIns/Analysis/SourceAnalysis/SourceAnalysis.addin

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
addInManagerHidden = "preinstalled">
<Manifest>
<Identity name = "MattEverson.SourceAnalysis"/>
<Identity name = "ICSharpCode.SourceAnalysis"/>
<Dependency addin = "SharpDevelop"/>
</Manifest>
@ -14,19 +14,19 @@ @@ -14,19 +14,19 @@
</Runtime>
<Path name = "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles">
<String id="SourceAnalysis" text = "${AddInPath:MattEverson.SourceAnalysis}/SharpDevelop.SourceAnalysis.targets"/>
<String id="SourceAnalysis" text = "${AddInPath:ICSharpCode.SourceAnalysis}/SharpDevelop.SourceAnalysis.targets"/>
</Path>
<Path name = "/SharpDevelop/BackendBindings/ProjectOptions/AllManaged">
<OptionPanel id = "SourceAnalysis"
label = "${res:AddIns.SourceAnalysis.Title}"
class = "MattEverson.SourceAnalysis.AnalysisProjectOptionsPanel"/>
class = "ICSharpCode.SourceAnalysis.AnalysisProjectOptionsPanel"/>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions">
<MenuItem id = "CheckWithStyleCop"
label = "${res:AddIns.SourceAnalysis.CheckWithStyleCop}"
class = "MattEverson.SourceAnalysis.CheckCurrentProjectCommand"/>
class = "ICSharpCode.SourceAnalysis.CheckCurrentProjectCommand"/>
</Path>
<Path name="/SharpDevelop/Workbench/MainMenu/Analysis">
@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
</And>
<MenuItem id = "CheckWithStyleCop"
label = "${res:AddIns.SourceAnalysis.CheckProjectWithStyleCop}"
class = "MattEverson.SourceAnalysis.CheckCurrentProjectCommand"/>
class = "ICSharpCode.SourceAnalysis.CheckCurrentProjectCommand"/>
</ComplexCondition>
</Path>
@ -44,6 +44,7 @@ @@ -44,6 +44,7 @@
<Path name = "/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<OptionPanel id = "SourceAnalysisOptionPanel"
label = "${res:AddIns.SourceAnalysis.Title}"
class = "MattEverson.SourceAnalysis.AnalysisIdeOptionsPanel"/>
class = "ICSharpCode.SourceAnalysis.AnalysisIdeOptionsPanel"/>
</Path>
</AddIn>

40
src/AddIns/Analysis/SourceAnalysis/SourceAnalysis.csproj

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>MattEverson.SourceAnalysis</RootNamespace>
<RootNamespace>ICSharpCode.SourceAnalysis</RootNamespace>
<AssemblyName>SourceAnalysis</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -40,11 +40,17 @@ @@ -40,11 +40,17 @@
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">
@ -60,18 +66,26 @@ @@ -60,18 +66,26 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\AnalysisProjectOptionsPanel.cs" />
<Compile Include="Src\AnalysisProjectOptions.Designer.cs">
<DependentUpon>AnalysisProjectOptions.cs</DependentUpon>
<Compile Include="Src\AnalysisIdeOptionsPanel.xaml.cs">
<DependentUpon>AnalysisIdeOptionsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\AnalysisProjectOptions.cs" />
<EmbeddedResource Include="Src\AnalysisProjectOptions.resx">
<DependentUpon>AnalysisProjectOptions.cs</DependentUpon>
<Compile Include="Src\AnalysisOptionsPanel.xaml.cs">
<DependentUpon>AnalysisOptionsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\old_AnalysisProjectOptionsPanel.cs" />
<Compile Include="Src\old_AnalysisProjectOptions.Designer.cs">
<DependentUpon>old_AnalysisProjectOptions.cs</DependentUpon>
</Compile>
<Compile Include="Src\old_AnalysisProjectOptions.cs" />
<EmbeddedResource Include="Src\old_AnalysisProjectOptions.resx">
<DependentUpon>old_AnalysisProjectOptions.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Src\StyleCopWrapper.cs" />
<Compile Include="Src\CheckCurrentProjectCommand.cs" />
<Compile Include="Src\AnalysisIdeOptionsPanel.cs" />
<EmbeddedResource Include="Resources\AnalysisIdeOptionPanel.xfrm" />
<Compile Include="Src\old_AnalysisIdeOptionsPanel.cs" />
<EmbeddedResource Include="Resources\old_AnalysisIdeOptionPanel.xfrm" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
@ -90,11 +104,19 @@ @@ -90,11 +104,19 @@
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="Src\AnalysisIdeOptionsPanel.xaml" />
<Page Include="Src\AnalysisOptionsPanel.xaml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

25
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
<gui:OptionPanel x:Class="ICSharpCode.SourceAnalysis.AnalysisIdeOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<GroupBox Header="StyleCop">
<StackPanel>
<TextBlock Margin="3,5,3,20" x:Name="status"
HorizontalAlignment="Center" TextWrapping="Wrap"
Text="(showing current StyleCop path)"></TextBlock>
<Button Content="Find StyleCop path"
HorizontalAlignment="Center"
Click="FindStyleCopPath_Click"
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button>
<Button Margin="0,15,0,0" IsEnabled="{Binding EnableModifyStyleCopSettings}"
Content="Modify Master StyleCop Settings"
HorizontalAlignment="Center"
Click="ModifyStyleCopSettings_Click"
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button>
</StackPanel>
</GroupBox>
</gui:OptionPanel>

103
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 23.07.2012
* Time: 20:13
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
namespace ICSharpCode.SourceAnalysis
{
/// <summary>
/// Interaction logic for AnalysisIdeOptionsPanelXaml.xaml
/// </summary>
public partial class AnalysisIdeOptionsPanel : OptionPanel
{
private bool enableModifyStyleCopSettings;
public AnalysisIdeOptionsPanel()
{
InitializeComponent();
DataContext = this;
ShowStatus();
}
private void ShowStatus()
{
string path = StyleCopWrapper.FindStyleCopPath();
if (path == null) {
status.Text = StringParser.Parse("StyleCop not found in the given path.");
EnableModifyStyleCopSettings = false;
} else {
status.Text = StringParser.Parse("StyleCop was found in: ") + Environment.NewLine + path;
EnableModifyStyleCopSettings = true;
}
}
public bool EnableModifyStyleCopSettings {
get { return enableModifyStyleCopSettings; }
set { enableModifyStyleCopSettings = value;
base.RaisePropertyChanged("EnableModifyStyleCopSettings");
}
}
private void FindStyleCopPath_Click(object sender, System.Windows.RoutedEventArgs e)
{
string filter = StringParser.Parse("StyleCop|*" + StyleCopWrapper.STYLE_COP_FILE + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
string path = OptionsHelper.OpenFile(filter);
if (!String.IsNullOrEmpty(path)) {
if (StyleCopWrapper.IsStyleCopPath(path)) {
StyleCopPath = path;
} else {
MessageService.ShowError(string.Format("Directory does not contain StyleCop (*{0}).", StyleCopWrapper.STYLE_COP_FILE));
}
}
}
void ModifyStyleCopSettings_Click(object sender, RoutedEventArgs e)
{
var executable = Path.Combine(Path.GetDirectoryName(StyleCopWrapper.FindStyleCopPath()), "StyleCopSettingsEditor.exe");
var parameters = "\"" + StyleCopWrapper.GetMasterSettingsFile() + "\"";
if (!File.Exists(executable)) {
LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable);
MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options.");
return;
}
using(Process p = Process.Start("\"" + executable + "\"", parameters))
{
// No need to wait for the settings dialog to close - we can leave it open.
}
}
public static string StyleCopPath {
get {
return PropertyService.Get("SourceAnalysis.StyleCopPath");
}
set {
PropertyService.Set("SourceAnalysis.StyleCopPath", value);
}
}
}
}

38
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
<optionpanels:ProjectOptionPanel
x:Class="ICSharpCode.SourceAnalysis.AnalysisProjectOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:tv="http://icsharpcode.net/sharpdevelop/treeview"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<Grid Margin="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="10"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
</Grid.ColumnDefinitions>
<optionpanels:StorageLocationPicker Location="{Binding SourceAnalysisOverrideSettingsFile.Location}" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="3,0,3,0"
x:Name="settingsFileTextBox"
Text="{Binding SourceAnalysisOverrideSettingsFile.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Column="3" Content="..." VerticalAlignment="Center"
Click="BrowseButton_Click" ></Button>
<Button Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Center"
Content="Modify StyleCop Settings" Style="{x:Static core:GlobalStyles.ButtonStyle}"
Click="ModifyStyleCopSettings_Click"></Button>
</Grid>
</optionpanels:ProjectOptionPanel>

129
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs

@ -0,0 +1,129 @@ @@ -0,0 +1,129 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 21.07.2012
* Time: 18:51
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SourceAnalysis
{
/// <summary>
/// Interaction logic for AnalysisIdeOptionsPanelXaml.xaml
/// </summary>
public partial class AnalysisProjectOptionsPanel : ProjectOptionPanel
{
public AnalysisProjectOptionsPanel()
{
InitializeComponent();
}
public ProjectProperty<string> SourceAnalysisOverrideSettingsFile {
get { return GetProperty("SourceAnalysisOverrideSettingsFile", "", TextBoxEditMode.EditRawProperty); }
}
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
if (String.IsNullOrEmpty(SourceAnalysisOverrideSettingsFile.Value)) {
SourceAnalysisOverrideSettingsFile.Value = StyleCopWrapper.GetMasterSettingsFile();
SourceAnalysisOverrideSettingsFile.Location = PropertyStorageLocations.Base;
}
}
void BrowseButton_Click(object sender, RoutedEventArgs e)
{
var fn = OptionsHelper.OpenFile(String.Empty);
if (!String.IsNullOrEmpty(fn)) {
settingsFileTextBox.Text = fn;
}
}
void ModifyStyleCopSettings_Click(object sender, RoutedEventArgs e)
{
var settingsFile = SourceAnalysisOverrideSettingsFile.Value;
if (settingsFile == StyleCopWrapper.GetMasterSettingsFile()) {
if (ConfirmSwitchFromMaster()) {
settingsFile = CopyFromMaster();
}
}
if (!System.IO.File.Exists(settingsFile)) {
if (ConfirmReplaceMissingFile()) {
settingsFile = CopyFromMaster();
}
else {
MessageService.ShowWarning("No settings file found to modify.");
return;
}
}
string styleCopPath = StyleCopWrapper.FindStyleCopPath();
string executable;
if (styleCopPath != null)
executable = Path.Combine(Path.GetDirectoryName(styleCopPath), "StyleCopSettingsEditor.exe");
else
executable = null;
string parameters = "\"" + settingsFile + "\"";
if (!File.Exists(executable)) {
LoggingService.Debug("StyleCopSettingsEditor.exe: " + executable);
MessageService.ShowWarning("Unable to find the StyleCop Settings editor. Please specify the StyleCop location in Tools Options.");
return;
}
using(Process p = Process.Start("\"" + executable + "\"", parameters)) {
// No need to wait for the settings dialog to close - we can leave it open.
}
}
private bool ConfirmReplaceMissingFile()
{
return MessageService.AskQuestion("A settings file is not present. Would you like to copy the master into the " +
"project folder?",
"Missing Settings File");
}
private bool ConfirmSwitchFromMaster()
{
return MessageService.AskQuestion("You are currently using the master settings file. Do you want to make a "
+ "copy in the project folder instead?",
"Using Master Settings File");
}
private string CopyFromMaster()
{
var newSettingsFile = Project.Directory + "\\Settings.SourceAnalysis";
System.IO.File.Copy(
StyleCopWrapper.GetMasterSettingsFile(),
newSettingsFile,
true
);
SourceAnalysisOverrideSettingsFile.Value = newSettingsFile;
SourceAnalysisOverrideSettingsFile.Location = PropertyStorageLocations.Base;
return newSettingsFile;
}
}
}

2
src/AddIns/Analysis/SourceAnalysis/Src/CheckCurrentProjectCommand.cs

@ -6,7 +6,7 @@ using ICSharpCode.Core; @@ -6,7 +6,7 @@ using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Project.Commands;
namespace MattEverson.SourceAnalysis
namespace ICSharpCode.SourceAnalysis
{
public class CheckCurrentProjectCommand : BuildProject
{

4
src/AddIns/Analysis/SourceAnalysis/Src/StyleCopWrapper.cs

@ -7,7 +7,7 @@ using System.Xml; @@ -7,7 +7,7 @@ using System.Xml;
using ICSharpCode.Core;
namespace MattEverson.SourceAnalysis
namespace ICSharpCode.SourceAnalysis
{
public static class StyleCopWrapper
{
@ -33,7 +33,7 @@ namespace MattEverson.SourceAnalysis @@ -33,7 +33,7 @@ namespace MattEverson.SourceAnalysis
public static string GetMasterSettingsFile()
{
var resource = typeof(StyleCopWrapper).Assembly.GetManifestResourceStream("MattEverson.SourceAnalysis.Resources.Settings.SourceAnalysis");
var resource = typeof(StyleCopWrapper).Assembly.GetManifestResourceStream("ICSharpCode.SourceAnalysis.Resources.Settings.SourceAnalysis");
if(!File.Exists(MasterSettingsFileName))
{
var xmlDoc = new XmlDocument();

8
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.cs → src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisIdeOptionsPanel.cs

@ -9,16 +9,17 @@ using System.Windows.Forms; @@ -9,16 +9,17 @@ using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace MattEverson.SourceAnalysis
namespace ICSharpCode.SourceAnalysis
{
/// <summary>
/// Option panel to choose the StyleCop path from.
/// </summary>
public class AnalysisIdeOptionsPanel : XmlFormsOptionPanel
public class old_AnalysisIdeOptionsPanel : XmlFormsOptionPanel
{
public override void LoadPanelContents()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("MattEverson.SourceAnalysis.Resources.AnalysisIdeOptionPanel.xfrm"));
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.SourceAnalysis.Resources.old_AnalysisIdeOptionPanel.xfrm"));
ShowStatus();
Get<Button>("FindStyleCopPath").Click += FindStyleCopPathClick;
@ -81,4 +82,5 @@ namespace MattEverson.SourceAnalysis @@ -81,4 +82,5 @@ namespace MattEverson.SourceAnalysis
}
}
}
}

2
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisProjectOptions.Designer.cs → src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptions.Designer.cs generated

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
namespace MattEverson.SourceAnalysis
namespace ICSharpCode.SourceAnalysis
{
partial class AnalysisProjectOptions : System.Windows.Forms.UserControl
{

2
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisProjectOptions.cs → src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptions.cs

@ -12,7 +12,7 @@ using ICSharpCode.Core; @@ -12,7 +12,7 @@ using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace MattEverson.SourceAnalysis
namespace ICSharpCode.SourceAnalysis
{
public partial class AnalysisProjectOptions
{

0
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisProjectOptions.resx → src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptions.resx

4
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisProjectOptionsPanel.cs → src/AddIns/Analysis/SourceAnalysis/Src/old_AnalysisProjectOptionsPanel.cs

@ -9,8 +9,8 @@ using ICSharpCode.Core; @@ -9,8 +9,8 @@ using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace MattEverson.SourceAnalysis {
public class AnalysisProjectOptionsPanel : AbstractXmlFormsProjectOptionPanel {
namespace ICSharpCode.SourceAnalysis {
public class old_AnalysisProjectOptionsPanel : AbstractXmlFormsProjectOptionPanel {
public override void LoadPanelContents() {
InitializeHelper();

1
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/WebProjectOptions/WebProjectOptionsPanel.xaml.cs

@ -26,6 +26,7 @@ namespace ICSharpCode.AspNet.Mvc @@ -26,6 +26,7 @@ namespace ICSharpCode.AspNet.Mvc
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
CreateWebProject(project);
if (!WebProjectService.IsIISOrIISExpressInstalled) {
StatusLabel.Text = ResourceService.GetString("ICSharpCode.WebProjectOptionsPanel.IISNotFound");

16
src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.csproj

@ -42,8 +42,17 @@ @@ -42,8 +42,17 @@
<Reference Include="Boo.Lang.Interpreter">
<HintPath>..\..\RequiredLibraries\Boo.Lang.Interpreter.dll</HintPath>
</Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
@ -68,6 +77,9 @@ @@ -68,6 +77,9 @@
<HintPath>..\..\RequiredLibraries\Boo.Lang.Useful.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Src\BooLanguageBinding.cs" />
@ -134,6 +146,10 @@ @@ -134,6 +146,10 @@
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
</ProjectReference>
<ProjectReference Include="..\..\NRefactoryToBooConverter\Project\NRefactoryToBooConverter.csproj">
<Project>{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}</Project>
<Name>NRefactoryToBooConverter</Name>

13
src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin

@ -78,18 +78,29 @@ @@ -78,18 +78,29 @@
<OptionPanel id = "Application"
label = "${res:Dialog.ProjectOptions.ApplicationSettings}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.ApplicationSettings"/>
<OptionPanel id = "ReferencePaths"
label = "${res:Dialog.ProjectOptions.ReferencePaths}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.ReferencePaths"/>
<OptionPanel id = "Signing"
label = "${res:Dialog.ProjectOptions.Signing}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.Signing"/>
<!--<OptionPanel id = "Signing1"
label = "${res:Dialog.ProjectOptions.Signing}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.SigningXaml"/>-->
<OptionPanel id = "BuildEvents"
label = "${res:Dialog.ProjectOptions.BuildEvents}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents"/>
<OptionPanel id = "BuildOptions"
<OptionPanel id = "BuildOptions1"
label = "${res:Dialog.ProjectOptions.BuildOptions}"
class = "CSharpBinding.OptionPanels.BuildOptions"/>
<OptionPanel id = "DebugOptions"
label = "${res:Dialog.ProjectOptions.DebugOptions}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>

16
src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj

@ -81,7 +81,6 @@ @@ -81,7 +81,6 @@
<Compile Include="Src\Refactoring\IssueOptionsViewModel.cs" />
<Compile Include="Src\Refactoring\SDRedundantUsingIssue.cs" />
<Compile Include="Src\Refactoring\SDScript.cs" />
<EmbeddedResource Include="Resources\BuildOptions.xfrm" />
<EmbeddedResource Include="Resources\MyNamespaceSupportForCSharp.cs" />
<Compile Include="Src\CodeManipulation.cs" />
<Compile Include="Src\Completion\CompletionData.cs" />
@ -97,11 +96,13 @@ @@ -97,11 +96,13 @@
<Compile Include="Src\ExtensionMethods.cs" />
<Compile Include="Src\FormattingStrategy\CSharpFormattingStrategy.cs" />
<Compile Include="Src\FormattingStrategy\DocumentAccessor.cs" />
<Compile Include="Src\OptionPanels\BuildOptions.cs">
<SubType>Form</SubType>
<Compile Include="Src\OptionPanels\BuildOptions.xaml.cs">
<DependentUpon>BuildOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Parser\CSharpFullParseInformation.cs" />
<Compile Include="Src\Parser\CSharpSymbolSearch.cs" />
<Compile Include="Src\OptionPanels\HexValidator.cs" />
<Compile Include="Src\Parser\Parser.cs" />
<Compile Include="Src\Project\VBNetToCSharpConvertVisitorWithMyFormsSupport.cs" />
<Compile Include="Src\Project\CSharpMyNamespaceBuilder.cs" />
@ -156,13 +157,14 @@ @@ -156,13 +157,14 @@
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Src\Completion" />
<Folder Include="Src\Refactoring" />
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="Src\Refactoring\IssueOptions.xaml" />
<Page Include="Src\OptionPanels\BuildOptions.xaml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

398
src/AddIns/BackendBindings/CSharpBinding/Project/Resources/BuildOptions.xfrm

@ -1,398 +0,0 @@ @@ -1,398 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="cSharpBuildOptionsPanel" />
<ClientSize value="{Width=527, Height=684}" />
<AutoScroll value="True" />
<Controls>
<System.Windows.Forms.GroupBox>
<Name value="generalGroupBox" />
<Location value="3, 3" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.General}" />
<Size value="521, 146" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Controls>
<System.Windows.Forms.Label>
<Name value="conditionalSymbolsLabel" />
<Location value="6, 16" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.ConditionalSymbols}" />
<Size value="509, 16" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="conditionalSymbolsTextBox" />
<TabIndex value="1" />
<Location value="6, 36" />
<Anchor value="Top, Left, Right" />
<Size value="509, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.CheckBox>
<Name value="optimizeCodeCheckBox" />
<Location value="6, 60" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.OptimizeCode}" />
<TabIndex value="2" />
<Size value="509, 21" />
<UseCompatibleTextRendering value="True" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="allowUnsafeCodeCheckBox" />
<Location value="6, 80" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.AllowUnsafeCode}" />
<TabIndex value="3" />
<Size value="509, 21" />
<UseCompatibleTextRendering value="True" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="checkForOverflowCheckBox" />
<Location value="6, 100" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.CheckForOverflow}" />
<TabIndex value="4" />
<Size value="509, 21" />
<UseCompatibleTextRendering value="True" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="noCorlibCheckBox" />
<Location value="6, 120" />
<Text value="${res:Dialog.ProjectOptions.BuildOptions.NoCorlib}" />
<TabIndex value="5" />
<Size value="509, 21" />
<UseCompatibleTextRendering value="True" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.CheckBox>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="outputGroupBox" />
<Location value="3, 152" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.Output}" />
<Size value="521, 362" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Controls>
<System.Windows.Forms.Button>
<Name value="projectUpdateButton" />
<Location value="337, 106" />
<Text value="Change" />
<UseVisualStyleBackColor value="True" />
<Size value="173, 23" />
<TabIndex value="12" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="outputPathLabel" />
<Location value="12, 17" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.OutputPath}" />
<Size value="509, 16" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="outputPathTextBox" />
<TabIndex value="4" />
<Location value="12, 37" />
<Anchor value="Top, Left, Right" />
<Size value="465, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="outputPathBrowseButton" />
<Location value="481, 37" />
<UseCompatibleTextRendering value="True" />
<Text value="..." />
<Size value="40, 21" />
<Anchor value="Top, Right" />
<TabIndex value="5" />
</System.Windows.Forms.Button>
<System.Windows.Forms.CheckBox>
<Name value="xmlDocumentationCheckBox" />
<Location value="12, 61" />
<Text value="${res:Dialog.ProjectOptions.Build.XmlDocumentationFile}" />
<TabIndex value="6" />
<Size value="154, 21" />
<UseCompatibleTextRendering value="True" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.TextBox>
<Name value="xmlDocumentationTextBox" />
<TabIndex value="7" />
<Location value="170, 61" />
<Anchor value="Top, Left, Right" />
<Size value="350, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="debugInfoLabel" />
<Location value="12, 85" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.DebugInfo}" />
<Size value="154, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="8" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="debugInfoComboBox" />
<TabIndex value="9" />
<Location value="170, 85" />
<Size value="161, 21" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="targetFrameworkLabel" />
<Location value="12, 109" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.TargetFramework}" />
<Size value="154, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="10" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="targetFrameworkComboBox" />
<TabIndex value="11" />
<Location value="170, 109" />
<Size value="161, 21" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.GroupBox>
<Name value="advancedOutputGroupBox" />
<Location value="6, 136" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.Advanced}" />
<Size value="509, 220" />
<Anchor value="Top, Left, Right" />
<TabIndex value="9" />
<Controls>
<System.Windows.Forms.Panel>
<Name value="platformSpecificOptionsPanel" />
<Location value="6, 14" />
<TabIndex value="9" />
<Size value="497, 121" />
<Anchor value="Top, Left, Right" />
<Controls>
<System.Windows.Forms.Label>
<Name value="generateSerializationAssemblyLabel" />
<Location value="3, 23" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.GenerateSerializationAssembly}" />
<Size value="180, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="1" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="dllBaseAddressTextBox" />
<TabIndex value="8" />
<Location value="189, 95" />
<Size value="140, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="dllBaseAddressLabel" />
<Location value="3, 95" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.DLLBaseAddress}" />
<Size value="180, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="7" />
</System.Windows.Forms.Label>
<System.Windows.Forms.CheckBox>
<Name value="registerCOMInteropCheckBox" />
<Location value="177, 1" />
<Text value="${res:Dialog.ProjectOptions.Build.RegisterForCOM}" />
<TabIndex value="0" />
<Size value="317, 21" />
<UseCompatibleTextRendering value="True" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.ComboBox>
<Name value="fileAlignmentComboBox" />
<TabIndex value="6" />
<Location value="189, 71" />
<Size value="180, 21" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="fileAlignmentLabel" />
<Location value="3, 71" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.FileAlignment}" />
<Size value="180, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="5" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="targetCpuComboBox" />
<TabIndex value="4" />
<Location value="189, 47" />
<Size value="180, 21" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="targetCpuLabel" />
<Location value="3, 47" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.TargetCPU}" />
<Size value="180, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="3" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="generateSerializationAssemblyComboBox" />
<TabIndex value="2" />
<Location value="189, 23" />
<Size value="180, 21" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
</Controls>
</System.Windows.Forms.Panel>
<System.Windows.Forms.Label>
<Name value="baseIntermediateOutputPathLabel" />
<Location value="6, 134" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.BaseIntermediateOutputPath}" />
<Size value="497, 16" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="baseIntermediateOutputPathTextBox" />
<TabIndex value="1" />
<Location value="6, 153" />
<Anchor value="Top, Left, Right" />
<Size value="446, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="baseIntermediateOutputPathBrowseButton" />
<Location value="463, 153" />
<UseCompatibleTextRendering value="True" />
<Text value="..." />
<Size value="40, 21" />
<Anchor value="Top, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="intermediateOutputPathLabel" />
<Location value="6, 177" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.IntermediateOutputPath}" />
<Size value="497, 16" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="intermediateOutputPathTextBox" />
<TabIndex value="1" />
<Location value="6, 193" />
<Anchor value="Top, Left, Right" />
<Size value="446, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="intermediateOutputPathBrowseButton" />
<Location value="463, 192" />
<UseCompatibleTextRendering value="True" />
<Text value="..." />
<Size value="40, 21" />
<Anchor value="Top, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="warningsGroupBox" />
<Location value="3, 518" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.ErrorsAndWarnings}" />
<Size value="521, 66" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Controls>
<System.Windows.Forms.Label>
<Name value="warningLevelLabel" />
<Location value="6, 16" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.WarningLevel}" />
<Size value="154, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
<System.Windows.Forms.ComboBox>
<Name value="warningLevelComboBox" />
<TabIndex value="1" />
<Location value="164, 16" />
<Size value="60, 21" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="suppressWarningsLabel" />
<Location value="6, 40" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.SuppressWarnings}" />
<Size value="154, 16" />
<TextAlign value="MiddleRight" />
<TabIndex value="2" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="suppressWarningsTextBox" />
<TabIndex value="3" />
<Location value="164, 40" />
<Anchor value="Top, Left, Right" />
<Size value="350, 20" />
</System.Windows.Forms.TextBox>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.GroupBox>
<Name value="treatWarningsAsErrorsGroupBox" />
<Location value="3, 588" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors}" />
<Size value="521, 92" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Controls>
<System.Windows.Forms.RadioButton>
<Name value="noneRadioButton" />
<Location value="6, 20" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.None}" />
<Size value="154, 21" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="specificWarningsRadioButton" />
<Location value="6, 42" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.Specific}" />
<Size value="154, 21" />
<TabIndex value="1" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="allRadioButton" />
<Location value="6, 65" />
<UseCompatibleTextRendering value="True" />
<Text value="${res:Dialog.ProjectOptions.Build.TreatWarningsAsErrors.All}" />
<Size value="154, 21" />
<TabIndex value="3" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.TextBox>
<Name value="specificWarningsTextBox" />
<TabIndex value="2" />
<Location value="164, 42" />
<Anchor value="Top, Left, Right" />
<Size value="351, 20" />
</System.Windows.Forms.TextBox>
</Controls>
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.UserControl>
</Components>

61
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.cs

@ -1,61 +0,0 @@ @@ -1,61 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
using StringPair = System.Collections.Generic.KeyValuePair<System.String, System.String>;
namespace CSharpBinding.OptionPanels
{
public class BuildOptions : AbstractBuildOptions
{
public override void LoadPanelContents()
{
SetupFromXmlResource("CSharpBinding.BuildOptions.xfrm");
InitializeHelper();
InitBaseIntermediateOutputPath();
InitIntermediateOutputPath();
InitOutputPath();
InitXmlDoc();
InitTargetFramework();
ConfigurationGuiBinding b;
b = helper.BindString("conditionalSymbolsTextBox", "DefineConstants", TextBoxEditMode.EditRawProperty);
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.CreateLocationButton("conditionalSymbolsTextBox");
b = helper.BindBoolean("optimizeCodeCheckBox", "Optimize", false);
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.CreateLocationButton("optimizeCodeCheckBox");
b = helper.BindBoolean("allowUnsafeCodeCheckBox", "AllowUnsafeBlocks", false);
b.CreateLocationButton("allowUnsafeCodeCheckBox");
b = helper.BindBoolean("checkForOverflowCheckBox", "CheckForOverflowUnderflow", false);
b.DefaultLocation = PropertyStorageLocations.ConfigurationSpecific;
b.CreateLocationButton("checkForOverflowCheckBox");
b = helper.BindBoolean("noCorlibCheckBox", "NoStdLib", false);
b.CreateLocationButton("noCorlibCheckBox");
InitDebugInfo();
InitAdvanced();
b = helper.BindStringEnum("fileAlignmentComboBox", "FileAlignment",
"4096",
new StringPair("512", "512"),
new StringPair("1024", "1024"),
new StringPair("2048", "2048"),
new StringPair("4096", "4096"),
new StringPair("8192", "8192"));
b.DefaultLocation = PropertyStorageLocations.PlatformSpecific;
b.RegisterLocationButton(advancedLocationButton);
InitWarnings();
helper.AddConfigurationSelector(this);
}
}
}

343
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml

@ -0,0 +1,343 @@ @@ -0,0 +1,343 @@
<?xml version="1.0" encoding="utf-8"?>
<optionpanels:ProjectOptionPanel
x:Class="CSharpBinding.OptionPanels.BuildOptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop"
xmlns:local="clr-namespace:CSharpBinding.OptionPanels"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
<optionpanels:ProjectOptionPanel.Resources>
<optionpanels:StorageLocationConverter
x:Key="converter" />
</optionpanels:ProjectOptionPanel.Resources>
<ScrollViewer
VerticalScrollBarVisibility="Auto">
<StackPanel
Orientation="Vertical">
<GroupBox
Header="{core:Localize Dialog.ProjectOptions.BuildOptions.General}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.ColumnSpan="2"
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.ConditionalSymbols}"></Label>
<optionpanels:StorageLocationPicker
Grid.Row="1"
Location="{Binding DefineConstants.Location}"
DockPanel.Dock="Left" />
<!--x:Name="conditionalSymbolsTextBox"-->
<TextBox Grid.Row="1" Grid.Column="1" Margin="5,2,5,2" HorizontalAlignment="Stretch"
Text="{Binding DefineConstants.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<optionpanels:StorageLocationPicker Grid.Row="2" DockPanel.Dock="Left" Location="{Binding Optimize.Location}"/>
<!--x:Name="optimizeCodeCheckBox"-->
<CheckBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center"
IsChecked="{Binding Optimize.Value}"
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.OptimizeCode}"></CheckBox>
<optionpanels:StorageLocationPicker Grid.Row="3" DockPanel.Dock="Left"
Location="{Binding AllowUnsafeBlocks.Location}"/>
<!--x:Name="allowUnsafeCodeCheckBox"-->
<CheckBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center"
IsChecked="{Binding AllowUnsafeBlocks.Value}"
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.AllowUnsafeCode}"></CheckBox>
<optionpanels:StorageLocationPicker Grid.Row="4" DockPanel.Dock="Left" Location="{Binding CheckForOverflowUnderflow.Location}"/>
<!--x:Name="checkForOverflowCheckBox"-->
<CheckBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Center"
IsChecked="{Binding CheckForOverflowUnderflow.Value}"
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.CheckForOverflow}"></CheckBox>
<optionpanels:StorageLocationPicker Grid.Row="5" DockPanel.Dock="Left" Location="{Binding NoStdLib.Location}"/>
<!--x:Name="noCorlibCheckBox"-->
<CheckBox Grid.Row="5" Grid.Column="1" VerticalAlignment="Center"
IsChecked="{Binding NoStdLib.Value}"
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.NoCorlib}"></CheckBox>
</Grid>
</GroupBox>
<GroupBox
Header="{core:Localize Dialog.ProjectOptions.Build.Output}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="50"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.Build.OutputPath}"></Label>
<optionpanels:StorageLocationPicker Grid.Row="1" DockPanel.Dock="Left"
Location="{Binding OutputPath.Location}"/>
<TextBox x:Name="outputPathTextBox" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
Text="{Binding OutputPath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Row="1" Grid.Column="3" Margin="3,0,3,0"
VerticalAlignment="Center"
Content="..."
Command="{Binding ChangeOutputPath}"></Button>
<optionpanels:StorageLocationPicker Grid.Row="2" DockPanel.Dock="Left" Location="{Binding DocumentationFile.Location}"/>
<CheckBox x:Name="xmlDocumentationCheckBox" Grid.Row="2" Grid.Column="1"
VerticalAlignment="Center"
Margin="3,0,3,0"
IsChecked="{Binding DocumentFileIsChecked}"
Content="{core:Localize Dialog.ProjectOptions.Build.XmlDocumentationFile}"></CheckBox>
<TextBox x:Name="xmlDocumentationTextBox" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2"
IsEnabled="{Binding DocumentFileIsChecked}"
Text="{Binding DocumentationFile.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<optionpanels:StorageLocationPicker Grid.Row="3" DockPanel.Dock="Left" Location="{Binding DebugType.Location}" />
<Label Grid.Row="3" Grid.Column="1" Margin="3,0,3,0"
HorizontalAlignment="Right"
Content="{core:Localize Dialog.ProjectOptions.Build.DebugInfo}"></Label>
<ComboBox Grid.Row="3" Grid.Column="2" Width="150"
VerticalAlignment="Center"
HorizontalAlignment="Left"
SelectedValue="{Binding Path=DebugType.Value}"
gui:EnumBinding.EnumType="{x:Type project:DebugSymbolType}"></ComboBox>
<Label Grid.Row="4" Grid.Column="1" Margin="3,0,3,0"
HorizontalAlignment="Right"
Content="{core:Localize Dialog.ProjectOptions.Build.TargetFramework}"></Label>
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2">
<ComboBox x:Name="targetFrameworkComboBox" Width="200" Margin="0,0,3,0"
VerticalAlignment="Center"
IsEnabled="False"></ComboBox>
<Button Margin="3,0,3,0" VerticalAlignment="Center"
Content="Change"
Command="{Binding UpdateProjectCommand}"
Style="{x:Static core:GlobalStyles.ButtonStyle}"></Button>
</StackPanel>
<GroupBox Grid.Row="5" Grid.ColumnSpan="4" Margin="5,10,0,0"
Header="{core:Localize Dialog.ProjectOptions.Build.Advanced}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition MinWidth="120"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="50"></ColumnDefinition>
</Grid.ColumnDefinitions>
<optionpanels:StorageLocationPicker Grid.Row="1" VerticalAlignment="Center">
<optionpanels:StorageLocationPicker.Location>
<MultiBinding Converter="{StaticResource converter}">
<Binding Path="RegisterForComInterop.Location" />
<Binding Path="GenerateSerializationAssemblies.Location" />
<Binding Path="PlatformTarget.Location" />
<Binding Path="FileAlignment.Location" />
<Binding Path="BaseAddress.Location" />
</MultiBinding>
</optionpanels:StorageLocationPicker.Location>
</optionpanels:StorageLocationPicker>
<!--x:Name="registerCOMInteropCheckBox"-->
<CheckBox Grid.Column="2"
IsChecked="{Binding RegisterForComInterop.Value}"
Content="{core:Localize Dialog.ProjectOptions.Build.RegisterForCOM}"></CheckBox>
<Label Grid.Row="1" Grid.Column="1"
HorizontalAlignment="Right"
Content="{core:Localize Dialog.ProjectOptions.Build.GenerateSerializationAssembly}"></Label>
<!--x:Name="generateSerializationAssemblyComboBox"-->
<ComboBox Grid.Row="1" Grid.Column="2"
VerticalAlignment="Center"
ItemsSource="{Binding Path=DataContext.SerializationInfo}"
SelectedValue="{Binding Path=GenerateSerializationAssemblies.Value}"
DisplayMemberPath="DisplayValue"
SelectedValuePath="Key"></ComboBox>
<Label Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right"
Content="{core:Localize Dialog.ProjectOptions.Build.TargetCPU}"></Label>
<!--x:Name="targetCpuComboBox"-->
<ComboBox Grid.Row="2" Grid.Column="2" VerticalAlignment="Center"
ItemsSource="{Binding Path=DataContext.TargetCPU}"
SelectedValue="{Binding Path=PlatformTarget.Value}"
DisplayMemberPath="DisplayValue"
SelectedValuePath="Key"></ComboBox>
<Label Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right"
Content="{core:Localize Dialog.ProjectOptions.Build.FileAlignment}"></Label>
<!--x:Name="fileAlignmentComboBox"-->
<ComboBox Grid.Row="3" Grid.Column="2" VerticalAlignment="Center"
ItemsSource="{Binding Path=DataContext.FileAlign}"
SelectedValue="{Binding Path=FileAlignment.Value}"
DisplayMemberPath="DisplayValue"
SelectedValuePath="Key"></ComboBox>
<Label Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right"
Content="{core:Localize Dialog.ProjectOptions.Build.DLLBaseAddress}"></Label>
<!-- Hex binding -->
<!--x:Name="dllBaseAddressTextBox"-->
<TextBox Grid.Row="4" Grid.Column="2">
<TextBox.Text>
<Binding Path="BaseAddress.Value" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:HexValidator />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<!-- location multibinding -->
<Label Grid.Row="6" Grid.ColumnSpan="2"
Content="{core:Localize Dialog.ProjectOptions.Build.BaseIntermediateOutputPath}"></Label>
<optionpanels:StorageLocationPicker Grid.Row="7"
Location="{Binding BaseIntermediateOutputPath.Location}"
DockPanel.Dock="Left" />
<TextBox x:Name="baseIntermediateOutputPathTextBox" Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3"
Text="{Binding BaseIntermediateOutputPath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Row="7" Grid.Column="4" Margin="3,0,3,0"
Content="..."
VerticalAlignment="Center"
Command="{Binding BaseIntermediateOutputPathCommand}"></Button>
<Label Grid.Row="8" Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.Build.IntermediateOutputPath}"></Label>
<optionpanels:StorageLocationPicker Grid.Row="9" DockPanel.Dock="Left"
Location="{Binding IntermediateOutputPath.Location}"/>
<TextBox x:Name="intermediateOutputPathTextBox" Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="3"
Text="{Binding IntermediateOutputPath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Row="9" Grid.Column="4" Margin="3,0,3,0"
Content="..."
VerticalAlignment="Center"
Command="{Binding IntermediateOutputPathCommand}"></Button>
</Grid>
</GroupBox>
</Grid>
</GroupBox>
<GroupBox Margin="0,8,0,0"
Header="{core:Localize Dialog.ProjectOptions.Build.ErrorsAndWarnings}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Label Grid.Column="1" Content="{core:Localize Dialog.ProjectOptions.Build.WarningLevel}"></Label>
<!--x:Name="warningLevelComboBox"-->
<ComboBox Grid.Column="2" Width="40" VerticalAlignment="Center" HorizontalAlignment="Left"
ItemsSource="{Binding Path=DataContext.WarnLevel}"
SelectedValue="{Binding Path=WarningLevel.Value}"
DisplayMemberPath="DisplayValue"
SelectedValuePath="Key"
SelectedIndex="4"></ComboBox>
<optionpanels:StorageLocationPicker Grid.Row="1" Location="{Binding NoWarn.Location}" DockPanel.Dock="Left" />
<Label Grid.Row="1" Grid.Column="1"
Content="{core:Localize Dialog.ProjectOptions.Build.SuppressWarnings}"></Label>
<!--x:Name="suppressWarningsTextBox"-->
<TextBox Grid.Row="1" Grid.Column="2"
Text="{Binding NoWarn.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
</Grid>
</GroupBox>
<GroupBox Margin="0,8,0,0"
Header="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<optionpanels:StorageLocationPicker Grid.Row="1" Location="{Binding TreatWarningsAsErrors.Location}">
</optionpanels:StorageLocationPicker>
<RadioButton x:Name="noneRadioButton" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0"
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.None}"></RadioButton>
<RadioButton x:Name="specificWarningsRadioButton" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0"
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.Specific}"></RadioButton>
<TextBox x:Name="specificWarningsTextBox" Grid.Row="1" Grid.Column="2" VerticalAlignment="Center"
Margin="3,0,3,0"
IsEnabled="{Binding ElementName=specificWarningsRadioButton, Path=IsChecked}"
Text="{Binding WarningsAsErrors.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<RadioButton x:Name="allRadioButton" Grid.Row="2" Grid.Column="1"
Margin="3,0,3,0"
VerticalAlignment="Center"
Content="{core:Localize Dialog.ProjectOptions.Build.TreatWarningsAsErrors.All}"></RadioButton>
</Grid>
</GroupBox>
</StackPanel>
</ScrollViewer>
</optionpanels:ProjectOptionPanel>

406
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs

@ -0,0 +1,406 @@ @@ -0,0 +1,406 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 05/02/2012
* Time: 19:54
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.IO;
using Gui.Dialogs.OptionPanels.ProjectOptions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Project.Converter;
using ICSharpCode.SharpDevelop.Widgets;
namespace CSharpBinding.OptionPanels
{
/// <summary>
/// Interaction logic for BuildOptionsXaml.xaml
/// </summary>
/// SYST
public partial class BuildOptions : ProjectOptionPanel
{
private List<KeyItemPair> serializationInfo;
private List<KeyItemPair> targetCPU;
private List<KeyItemPair> fileAlignment;
private List<KeyItemPair> warnLevel;
private System.Windows.Input.ICommand updateProjectCommand;
private System.Windows.Input.ICommand changeOutputPath;
private System.Windows.Input.ICommand baseIntermediateOutputPathCommand;
private System.Windows.Input.ICommand intermediateOutputPathCommand;
private MSBuildBasedProject project;
public BuildOptions()
{
InitializeComponent();
this.serializationInfo = new List<KeyItemPair>();
this.serializationInfo.Add (new KeyItemPair("Off",StringParser.Parse("${res:Dialog.ProjectOptions.Build.Off}")));
this.serializationInfo.Add (new KeyItemPair("On",StringParser.Parse("${res:Dialog.ProjectOptions.Build.On}")));
this.serializationInfo.Add (new KeyItemPair("Auto",StringParser.Parse( "${res:Dialog.ProjectOptions.Build.Auto}")));
this.SerializationInfo = this.serializationInfo;
this.targetCPU = new List<KeyItemPair>();
this.targetCPU.Add(new KeyItemPair( "AnyCPU",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Any}")));
this.targetCPU.Add(new KeyItemPair( "x86",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x86}")));
this.targetCPU.Add(new KeyItemPair( "x64",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.x64}")));
this.targetCPU.Add(new KeyItemPair( "Itanium",StringParser.Parse("${res:Dialog.ProjectOptions.Build.TargetCPU.Itanium}")));
this.TargetCPU = targetCPU;
fileAlignment = new List<KeyItemPair>();
fileAlignment.Add( new KeyItemPair("512", "512"));
fileAlignment.Add( new KeyItemPair("1024", "1024"));
fileAlignment.Add(new KeyItemPair("2048", "2048"));
fileAlignment.Add(new KeyItemPair("4096", "4096"));
fileAlignment.Add(new KeyItemPair("8192", "8192"));
FileAlign = fileAlignment;
this.warnLevel = new List<KeyItemPair>();
this.warnLevel.Add(new KeyItemPair("0","0"));
this.warnLevel.Add(new KeyItemPair("1","1"));
this.warnLevel.Add(new KeyItemPair("2","2"));
this.warnLevel.Add(new KeyItemPair("3","3"));
this.warnLevel.Add(new KeyItemPair("4","4"));
this.WarnLevel = warnLevel;
}
private void Initialize()
{
this.UpdateProjectCommand = new RelayCommand(UpdateProjectExecute);
this.ChangeOutputPath = new RelayCommand(ChangeOutputPathExecute);
UpdateTargetFrameworkCombo();
if (DocumentationFile.Value.Length > 0) {
documentFileIsChecked = true;
}
XmlDocHelper();
this.BaseIntermediateOutputPathCommand = new RelayCommand(BaseIntermediateOutputPathExecute);
this.IntermediateOutputPathCommand = new RelayCommand(IntermediateOutputPathExecute);
SetTreatWarningAsErrorRadioButtons();
}
#region properties
public ProjectProperty<string> DefineConstants {
get {return GetProperty("DefineConstants", "",
TextBoxEditMode.EditRawProperty,PropertyStorageLocations.ConfigurationSpecific); }
}
public ProjectProperty<bool> Optimize {
get { return GetProperty("Optimize", false, PropertyStorageLocations.ConfigurationSpecific); }
}
public ProjectProperty<bool> AllowUnsafeBlocks {
get { return GetProperty("AllowUnsafeBlocks", false); }
}
public ProjectProperty<bool> CheckForOverflowUnderflow {
get { return GetProperty("CheckForOverflowUnderflow", false, PropertyStorageLocations.ConfigurationSpecific); }
}
public ProjectProperty<bool> NoStdLib {
get { return GetProperty("NoStdLib", false); }
}
public ProjectProperty<string> OutputPath {
get {return GetProperty("OutputPath", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> DocumentationFile {
get {return GetProperty("DocumentationFile", "", TextBoxEditMode.EditRawProperty);}
}
public ProjectProperty<DebugSymbolType> DebugType {
get {return GetProperty("DebugType",ICSharpCode.SharpDevelop.Project.DebugSymbolType.Full ); }
}
// used in multibinding
public ProjectProperty<bool> RegisterForComInterop {
get {return GetProperty("RegisterForComInterop", false, PropertyStorageLocations.PlatformSpecific ); }
}
public ProjectProperty<string> GenerateSerializationAssemblies {
get {return GetProperty("GenerateSerializationAssemblies","Auto",
TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); }
}
public ProjectProperty<string> PlatformTarget {
get {return GetProperty("PlatformTarget","AnyCPU",
TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); }
}
public ProjectProperty<string> FileAlignment {
get {return GetProperty("FileAlignment","4096",
TextBoxEditMode.EditEvaluatedProperty, PropertyStorageLocations.PlatformSpecific ); }
}
public ProjectProperty<string> BaseAddress {
get {return GetProperty("BaseAddress","0x400000",
TextBoxEditMode.EditEvaluatedProperty,PropertyStorageLocations.PlatformSpecific ); }
}
public ProjectProperty<string> BaseIntermediateOutputPath {
get {return GetProperty("BaseIntermediateOutputPath",@"obj\",
TextBoxEditMode.EditRawProperty,PropertyStorageLocations.ConfigurationSpecific ); }
}
public ProjectProperty<string> IntermediateOutputPath {
get {return GetProperty("IntermediateOutputPath",@"obj\$(Configuration)\",TextBoxEditMode.EditRawProperty ); }
}
public ProjectProperty<string> WarningLevel {
get {return GetProperty("WarningLevel","4",TextBoxEditMode.EditEvaluatedProperty ); }
}
public ProjectProperty<string> NoWarn {
get {return GetProperty("NoWarn","",TextBoxEditMode.EditRawProperty ); }
}
public ProjectProperty<string> WarningsAsErrors {
get {return GetProperty("WarningsAsErrors","",TextBoxEditMode.EditRawProperty ); }
}
public ProjectProperty<bool> TreatWarningsAsErrors {
get {return GetProperty("TreatWarningsAsErrors", false); }
}
#endregion
#region overrides
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
this.project = project;
this.Initialize();
}
protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
{
SaveTreatWarningAsErrorRadioButtons();
return base.Save(project, configuration, platform);
}
#endregion
#region Documentation File
private bool documentFileIsChecked;
public bool DocumentFileIsChecked {
get { return documentFileIsChecked; }
set { documentFileIsChecked = value;
XmlDocHelper();
base.RaisePropertyChanged(() => DocumentFileIsChecked);
}
}
private void XmlDocHelper()
{
if (DocumentFileIsChecked) {
this.xmlDocumentationTextBox.Text = MSBuildInternals.Escape(
Path.ChangeExtension(ICSharpCode.Core.FileUtility.GetRelativePath(project.Directory, project.OutputAssemblyFullPath),
".xml"));
} else {
this.xmlDocumentationTextBox.Text = string.Empty;
}
}
#endregion
#region Command Update Project
public System.Windows.Input.ICommand UpdateProjectCommand {
get { return updateProjectCommand; }
set { updateProjectCommand = value;
base.RaisePropertyChanged(() =>this.UpdateProjectCommand);
}
}
private void UpdateProjectExecute ()
{
UpgradeViewContent.Show(project.ParentSolution).Select(project as IUpgradableProject);
this.UpdateTargetFrameworkCombo();
}
private void UpdateTargetFrameworkCombo()
{
TargetFramework fx = ((IUpgradableProject)project).CurrentTargetFramework;
if (fx != null) {
targetFrameworkComboBox.Items.Add(fx.DisplayName);
targetFrameworkComboBox.SelectedIndex = 0;
}
}
#endregion
#region ChangeOutputPathCommand
public System.Windows.Input.ICommand ChangeOutputPath
{
get {return this.changeOutputPath;}
set {this.changeOutputPath = value;
base.RaisePropertyChanged(() => this.ChangeOutputPath);
}
}
private void ChangeOutputPathExecute()
{
OutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
base.BaseDirectory,base.BaseDirectory,
outputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> OutputPath);
}
#endregion
#region SerializationInfo
public List<KeyItemPair> SerializationInfo {
get {return this.serializationInfo;}
set {this.serializationInfo = value;
base.RaisePropertyChanged(() => SerializationInfo);
}
}
#endregion
#region TargetCPU
public List<KeyItemPair> TargetCPU {
get { return targetCPU; }
set { targetCPU = value;
base.RaisePropertyChanged(() => TargetCPU);
}
}
#endregion
#region FileAlignment
public List<KeyItemPair> FileAlign {
get { return fileAlignment; }
set { fileAlignment = value;
base.RaisePropertyChanged(() => FileAlign);
}
}
#endregion
#region BaseIntermediateOutputPath
public System.Windows.Input.ICommand BaseIntermediateOutputPathCommand {
get{return this.baseIntermediateOutputPathCommand;}
set {this.baseIntermediateOutputPathCommand = value;
base.RaisePropertyChanged(() => BaseIntermediateOutputPathCommand);}
}
private void BaseIntermediateOutputPathExecute ()
{
BaseIntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
base.BaseDirectory,base.BaseDirectory,
this.baseIntermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> BaseIntermediateOutputPath);
}
#endregion
#region IntermediateOutputPath
public System.Windows.Input.ICommand IntermediateOutputPathCommand {
get{return this.intermediateOutputPathCommand;}
set {this.intermediateOutputPathCommand = value;
base.RaisePropertyChanged(() => IntermediateOutputPathCommand);}
}
private void IntermediateOutputPathExecute ()
{
IntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
base.BaseDirectory,base.BaseDirectory,
this.intermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> IntermediateOutputPath);
}
#endregion
#region WarningLevel
public List<KeyItemPair> WarnLevel {
get { return warnLevel; }
set { warnLevel = value;
base.RaisePropertyChanged(() => WarnLevel);
}
}
#endregion
#region SpecificWarnings TreatWarningsAsErrors
private void SetTreatWarningAsErrorRadioButtons()
{
if (this.TreatWarningsAsErrors.Value) {
this.allRadioButton.IsChecked = true;
} else {
if (WarningsAsErrors.Value.Length > 0) {
this.specificWarningsRadioButton.IsChecked = true;
} else {
this.noneRadioButton.IsChecked = true;
}
}
this.noneRadioButton.Checked += ErrorButton_Checked;
this.allRadioButton.Checked += ErrorButton_Checked;
this.specificWarningsRadioButton.Checked += ErrorButton_Checked;
}
private void SaveTreatWarningAsErrorRadioButtons()
{
if ((bool)this.noneRadioButton.IsChecked){
this.specificWarningsTextBox.Text = string.Empty;
}
if ((bool)this.allRadioButton.IsChecked) {
this.TreatWarningsAsErrors.Value = true;
} else {
this.TreatWarningsAsErrors.Value = false;
}
this.noneRadioButton.Checked -= ErrorButton_Checked;
this.allRadioButton.Checked -= ErrorButton_Checked;
this.specificWarningsRadioButton.Checked -= ErrorButton_Checked;
}
void ErrorButton_Checked(object sender, System.Windows.RoutedEventArgs e)
{
IsDirty = true;
}
#endregion
}
}

32
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/HexValidator.cs

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 22.05.2012
* Time: 20:46
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Globalization;
using System.Windows.Controls;
namespace CSharpBinding.OptionPanels
{
/// <summary>
/// Description of HexValidator.
/// </summary>
public class HexValidator :ValidationRule
{
// http://www.codeproject.com/Articles/15239/Validation-in-Windows-Presentation-Foundation
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
ValidationResult result = new ValidationResult(true, null);
var str = value.ToString();
var y = 0;
var res = Int32.TryParse(str,NumberStyles.HexNumber,CultureInfo.InvariantCulture,out y);
if (!res) {
result = new ValidationResult(false, "No valid Hex Digit");
}
return result;
}
}
}

17
src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.addin

@ -14,28 +14,19 @@ @@ -14,28 +14,19 @@
</Manifest>
<Path path = "/SharpDevelop/BackendBindings/ProjectOptions/C++">
<OptionPanel id = "Application"
<OptionPanel id = "Application1"
label = "${res:Dialog.ProjectOptions.ApplicationSettings}"
class = "ICSharpCode.CppBinding.Project.ApplicationOptions" />
<OptionPanel id = "Preprocessor"
label = "${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor}"
class = "ICSharpCode.CppBinding.Project.PreprocessorOptions" />
<OptionPanel id = "Linker"
label = "${res:ICSharpCode.CppBinding.ProjectOptions.Linker}"
class = "ICSharpCode.CppBinding.Project.LinkerOptions" />
<!--<OptionPanel id = "BuildEvents"
label = "${res:Dialog.ProjectOptions.BuildEvents}"
class = "ICSharpCode.CppBinding.Project.BuildEventOptions"/>-->
<!--<OptionPanel id = "ReferencePaths"
label = "${res:Dialog.ProjectOptions.ReferencePaths}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.ReferencePaths"/>
<OptionPanel id = "Signing"
label = "${res:Dialog.ProjectOptions.Signing}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.Signing"/>
<OptionPanel id = "DebugOptions"
label = "${res:Dialog.ProjectOptions.DebugOptions}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>/-->
<Include id = "AllManaged" path="/SharpDevelop/BackendBindings/ProjectOptions/AllManaged"/>
</Path>

49
src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.csproj

@ -58,6 +58,8 @@ @@ -58,6 +58,8 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="Microsoft.Build" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -65,44 +67,37 @@ @@ -65,44 +67,37 @@
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="CppFormattingStrategy.cs" />
<Compile Include="CppLanguageBinding.cs" />
<Compile Include="Project\DependencyRelation.cs" />
<Compile Include="Project\ApplicationOptions.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Project\LinkerOptions.cs">
<SubType>UserControl</SubType>
<DependentUpon>ApplicationOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Project\BuildEventOptions.cs">
<SubType>UserControl</SubType>
<Compile Include="Project\DependencyRelation.cs" />
<Compile Include="Project\LinkerOptions.xaml.cs">
<DependentUpon>LinkerOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Project\ItemDefinitionGroupBinding.cs" />
<Compile Include="Project\ObservedBinding.cs" />
<Compile Include="Project\OpenStringListEditorEvent.cs" />
<Compile Include="Project\PreprocessorOptions.cs">
<SubType>UserControl</SubType>
<Compile Include="Project\PreprocessorOptions.xaml.cs">
<DependentUpon>PreprocessorOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Project\ProjectConfigurationProjectItem.cs" />
<Compile Include="Project\ResourceScript.cs" />
<Compile Include="Project\SpecifyCliRuntimeLibraryCommand.cs" />
<Compile Include="Project\CppProject.cs" />
<Compile Include="Project\StringListEditorDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Project\StringListEditorDialog.Designer.cs">
<DependentUpon>StringListEditorDialog.cs</DependentUpon>
</Compile>
<None Include="CppBinding.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="CppProjectBinding.cs" />
<EmbeddedResource Include="Resources\LinkerOptions.xfrm" />
<EmbeddedResource Include="Resources\PreprocessorOptions.xfrm" />
<None Include="Templates\ConsoleProject.xpt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@ -145,8 +140,20 @@ @@ -145,8 +140,20 @@
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
<Private>False</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>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
<Page Include="Project\ApplicationOptions.xaml" />
<Page Include="Project\LinkerOptions.xaml" />
<Page Include="Project\PreprocessorOptions.xaml" />
</ItemGroup>
</Project>

381
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs

@ -1,51 +1,172 @@ @@ -1,51 +1,172 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
/*
* Utworzone przez SharpDevelop.
* Użytkownik: trecio
* Data: 2009-07-06
* Godzina: 22:31
*
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych.
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 01.04.2012
* Time: 17:16
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CppBinding.Project
{
/// <summary>
/// Application settings panel for c++ project.
/// Interaction logic for ApplicationSettingsXaml.xaml
/// </summary>
public class ApplicationOptions : ICSharpCode.SharpDevelop.Gui.OptionPanels.ApplicationSettings
public partial class ApplicationOptions : ProjectOptionPanel
{
public override void LoadPanelContents()
private const string iconsfilter = "${res:SharpDevelop.FileFilter.Icons}|*.ico|${res:SharpDevelop.FileFilter.AllFiles}|*.*";
private const string manifestFilter = "${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.ManifestFiles}|*.manifest|${res:SharpDevelop.FileFilter.AllFiles}|*.*";
private const string win32filter = "Win32 Resource files|*.res|${res:SharpDevelop.FileFilter.AllFiles}|*.*";
MSBuildBasedProject project;
public ApplicationOptions()
{
InitializeComponent();
}
#region Initialize
private void Initialize()
{
base.LoadPanelContents();
ComboBox cbOutputType = Get<ComboBox>("outputType");
helper.AddBinding("ConfigurationType", new ObservedBinding<string, ComboBox>(cbOutputType, ConvertOutputType));
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project, helper.Configuration, helper.Platform);
foreach (var c in GetPossibleStartupObjects(project)) {
startupObjectComboBox.Items.Add(c.FullName);
}
//this.outputTypeComboBox.SelectedValue = OutputType.Value.ToString();
SetOutputTypeCombo();
FillManifestCombo();
// embedding manifests requires the project to target MSBuild 3.5 or higher
project_MinimumSolutionVersionChanged(null, null);
// re-evluate if the project has the minimum version whenever this options page gets visible
// because the "convert project" button on the compiling tab page might have updated the MSBuild version.
project.MinimumSolutionVersionChanged += project_MinimumSolutionVersionChanged;
projectFolderTextBox.Text = project.Directory;
projectFileTextBox.Text = Path.GetFileName(project.FileName);
//OptionBinding
RefreshStartupObjectEnabled(this, EventArgs.Empty);
RefreshOutputNameTextBox(this, null);
//SetApplicationIcon();
this.applicationIconTextBox.Text = GetApplicationIconPathFromResourceScripts();
ApplicationIconTextBox_TextChanged(this,null);
IsDirty = false;
this.applicationIconTextBox.TextChanged += ApplicationIconTextBox_TextChanged;
this.startupObjectComboBox.SelectionChanged += (s,e) => {IsDirty = true;};
this.outputTypeComboBox.SelectionChanged += OutputTypeComboBox_SelectionChanged;
}
void SetOutputTypeCombo()
{
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project, project.ActiveConfiguration, project.ActivePlatform);
string subsystem = group.GetElementMetadata("Link", "SubSystem");
string configurationType = project.GetEvaluatedProperty("ConfigurationType");
OutputType validOutputType = ConfigurationTypeToOutputType(configurationType, subsystem);
cbOutputType.SelectedIndex = Array.IndexOf((OutputType[])Enum.GetValues(typeof(OutputType)), validOutputType);
this.outputTypeComboBox.SelectedIndex = Array.IndexOf((OutputType[])Enum.GetValues(typeof(OutputType)), validOutputType);
}
TextBox tbApplicationIcon = Get<TextBox>("applicationIcon");
helper.AddBinding(null, new ObservedBinding<object, TextBox>(tbApplicationIcon, SetApplicationIcon));
tbApplicationIcon.Text = GetApplicationIconPathFromResourceScripts();
DisableWin32ResourceOptions();
void FillManifestCombo()
{
applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
foreach (string fileName in Directory.GetFiles(project.Directory, "*.manifest")) {
applicationManifestComboBox.Items.Add(Path.GetFileName(fileName));
}
applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.CreateButtonText}...>"));
applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.BrowseText}...>"));
applicationManifestComboBox.SelectedIndex = 0;
}
IsDirty = false;
void project_MinimumSolutionVersionChanged(object sender, EventArgs e)
{
// embedding manifests requires the project to target MSBuild 3.5 or higher
applicationManifestComboBox.IsEnabled = project.MinimumSolutionVersion >= Solution.SolutionVersionVS2008;
}
#endregion
#region Properties
public ProjectProperty<string> AssemblyName {
get { return GetProperty("AssemblyName", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> RootNamespace {
get { return GetProperty("RootNamespace", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<OutputType> OutputType {
get {return GetProperty("OutputType", ICSharpCode.SharpDevelop.Project.OutputType.Exe); }
}
public ProjectProperty<string> ApplicationIcon {
get { return GetProperty("ApplicationIcon", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> ApplicationManifest {
get { return GetProperty("ApplicationManifest", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> ConfigurationType {
get { return GetProperty("ConfigurationType", "", TextBoxEditMode.EditRawProperty); }
}
// public ProjectProperty<string> Win32Resource {
// get { return GetProperty("Win32Resource", "", TextBoxEditMode.EditRawProperty); }
// }
#endregion
#region overrides
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
this.project = project;
Initialize();
}
protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
{
ConfigurationType.Value = ConvertOutputType();
SetApplicationIcon();
return base.Save(project, configuration, platform);
}
#endregion
#region OutputType <-> ConfigurationType property mapping
/// <summary>
@ -53,33 +174,34 @@ namespace ICSharpCode.CppBinding.Project @@ -53,33 +174,34 @@ namespace ICSharpCode.CppBinding.Project
/// <para>The OutputType property is translated to ConfigurationType and Subsystem properties</para>
/// </summary>
/// <returns>the ConfigurationType associated to OutputType</returns>
string ConvertOutputType(ComboBox cbOutputType)
string ConvertOutputType()
{
OutputType[] values = (OutputType[])Enum.GetValues(typeof(OutputType));
OutputType outputType = values[cbOutputType.SelectedIndex];
OutputType outputType = values[this.outputTypeComboBox.SelectedIndex];
string subsystem = OutputTypeToSubsystem(outputType);
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project,
helper.Configuration, helper.Platform);
project.ActiveConfiguration, project.ActivePlatform);
group.SetElementMetadata("Link", "SubSystem", subsystem);
return OutputTypeToConfigurationType(outputType);
}
static string OutputTypeToConfigurationType(OutputType outputType)
{
switch (outputType)
{
case OutputType.Exe:
case ICSharpCode.SharpDevelop.Project.OutputType.Exe:
return "Application";
case OutputType.Library:
case ICSharpCode.SharpDevelop.Project.OutputType.Library:
return "DynamicLibrary";
case OutputType.Module:
case ICSharpCode.SharpDevelop.Project.OutputType.Module:
//TODO: get an apropriate way to handle netmodule creation
//see: http://msdn.microsoft.com/en-us/library/k669k83h(VS.80).aspx
LoggingService.Info(".netmodule output not supported, will produce a class library");
return "DynamicLibrary";
case OutputType.WinExe:
case ICSharpCode.SharpDevelop.Project.OutputType.WinExe:
return "Application";
}
throw new ArgumentException("Unknown OutputType value " + outputType);
@ -87,7 +209,7 @@ namespace ICSharpCode.CppBinding.Project @@ -87,7 +209,7 @@ namespace ICSharpCode.CppBinding.Project
static string OutputTypeToSubsystem(OutputType outputType)
{
if (OutputType.WinExe == outputType)
if (ICSharpCode.SharpDevelop.Project.OutputType.WinExe == outputType)
return "Windows";
return "Console";
}
@ -95,29 +217,72 @@ namespace ICSharpCode.CppBinding.Project @@ -95,29 +217,72 @@ namespace ICSharpCode.CppBinding.Project
static OutputType ConfigurationTypeToOutputType(string configurationType, string subsystem)
{
if ("Application" == configurationType && "Windows" != subsystem)
return OutputType.Exe;
return ICSharpCode.SharpDevelop.Project.OutputType.Exe;
else if ("Application" == configurationType && "Windows" == subsystem)
return OutputType.WinExe;
return ICSharpCode.SharpDevelop.Project.OutputType.WinExe;
else if ("DynamicLibrary" == configurationType)
return OutputType.Library;
return ICSharpCode.SharpDevelop.Project.OutputType.Library;
LoggingService.Info("ConfigurationType " +configurationType + " is not supported, will use Library output type");
return OutputType.Library;
return ICSharpCode.SharpDevelop.Project.OutputType.Library;
}
#endregion
#region Application icon property mapping
public static IList<IUnresolvedTypeDefinition> GetPossibleStartupObjects(IProject project)
{
List<IUnresolvedTypeDefinition> results = new List<IUnresolvedTypeDefinition>();
IProjectContent pc = project.ProjectContent;
if (pc != null) {
foreach (var c in pc.TopLevelTypeDefinitions) {
foreach (var m in c.Methods) {
if (m.IsStatic && m.Name == "Main") {
results.Add(c);
}
}
}
}
return results;
}
#region refresh Outputpath + StartupOptions
void RefreshOutputNameTextBox (object sender, TextChangedEventArgs e)
{
if (this.outputTypeComboBox.SelectedValue != null) {
var enmType = (OutputType) Enum.Parse(typeof(OutputType),this.outputTypeComboBox.SelectedValue.ToString());
this.outputNameTextBox.Text = this.assemblyNameTextBox.Text + CompilableProject.GetExtension(enmType);
}
}
void RefreshStartupObjectEnabled(object sender, EventArgs e)
{
if (this.outputTypeComboBox.SelectedValue != null) {
var enmType = (OutputType) Enum.Parse(typeof(OutputType),this.outputTypeComboBox.SelectedValue.ToString());
bool isLibrary = ICSharpCode.SharpDevelop.Project.OutputType.Library == enmType;
startupObjectComboBox.IsEnabled = !isLibrary;
}
}
void OutputTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
RefreshOutputNameTextBox(this,null);
RefreshStartupObjectEnabled(this,null);
IsDirty = true;
}
#endregion
#region ApplicationIcon
const string DEFAULT_ICON_ID = "ICON0";
const string DEFAULT_RC_NAME = "app.rc";
ResourceEntry foundIconEntry;
string iconResourceScriptPath; //path to the resource script where application icon is defined
static string AddResourceScriptToProject(IProject project, string rcFileName) {
string fileName = Path.Combine(project.Directory, rcFileName);
FileProjectItem rcFileItem = new FileProjectItem(project, project.GetDefaultItemType(fileName));
rcFileItem.Include = FileUtility.GetRelativePath(project.Directory, fileName);
((IProjectItemListProvider)project).AddProjectItem(rcFileItem);
return fileName;
}
ResourceEntry foundIconEntry;
/// <summary>
/// Gets the icon file location from the rc files added to project.
@ -147,11 +312,12 @@ namespace ICSharpCode.CppBinding.Project @@ -147,11 +312,12 @@ namespace ICSharpCode.CppBinding.Project
return foundIconEntry != null ? foundIconEntry.Data : null;
}
object SetApplicationIcon(TextBox tb) {
string iconPath = tb.Text;
void SetApplicationIcon() {
string iconPath = this.applicationIconTextBox.Text;
string newIconId;
ResourceScript rc;
if (iconPath.Trim() == "") return null;
if (iconPath.Trim() == "") return;
if (iconResourceScriptPath != null)
{
rc = new ResourceScript(iconResourceScriptPath);
@ -164,20 +330,121 @@ namespace ICSharpCode.CppBinding.Project @@ -164,20 +330,121 @@ namespace ICSharpCode.CppBinding.Project
rc = new ResourceScript();
newIconId = DEFAULT_ICON_ID;
}
rc.SetIcon(newIconId, iconPath);
rc.Save(iconResourceScriptPath);
return null;
}
static string AddResourceScriptToProject(IProject project, string rcFileName) {
string fileName = Path.Combine(project.Directory, rcFileName);
FileProjectItem rcFileItem = new FileProjectItem(project, project.GetDefaultItemType(fileName));
rcFileItem.Include = FileUtility.GetRelativePath(project.Directory, fileName);
((IProjectItemListProvider)project).AddProjectItem(rcFileItem);
return fileName;
}
void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{
string fileName = OptionsHelper.OpenFile(iconsfilter);
if (!String.IsNullOrEmpty(fileName))
{
this.applicationIconTextBox.Text = fileName;
}
}
void ApplicationIconTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (project != null) {
if(FileUtility.IsValidPath(this.applicationIconTextBox.Text))
{
string appIconPath = Path.Combine(project.Directory, this.applicationIconTextBox.Text);
Console.WriteLine(appIconPath);
var b = File.Exists(appIconPath);
if (File.Exists(appIconPath)) {
try {
FileStream stream = new FileStream(appIconPath, FileMode.Open, FileAccess.Read);
Image image = new Image();
BitmapImage src = new BitmapImage();
src.BeginInit();
src.StreamSource = stream;
src.EndInit();
image.Source = src;
image.Stretch = Stretch.Uniform;
this.applicationIconImage.Source = image.Source;
this.applicationIconImage.Stretch = Stretch.Fill;
IsDirty = true;
} catch (OutOfMemoryException) {
this.applicationIconImage.Source = null;
MessageService.ShowErrorFormatted("${res:Dialog.ProjectOptions.ApplicationSettings.InvalidIconFile}",
FileUtility.NormalizePath(appIconPath));
}
} else {
this.applicationIconImage.Source = null;
}
}
}
}
#endregion
#region Resource file property mapping
void DisableWin32ResourceOptions() {
Button win32ResourceFileBrowseButton = Get<Button>("win32ResourceFileBrowse");
win32ResourceFileBrowseButton.Enabled = false;
TextBox win32ResourceFileTextBox = Get<TextBox>("win32ResourceFile");
win32ResourceFileTextBox.Enabled = false;
#region manifest
void ApplicationManifestComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (applicationManifestComboBox.SelectedIndex == applicationManifestComboBox.Items.Count - 2) {
CreateManifest();
} else if (applicationManifestComboBox.SelectedIndex == applicationManifestComboBox.Items.Count - 1) {
BrowseForManifest();
}
}
void BrowseForManifest()
{
applicationManifestComboBox.SelectedIndex = -1;
var fileName = OptionsHelper.OpenFile(manifestFilter);
if (!String.IsNullOrEmpty(fileName)) {
this.applicationManifestComboBox.Items.Insert(0,fileName);
this.applicationManifestComboBox.SelectedIndex = 0;
}
}
void CreateManifest()
{
string manifestFile = Path.Combine(project.Directory, "app.manifest");
if (!File.Exists(manifestFile)) {
string defaultManifest;
using (Stream stream = typeof(ApplicationSettings).Assembly.GetManifestResourceStream("Resources.DefaultManifest.manifest")) {
if (stream == null)
throw new ResourceNotFoundException("DefaultManifest.manifest");
using (StreamReader r = new StreamReader(stream)) {
defaultManifest = r.ReadToEnd();
}
}
defaultManifest = defaultManifest.Replace("\t", SD.EditorControlService.GlobalOptions.IndentationString);
File.WriteAllText(manifestFile, defaultManifest, System.Text.Encoding.UTF8);
FileService.FireFileCreated(manifestFile, false);
}
if (!project.IsFileInProject(manifestFile)) {
FileProjectItem newItem = new FileProjectItem(project, ItemType.None);
newItem.Include = "app.manifest";
ProjectService.AddProjectItem(project, newItem);
ProjectBrowserPad.RefreshViewAsync();
}
FileService.OpenFile(manifestFile);
this.applicationManifestComboBox.Items.Insert(0,"app.manifest");
this.applicationManifestComboBox.SelectedIndex = 0;
}
#endregion
}
}

134
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.xaml

@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<optionpanels:ProjectOptionPanel
x:Class="ICSharpCode.CppBinding.Project.ApplicationOptions"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="150"></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.ColumnSpan="2"
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.AssemblyName}"></Label>
<optionpanels:StorageLocationPicker Grid.Row="1" Location="{Binding AssemblyName.Location}" DockPanel.Dock="Left" />
<TextBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,0,5,0"
x:Name="assemblyNameTextBox"
TextChanged="RefreshOutputNameTextBox"
Text="{Binding AssemblyName.Value, UpdateSourceTrigger=PropertyChanged}"
></TextBox>
<Label Grid.Row="2" Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.RootNamespace}"></Label>
<optionpanels:StorageLocationPicker Grid.Row="3" Location="{Binding RootNamespace.Location}" DockPanel.Dock="Left" />
<TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center" Margin="0,0,5,0"
x:Name="rootNamespaceTextBox" Text="{Binding RootNamespace.Value,UpdateSourceTrigger=PropertyChanged}"
></TextBox>
<Label Grid.Row="4" Grid.ColumnSpan="2" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.OutputType}"></Label>
<Label Grid.Row="4" Grid.Column="2" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.StartupObject}"></Label>
<optionpanels:StorageLocationPicker Grid.Row="5" Location="{Binding OutputType.Location}" DockPanel.Dock="Left" />
<ComboBox x:Name="outputTypeComboBox" Grid.Row="5" Grid.Column="1" Margin="5,0,5,0"
VerticalAlignment="Center"
gui:EnumBinding.EnumType="{x:Type project:OutputType}">
</ComboBox>
<ComboBox x:Name="startupObjectComboBox" VerticalAlignment="Center" Margin="5,0,5,0"
Grid.Row="5" Grid.Column="2" IsEnabled="False"></ComboBox>
<Image x:Name="applicationIconImage" Width="32" Height="32" Grid.Row="6" ></Image>
<Label Grid.Row="6" Grid.Column="1"
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ApplicationIcon}"></Label>
<Grid Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<optionpanels:StorageLocationPicker Location="{Binding ApplicationIcon.Location}" DockPanel.Dock="Left" />
<TextBox x:Name="applicationIconTextBox" Grid.Column="1" VerticalAlignment="Center"
TextChanged="ApplicationIconTextBox_TextChanged"
Text="{Binding ApplicationIcon.Value,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Column="2" VerticalAlignment="Center" Padding="9,1" Margin="0,0,5,0"
Content="..." Click="ApplicationIconButton_Click"></Button>
</Grid>
<Label Grid.Row="7" Grid.Column="1" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.Manifest}"></Label>
<widgets:StackPanelWithSpacing SpaceBetweenItems="3" Grid.Row="7" Grid.Column="2" Orientation="Horizontal">
<optionpanels:StorageLocationPicker Location="{Binding PreBuildEvent.Location}" DockPanel.Dock="Left" />
<ComboBox x:Name="applicationManifestComboBox" VerticalAlignment="Center" Width="200"
SelectionChanged="ApplicationManifestComboBox_SelectionChanged" ></ComboBox>
</widgets:StackPanelWithSpacing>
<GroupBox Grid.Row="9" Grid.ColumnSpan="3" Margin="0,5,0,0"
Header="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ProjectInformation}">
<Grid Margin="15,0,0,0" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ProjectFolder}"></Label>
<TextBox x:Name="projectFolderTextBox" Grid.Column="1" VerticalAlignment="Center"></TextBox>
<Label Grid.Row="1" Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ProjectFile}"></Label>
<TextBox x:Name="projectFileTextBox" VerticalAlignment="Center"
Grid.Row="1" Grid.Column="1"></TextBox>
<Label Grid.Row="2" VerticalAlignment="Center"
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.OutputName}"></Label>
<TextBox x:Name="outputNameTextBox" VerticalAlignment="Center"
Grid.Row="2" Grid.Column="1"></TextBox>
</Grid>
</GroupBox>
</Grid>
</ScrollViewer>
</optionpanels:ProjectOptionPanel>

37
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/BuildEventOptions.cs

@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
/*
* Utworzone przez SharpDevelop.
* Użytkownik: trecio
* Data: 2009-07-14
* Godzina: 14:34
*
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych.
*/
using System;
using System.Windows.Forms;
namespace ICSharpCode.CppBinding.Project
{
/*
/// <summary>
/// Description of BuildEventOptions.
/// </summary>
public class BuildEventOptions : ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents
{
public override void LoadPanelContents()
{
base.LoadPanelContents();
TextBox preBuildEventTextBox = Get<TextBox>("preBuildEvent");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(preBuildEventTextBox, "PreBuildEvent", "Command"));
TextBox postBuildEventTextBox = Get<TextBox>("postBuildEvent");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(postBuildEventTextBox, "PostBuildEvent", "Command"));
ComboBox runPostBuildEventComboBox = Get<ComboBox>("runPostBuildEvent");
runPostBuildEventComboBox.Enabled = false;
}
}*/
}

102
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ItemDefinitionGroupBinding.cs

@ -1,102 +0,0 @@ @@ -1,102 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
/*
* Utworzone przez SharpDevelop.
* Użytkownik: trecio
* Data: 2009-07-09
* Godzina: 11:15
*
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych.
*/
using System;
using ICSharpCode.SharpDevelop.Project;
using System.Windows.Forms;
namespace ICSharpCode.CppBinding.Project
{
/// <summary>
/// Configuration gui binding that connects a given control and a specified metadata value in Item Definition Group element.
///</summary>
public class ItemDefinitionGroupBinding<ControlType> : ConfigurationGuiBinding
where ControlType : Control
{
public delegate string GetValueDelegate(ControlType c);
public delegate void SetValueDelegate(ControlType c, string val);
public ItemDefinitionGroupBinding(ControlType c, string elementName, string metadataName) :
this(c, elementName, metadataName, null, null)
{
}
/// <summary>
/// Creates the binding.
/// </summary>
/// <param name="c">control which is being bind</param>
/// <param name="elementName">element name in the item definition group</param>
/// <param name="metadataName">name of the element metadata which value is bind to control</param>
/// <param name="getValue">function used to get string value of configuration attribute from control</param>
/// <param name="setValue">function used to set controls' state from string</param>
public ItemDefinitionGroupBinding(ControlType c, string elementName, string metadataName,
GetValueDelegate getValue, SetValueDelegate setValue) {
if (getValue == null)
getValue = DefaultGetValue;
if (setValue == null)
setValue = DefaultSetValue;
this.control = c;
this.elementName = elementName;
this.metadataName = metadataName;
this.getControlValue = getValue;
this.setControlValue = setValue;
c.TextChanged += SetHelperDirty;
}
public override void Load()
{
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(Project,
Helper.Configuration, Helper.Platform);
setControlValue(control, group.GetElementMetadata(elementName, metadataName));
}
public override bool Save()
{
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(Project,
Helper.Configuration, Helper.Platform);
string controlValue = getControlValue(control);
group.SetElementMetadata(elementName, metadataName, controlValue);
return true;
}
protected void SetHelperDirty(object o, EventArgs e)
{
Helper.IsDirty = true;
}
ControlType control;
string elementName;
string metadataName;
GetValueDelegate getControlValue;
SetValueDelegate setControlValue;
private string DefaultGetValue(ControlType c) { return c.Text; }
private void DefaultSetValue(ControlType c, string val) { c.Text = val; }
}
public class CheckBoxItemDefinitionGroupBinding : ItemDefinitionGroupBinding<CheckBox> {
public CheckBoxItemDefinitionGroupBinding(CheckBox c, string elementName, string metadataName) :
base(c, elementName, metadataName,
delegate (CheckBox checkBox) {
return checkBox.Checked ? "true" : "false";
},
delegate (CheckBox checkBox, string val) {
bool check;
if (bool.TryParse(val, out check))
checkBox.Checked = check;
})
{
c.TextChanged -= SetHelperDirty;
c.CheckedChanged += SetHelperDirty;
}
}
}

57
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.cs

@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
/*
* Utworzone przez SharpDevelop.
* Użytkownik: trecio
* Data: 2009-07-08
* Godzina: 12:07
*
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych.
*/
using ICSharpCode.Core;
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CppBinding.Project
{
using ListEditor = ICSharpCode.CppBinding.Project.OpenStringListEditorEvent<TextBox>;
/// <summary>
/// Directory settings for c++ application.
/// </summary>
public class LinkerOptions : AbstractXmlFormsProjectOptionPanel
{
public override void LoadPanelContents()
{
SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream(
"ICSharpCode.CppBinding.Resources.LinkerOptions.xfrm"));
InitializeHelper();
helper.BindString("libraryPathTextBox", "LibraryPath", TextBoxEditMode.EditRawProperty);
Get<Button>("libraryPath").Click += ListEditor.DirectoriesEditor(this, "libraryPath").Event;
TextBox additionalLibsTextBox = Get<TextBox>("additionalLibs");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(additionalLibsTextBox, "Link", "AdditionalDependencies"));
Get<Button>("additionalLibs").Click += ListEditor.SymbolsEditor(this, "additionalLibs").Event;
TextBox addModuleTextBox = Get<TextBox>("addModule");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(addModuleTextBox, "Link", "AddModuleNamesToAssembly"));
Get<Button>("addModule").Click += ListEditor.SymbolsEditor(this, "addModule").Event;
CheckBox debugInfoCheckBox = Get<CheckBox>("debugInfo");
helper.AddBinding(null, new CheckBoxItemDefinitionGroupBinding(debugInfoCheckBox, "Link", "GenerateDebugInformation"));
TextBox resourceFileTextBox = Get<TextBox>("resourceFile");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(resourceFileTextBox, "Link", "EmbedManagedResourceFile"));
Get<Button>("resourceFile").Click += ListEditor.SymbolsEditor(this, "resourceFile").Event;
TextBox additionalOptionsTextBox = Get<TextBox>("additionalOptions");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(additionalOptionsTextBox, "Link", "AdditionalOptions"));
}
}
}

89
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CppBinding.Project.LinkerOptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<GroupBox Header="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker}">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox x:Name="debugInfoCheckBox" VerticalAlignment="Center"
IsChecked="{Binding CheckBoxChecked}"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.GenerateDebugInfo}">
</CheckBox>
<Label Grid.Row="1" VerticalAlignment="Center"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.Library}"></Label>
<TextBox x:Name="libraryPathTextBox"
TextChanged="TextBox_TextChanged" Grid.Row="2" Margin="0,0,3,0"
Text="{Binding LibraryPath.Value, UpdateSourceTrigger=PropertyChanged}">
</TextBox>
<!--x:Name="libraryPathButton"-->
<Button VerticalAlignment="Center" Grid.Row="2" Padding="9,1"
Click="LibraryPathButton_Click"
Grid.Column="1" Content="..."></Button>
<Label Grid.Row="3" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}"></Label>
<TextBox x:Name="additionalLibsTextBox" VerticalAlignment="Center" Margin="0,0,5,0"
TextChanged="TextBox_TextChanged" Grid.Row="4">
</TextBox>
<Button Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Padding="9,1"
Click="AdditionalLibsButton_Click" Content="..." ></Button>
<Label Grid.Row="5"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"></Label>
<TextBox x:Name="addModuleTextBox" VerticalAlignment="Center" Margin="0,0,5,0"
TextChanged="TextBox_TextChanged" Grid.Row="6">
</TextBox>
<Button Grid.Column="1" Grid.Row="6" VerticalAlignment="Center" Padding="9,1"
Content="..."
Click="AddModuleButton_Click" ></Button>
<Label Grid.Row="7"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}" ></Label>
<TextBox x:Name="resourceFileTextBox" VerticalAlignment="Center" Margin="0,0,5,0"
TextChanged="TextBox_TextChanged" Grid.Row="8"></TextBox>
<!--x:Name="resourceFileButton"-->
<Button Grid.Row="8" Grid.Column="1" VerticalAlignment="Center" Padding="9,1"
Click="ResourceFileButton_Click" Content="...."></Button>
<Label Grid.Row="9" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.AdditionalOptions}"></Label>
<TextBox x:Name="additionalOptionsTextBox" VerticalAlignment="Center" Margin="0,0,5,0"
TextChanged="TextBox_TextChanged" Grid.Row="10" Grid.ColumnSpan="2">
</TextBox>
</Grid>
</GroupBox>
</ScrollViewer>
</optionpanels:ProjectOptionPanel>

188
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs

@ -0,0 +1,188 @@ @@ -0,0 +1,188 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 21.04.2012
* Time: 20:14
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CppBinding.Project
{
/// <summary>
/// Interaction logic for LinkerOptionsXaml.xaml
/// </summary>
public partial class LinkerOptions : ProjectOptionPanel
{
private const string metaElement ="Link";
private MSBuildBasedProject project;
public LinkerOptions()
{
InitializeComponent();
}
private void Initialize()
{
var msDefGroup = new MSBuildItemDefinitionGroup(project, project.ActiveConfiguration, project.ActivePlatform);
this.additionalLibsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalDependencies");
this.addModuleTextBox.Text = GetElementMetaData(msDefGroup,"AddModuleNamesToAssembly");
this.resourceFileTextBox.Text = GetElementMetaData(msDefGroup,"EmbedManagedResourceFile");
this.additionalOptionsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalOptions");
string def = GetElementMetaData(msDefGroup,"GenerateDebugInformation");
bool check;
if (bool.TryParse(def, out check))
{
this.CheckBoxChecked = check;
this.debugInfoCheckBox.IsChecked = check;
}
IsDirty = false;
}
#region Properties
public ProjectProperty<string> LibraryPath {
get { return GetProperty("LibraryPath", "", TextBoxEditMode.EditRawProperty); }
}
private bool checkBoxChecked;
public bool CheckBoxChecked {
get {return checkBoxChecked;}
set
{
checkBoxChecked = value;
IsDirty = true;
base.RaisePropertyChanged(() => CheckBoxChecked);
}
}
#endregion
#region Save/Load
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
HideHeader();
}
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
this.project = project;
Initialize();
}
protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
{
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project,
project.ActiveConfiguration, project.ActivePlatform);
SetElementMetaData(group,"AdditionalDependencies",this.additionalLibsTextBox.Text);
SetElementMetaData(group,"AddModuleNamesToAssembly",this.addModuleTextBox.Text);
SetElementMetaData(group,"EmbedManagedResourceFile",this.resourceFileTextBox.Text);
SetElementMetaData(group,"AdditionalOptions",this.additionalOptionsTextBox.Text);
string check = "false";
if ((bool)this.debugInfoCheckBox.IsChecked) {
check = "true";
}
SetElementMetaData(group,"GenerateDebugInformation",check);
return base.Save(project, configuration, platform);
}
#endregion
#region MSBuildItemDefinitionGroup Set-Get
private static string GetElementMetaData (MSBuildItemDefinitionGroup group,string name)
{
return group.GetElementMetadata(metaElement,name);
}
private static void SetElementMetaData (MSBuildItemDefinitionGroup group,string name,string value)
{
group.SetElementMetadata(metaElement,name,value);
}
#endregion
private void LibraryPathButton_Click(object sender, RoutedEventArgs e)
{
PopulateStringListEditor(StringParser.Parse("${res:Global.Folder}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.Library}:"),
this.libraryPathTextBox,
true);
}
private void AdditionalLibsButton_Click(object sender, RoutedEventArgs e)
{
PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AdditionalLibs}:"),
this.additionalLibsTextBox,
false);
}
private void AddModuleButton_Click(object sender, RoutedEventArgs e)
{
PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.AddModule}"),
this.addModuleTextBox,
false);
}
private void ResourceFileButton_Click(object sender, RoutedEventArgs e)
{
PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Linker.ManagedResourceFile}"),
this.resourceFileTextBox,
false);
}
public static void PopulateStringListEditor(string title, string listCaption,TextBox textBox,bool browseForDirectoty)
{
var stringListDialog = new StringListEditorDialog();
stringListDialog.TitleText = title;
stringListDialog.ListCaption = listCaption;
stringListDialog.BrowseForDirectory = browseForDirectoty;
string[] strings = textBox.Text.Split(';');
stringListDialog.LoadList (strings);
stringListDialog.ShowDialog();
if (stringListDialog.DialogResult ?? false) {
textBox.Text = String.Join(";",stringListDialog.GetList());
}
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
IsDirty = true;
}
}
}

48
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ObservedBinding.cs

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICSharpCode.SharpDevelop.Project;
using System.Windows.Forms;
namespace ICSharpCode.CppBinding.Project
{
public class ObservedBinding<Output, ControlType> : ConfigurationGuiBinding
where ControlType : Control
{
public delegate Output ObserverDelegate(ControlType c);
public delegate void LoaderDelegate(ControlType c);
public ObservedBinding(ControlType control, ObserverDelegate saveDelegate) : this(control, saveDelegate, null)
{
}
public ObservedBinding(ControlType control, ObserverDelegate saveDelegate, LoaderDelegate loadDelegate) {
this.control = control;
this.onLoad = loadDelegate;
this.onSave = saveDelegate;
}
public override void Load() {
if (onLoad != null)
onLoad(control);
}
public override bool Save()
{
if (onSave != null)
if (Property != null)
base.Set<Output>(onSave(control));
else
onSave(control);
return true;
}
private ControlType control;
private LoaderDelegate onLoad;
private ObserverDelegate onSave;
}
}

64
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/OpenStringListEditorEvent.cs

@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
/*
* Utworzone przez SharpDevelop.
* Użytkownik: trecio
* Data: 2009-07-09
* Godzina: 10:46
*
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych.
*/
using ICSharpCode.Core;
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace ICSharpCode.CppBinding.Project
{
sealed class OpenStringListEditorEvent<ControlType> where ControlType : Control {
public OpenStringListEditorEvent(XmlUserControl parent, string controlId) {
this.sourceControl = parent.Get<ControlType>(controlId);
this.listCaption = parent.Get<Label>(controlId).Text;
this.ShowBrowseButton = false;
}
public bool ShowBrowseButton { get; set; }
public string TitleText { get; set; }
public void Event(object source, EventArgs evt) {
using (StringListEditorDialog editor = new StringListEditorDialog()) {
string[] strings = sourceControl.Text.Split(';');
editor.BrowseForDirectory = ShowBrowseButton;
editor.ListCaption = listCaption;
if (TitleText != null)
editor.TitleText = TitleText;
editor.LoadList(strings);
if (editor.ShowDialog() == DialogResult.OK) {
strings = editor.GetList();
sourceControl.Text = string.Join(";", strings);
}
}
}
public static OpenStringListEditorEvent<ControlType> DirectoriesEditor(XmlUserControl parent, string controlId)
{
OpenStringListEditorEvent<ControlType> editor = new OpenStringListEditorEvent<ControlType>(parent, controlId);
editor.ShowBrowseButton = true;
editor.TitleText = StringParser.Parse("${res:Global.Folder}:");
return editor;
}
public static OpenStringListEditorEvent<ControlType> SymbolsEditor(XmlUserControl parent, string controlId)
{
OpenStringListEditorEvent<ControlType> editor = new OpenStringListEditorEvent<ControlType>(parent, controlId);
editor.ShowBrowseButton = false;
editor.TitleText = StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:");
return editor;
}
string listCaption;
ControlType sourceControl;
}
}

51
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.cs

@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
/*
* Utworzone przez SharpDevelop.
* Użytkownik: trecio
* Data: 2009-07-08
* Godzina: 12:07
*
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych.
*/
using ICSharpCode.Core;
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CppBinding.Project
{
using ListEditor = ICSharpCode.CppBinding.Project.OpenStringListEditorEvent<TextBox>;
/// <summary>
/// Directory settings for c++ application.
/// </summary>
public class PreprocessorOptions : AbstractXmlFormsProjectOptionPanel
{
public override void LoadPanelContents()
{
SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream(
"ICSharpCode.CppBinding.Resources.PreprocessorOptions.xfrm"));
InitializeHelper();
TextBox defineTextBox = Get<TextBox>("define");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(defineTextBox, "ClCompile", "PreprocessorDefinitions"));
Get<Button>("define").Click += ListEditor.SymbolsEditor(this, "define").Event;
helper.BindString("includePathTextBox", "IncludePath", TextBoxEditMode.EditRawProperty);
Get<Button>("includePath").Click += ListEditor.DirectoriesEditor(this, "includePath").Event;
TextBox undefineTextBox = Get<TextBox>("undefine");
helper.AddBinding(null, new ItemDefinitionGroupBinding<TextBox>(undefineTextBox, "ClCompile", "UndefinePreprocessorDefinitions"));
Get<Button>("undefine").Click += ListEditor.SymbolsEditor(this, "undefine").Event;
CheckBox undefineAllCheckBox = Get<CheckBox>("undefineAll");
helper.AddBinding(null, new CheckBoxItemDefinitionGroupBinding(undefineAllCheckBox, "ClCompile", "UndefineAllPreprocessorDefinitions"));
}
}
}

63
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
<optionpanels:ProjectOptionPanel x:Class="ICSharpCode.CppBinding.Project.PreprocessorOptions"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels;assembly=ICSharpCode.SharpDevelop"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project;assembly=ICSharpCode.SharpDevelop"
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<GroupBox Header="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30" ></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="50"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Includes}"></Label>
<TextBox x:Name="includePathTextBox" Grid.Row="1"
Text="{Binding IncludePath.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Row="1" VerticalAlignment="Center" Padding="9,1"
Click="IncludePathButton_Click" Margin="5" Grid.Column="1" Content="..."></Button>
<Label Grid.Row="2"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Definitions}"></Label>
<TextBox x:Name="defineTextBox" VerticalAlignment="Center"
TextChanged="TextBox_TextChanged" Grid.Row="3"></TextBox>
<Button Grid.Row="3" Grid.Column="1" Padding="9,1" Margin="5" VerticalAlignment="Center"
Click="DefinePathButton_Click"
Content="..."></Button>
<Label Grid.Row="4" Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Undefinitions}"></Label>
<TextBox x:Name="undefineTextBox" Grid.Row="5" VerticalAlignment="Center"
TextChanged="TextBox_TextChanged" ></TextBox>
<Button Grid.Row="5" Grid.Column="1" Padding="9,1" Margin="5" VerticalAlignment="Center"
Click="UndefineButton_Click"
Content="..."></Button>
<CheckBox x:Name="undefineAllCheckBox" Grid.Row="6" Margin="5"
IsChecked="{Binding CheckBoxChecked, UpdateSourceTrigger=PropertyChanged}"
Content="{core:Localize ICSharpCode.CppBinding.ProjectOptions.Preprocessor.UndefineAll}"></CheckBox>
</Grid>
</GroupBox>
</ScrollViewer>
</optionpanels:ProjectOptionPanel>

156
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs

@ -0,0 +1,156 @@ @@ -0,0 +1,156 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 14.04.2012
* Time: 17:53
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.CppBinding.Project
{
/// <summary>
/// Interaction logic for PreprocessorOptionsXaml.xaml
/// </summary>
public partial class PreprocessorOptions : ProjectOptionPanel
{
private const string metaElement ="ClCompile";
private MSBuildBasedProject project;
public PreprocessorOptions()
{
InitializeComponent();
}
private void Initialize()
{
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project,
project.ActiveConfiguration, project.ActivePlatform);
this.defineTextBox.Text = GetElementMetaData(group,"PreprocessorDefinitions");
this.undefineTextBox.Text = GetElementMetaData(group,"UndefinePreprocessorDefinitions" );
string defs = GetElementMetaData(group,"UndefineAllPreprocessorDefinitions");
bool check;
if (bool.TryParse(defs, out check))
{
this.CheckBoxChecked = check;
this.undefineAllCheckBox.IsChecked = check;
}
IsDirty = false;
}
#region Properties
public ProjectProperty<string> IncludePath {
get { return GetProperty("IncludePath", "", TextBoxEditMode.EditRawProperty); }
}
bool checkBoxChecked;
public bool CheckBoxChecked {
get {return checkBoxChecked;}
set
{
checkBoxChecked = value;
IsDirty = true;
base.RaisePropertyChanged(() => CheckBoxChecked);
}
}
#endregion
#region overrides
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
HideHeader();
}
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
this.project = project;
Initialize();
}
protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
{
MSBuildItemDefinitionGroup group = new MSBuildItemDefinitionGroup(project,
project.ActiveConfiguration, project.ActivePlatform);
SetElementMetaData(group,"PreprocessorDefinitions",this.defineTextBox.Text);
SetElementMetaData(group,"UndefinePreprocessorDefinitions",this.undefineTextBox.Text);
string check = "false";
if ((bool)this.undefineAllCheckBox.IsChecked) {
check = "true";
}
SetElementMetaData(group,"UndefineAllPreprocessorDefinitions",check);
return base.Save(project, configuration, platform);
}
#endregion
#region MSBuildItemDefinitionGroup Set-Get
private static string GetElementMetaData (MSBuildItemDefinitionGroup group,string name)
{
return group.GetElementMetadata(metaElement,name);
}
private static void SetElementMetaData (MSBuildItemDefinitionGroup group,string name,string value)
{
group.SetElementMetadata(metaElement,name,value);
}
#endregion
private void IncludePathButton_Click(object sender, RoutedEventArgs e)
{
LinkerOptions.PopulateStringListEditor(StringParser.Parse("${res:Global.Folder}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Includes}:"),
this.includePathTextBox,
true);
}
private void DefinePathButton_Click(object sender, RoutedEventArgs e)
{
LinkerOptions.PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.Preprocessor.Definitions}:"),
this.defineTextBox,
false);
}
private void UndefineButton_Click(object sender, RoutedEventArgs e)
{
LinkerOptions.PopulateStringListEditor(StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
StringParser.Parse("${res:ICSharpCode.CppBinding.ProjectOptions.SymbolLabel}:"),
this.undefineTextBox,
false);
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
IsDirty = true;
}
}
}

93
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/StringListEditorDialog.Designer.cs generated

@ -1,93 +0,0 @@ @@ -1,93 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
/*
* Utworzone przez SharpDevelop.
* Użytkownik: trecio
* Data: 2009-07-08
* Godzina: 20:34
*
* Do zmiany tego szablonu użyj Narzędzia | Opcje | Kodowanie | Edycja Nagłówków Standardowych.
*/
namespace ICSharpCode.CppBinding.Project
{
partial class StringListEditorDialog
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
stringListEditor = new ICSharpCode.SharpDevelop.Gui.StringListEditor();
this.SuspendLayout();
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.Location = new System.Drawing.Point(124, 231);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(205, 231);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// stringListEditor
//
this.stringListEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
this.stringListEditor.Location = new System.Drawing.Point(8, 8);
this.stringListEditor.Name = "stringListEditor";
this.stringListEditor.Size = new System.Drawing.Size(284, 215);
//
// StringListDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.stringListEditor);
this.Name = "StringListDialog";
this.ShowInTaskbar = false;
this.ResumeLayout(false);
}
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private ICSharpCode.SharpDevelop.Gui.StringListEditor stringListEditor;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save