7 changed files with 141 additions and 150 deletions
@ -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> |
|
||||||
@ -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(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -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> |
||||||
@ -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 = PartCoverSettings.GetFileName(base.Project); |
||||||
|
if (File.Exists(settingsFileName)) { |
||||||
|
PartCoverSettings settings = new PartCoverSettings(settingsFileName); |
||||||
|
includeListTextBox.Text = ConvertToMultLineString(settings.Include); |
||||||
|
excludeListTextBox.Text = ConvertToMultLineString(settings.Exclude); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void SavePartCoverSettings() |
||||||
|
{ |
||||||
|
PartCoverSettings settings = new PartCoverSettings(); |
||||||
|
settings.Include.AddRange(MakeStringArray(includeListTextBox.Text)); |
||||||
|
settings.Exclude.AddRange(MakeStringArray(excludeListTextBox.Text)); |
||||||
|
settings.Save(PartCoverSettings.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; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue