24 changed files with 445 additions and 355 deletions
@ -1,93 +0,0 @@ |
|||||||
<Components version="1.0"> |
|
||||||
<System.Windows.Forms.UserControl> |
|
||||||
<Name value="NAntAddInOptionPanel" /> |
|
||||||
<ClientSize value="{Width=464, Height=344}" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.GroupBox> |
|
||||||
<Name value="nantConfigurationGroupBox" /> |
|
||||||
<Location value="{X=3,Y=3}" /> |
|
||||||
<Text value="NAnt Configuration" /> |
|
||||||
<Size value="{Width=448, Height=192}" /> |
|
||||||
<TabIndex value="2" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Controls> |
|
||||||
<System.Windows.Forms.CheckBox> |
|
||||||
<Name value="debugModeCheckBox" /> |
|
||||||
<CheckAlign value="MiddleRight" /> |
|
||||||
<Location value="{X=8,Y=160}" /> |
|
||||||
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
|
||||||
<Text value="&Debug" /> |
|
||||||
<TabIndex value="9" /> |
|
||||||
<Size value="{Width=120, Height=24}" /> |
|
||||||
</System.Windows.Forms.CheckBox> |
|
||||||
<System.Windows.Forms.CheckBox> |
|
||||||
<Name value="quietCheckBox" /> |
|
||||||
<CheckAlign value="MiddleRight" /> |
|
||||||
<Location value="{X=8,Y=88}" /> |
|
||||||
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
|
||||||
<Text value="&Quiet" /> |
|
||||||
<TabIndex value="6" /> |
|
||||||
<Size value="{Width=120, Height=24}" /> |
|
||||||
</System.Windows.Forms.CheckBox> |
|
||||||
<System.Windows.Forms.CheckBox> |
|
||||||
<Name value="verboseCheckBox" /> |
|
||||||
<CheckAlign value="MiddleRight" /> |
|
||||||
<Location value="{X=8,Y=136}" /> |
|
||||||
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
|
||||||
<Text value="Ver&bose" /> |
|
||||||
<TabIndex value="8" /> |
|
||||||
<Size value="{Width=120, Height=24}" /> |
|
||||||
</System.Windows.Forms.CheckBox> |
|
||||||
<System.Windows.Forms.CheckBox> |
|
||||||
<Name value="showLogoCheckBox" /> |
|
||||||
<CheckAlign value="MiddleRight" /> |
|
||||||
<Location value="{X=8,Y=112}" /> |
|
||||||
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
|
||||||
<Text value="Show &Logo" /> |
|
||||||
<TabIndex value="7" /> |
|
||||||
<Size value="{Width=120, Height=24}" /> |
|
||||||
</System.Windows.Forms.CheckBox> |
|
||||||
<System.Windows.Forms.Button> |
|
||||||
<Name value="browseButton" /> |
|
||||||
<Location value="{X=408,Y=36}" /> |
|
||||||
<Text value="..." /> |
|
||||||
<Size value="{Width=32, Height=23}" /> |
|
||||||
<Anchor value="Top, Right" /> |
|
||||||
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" /> |
|
||||||
<TabIndex value="3" /> |
|
||||||
</System.Windows.Forms.Button> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="argumentsTextBox" /> |
|
||||||
<TabIndex value="5" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=328, Height=21}" /> |
|
||||||
<Location value="{X=112,Y=64}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="nantArgumentsLabel" /> |
|
||||||
<Location value="{X=8,Y=64}" /> |
|
||||||
<Text value="&Arguments" /> |
|
||||||
<TextAlign value="MiddleLeft" /> |
|
||||||
<Size value="{Width=64, Height=16}" /> |
|
||||||
<TabIndex value="4" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
<System.Windows.Forms.TextBox> |
|
||||||
<Name value="nantCommandTextBox" /> |
|
||||||
<TabIndex value="2" /> |
|
||||||
<Anchor value="Top, Left, Right" /> |
|
||||||
<Size value="{Width=288, Height=21}" /> |
|
||||||
<Location value="{X=112,Y=36}" /> |
|
||||||
</System.Windows.Forms.TextBox> |
|
||||||
<System.Windows.Forms.Label> |
|
||||||
<Name value="nantCommandLabel" /> |
|
||||||
<Location value="{X=8,Y=34}" /> |
|
||||||
<Text value="&Command" /> |
|
||||||
<TextAlign value="MiddleLeft" /> |
|
||||||
<Size value="{Width=56, Height=16}" /> |
|
||||||
<TabIndex value="1" /> |
|
||||||
</System.Windows.Forms.Label> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.GroupBox> |
|
||||||
</Controls> |
|
||||||
</System.Windows.Forms.UserControl> |
|
||||||
</Components> |
|
@ -1,91 +0,0 @@ |
|||||||
// SharpDevelop samples
|
|
||||||
// Copyright (c) 2007, AlphaSierraPapa
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without modification, are
|
|
||||||
// permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// - Redistributions of source code must retain the above copyright notice, this list
|
|
||||||
// of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
// of conditions and the following disclaimer in the documentation and/or other materials
|
|
||||||
// provided with the distribution.
|
|
||||||
//
|
|
||||||
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
|
||||||
// endorse or promote products derived from this software without specific prior written
|
|
||||||
// permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
|
||||||
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
||||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
||||||
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Windows.Forms; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
|
||||||
|
|
||||||
namespace ICSharpCode.NAnt.Gui |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Options panel for the NAnt add-in.
|
|
||||||
/// </summary>
|
|
||||||
public class NAntAddInOptionPanel : XmlFormsOptionPanel |
|
||||||
{ |
|
||||||
static readonly string commandTextBoxName = "nantCommandTextBox"; |
|
||||||
static readonly string argumentsTextBoxName = "argumentsTextBox"; |
|
||||||
static readonly string verboseCheckBoxName = "verboseCheckBox"; |
|
||||||
static readonly string browseButtonName = "browseButton"; |
|
||||||
static readonly string showLogoCheckBoxName = "showLogoCheckBox"; |
|
||||||
static readonly string quietCheckBoxName = "quietCheckBox"; |
|
||||||
static readonly string debugModeCheckBoxName = "debugModeCheckBox"; |
|
||||||
|
|
||||||
public override void LoadPanelContents() |
|
||||||
{ |
|
||||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.NAnt.Resources.NAntAddInOptionPanel.xfrm")); |
|
||||||
|
|
||||||
ControlDictionary[commandTextBoxName].Text = AddInOptions.NAntFileName; |
|
||||||
ControlDictionary[argumentsTextBoxName].Text = AddInOptions.NAntArguments; |
|
||||||
((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked = AddInOptions.Verbose; |
|
||||||
((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked = AddInOptions.ShowLogo; |
|
||||||
((CheckBox)ControlDictionary[quietCheckBoxName]).Checked = AddInOptions.Quiet; |
|
||||||
((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked = AddInOptions.DebugMode; |
|
||||||
|
|
||||||
ControlDictionary[browseButtonName].Click += new EventHandler(OnBrowse); |
|
||||||
} |
|
||||||
|
|
||||||
public override bool StorePanelContents() |
|
||||||
{ |
|
||||||
AddInOptions.NAntFileName = ControlDictionary[commandTextBoxName].Text; |
|
||||||
AddInOptions.NAntArguments = ControlDictionary[argumentsTextBoxName].Text; |
|
||||||
AddInOptions.Verbose = ((CheckBox)ControlDictionary[verboseCheckBoxName]).Checked; |
|
||||||
AddInOptions.ShowLogo = ((CheckBox)ControlDictionary[showLogoCheckBoxName]).Checked; |
|
||||||
AddInOptions.Quiet = ((CheckBox)ControlDictionary[quietCheckBoxName]).Checked; |
|
||||||
AddInOptions.DebugMode = ((CheckBox)ControlDictionary[debugModeCheckBoxName]).Checked; |
|
||||||
|
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Allows the user to browse for the NAnt executable.
|
|
||||||
/// </summary>
|
|
||||||
void OnBrowse(object sender, EventArgs e) |
|
||||||
{ |
|
||||||
using (OpenFileDialog openFileDialog = new OpenFileDialog()) { |
|
||||||
|
|
||||||
openFileDialog.CheckFileExists = true; |
|
||||||
openFileDialog.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK) { |
|
||||||
ControlDictionary[commandTextBoxName].Text = openFileDialog.FileName; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,91 @@ |
|||||||
|
<gui:OptionPanel |
||||||
|
x:Class="ICSharpCode.NAnt.Gui.NAntAddInOptionsView" |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||||
|
xmlns:nant="clr-namespace:ICSharpCode.NAnt" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||||
|
|
||||||
|
<StackPanel> |
||||||
|
<GroupBox |
||||||
|
Header="NAnt Configuration" |
||||||
|
Padding="4"> |
||||||
|
<Grid> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
|
||||||
|
<Label Content="_Command:"/> |
||||||
|
<TextBox |
||||||
|
Grid.Column="1" |
||||||
|
Margin="2" |
||||||
|
Text="{Binding NAntFileName}"/> |
||||||
|
<Button |
||||||
|
Grid.Column="2" |
||||||
|
Content="..." |
||||||
|
Command="{Binding BrowseCommand}" |
||||||
|
Padding="4, 0" |
||||||
|
Margin="2"/> |
||||||
|
|
||||||
|
<Label |
||||||
|
Grid.Row="1" |
||||||
|
Content="_Arguments:"/> |
||||||
|
<TextBox |
||||||
|
Grid.Column="1" |
||||||
|
Grid.ColumnSpan="2" |
||||||
|
Grid.Row="1" |
||||||
|
Margin="2" |
||||||
|
Text="{Binding NAntArguments}"/> |
||||||
|
|
||||||
|
<Label |
||||||
|
Grid.Row="2" |
||||||
|
Content="_Quiet:"/> |
||||||
|
<CheckBox |
||||||
|
Grid.Row="2" |
||||||
|
Grid.ColumnSpan="2" |
||||||
|
Grid.Column="1" |
||||||
|
Margin="2" |
||||||
|
IsChecked="{Binding Quiet}"/> |
||||||
|
|
||||||
|
<Label |
||||||
|
Grid.Row="3" |
||||||
|
Content="Show _Logo:"/> |
||||||
|
<CheckBox |
||||||
|
Grid.Row="3" |
||||||
|
Grid.ColumnSpan="2" |
||||||
|
Grid.Column="1" |
||||||
|
Margin="2" |
||||||
|
IsChecked="{Binding ShowLogo}"/> |
||||||
|
|
||||||
|
<Label |
||||||
|
Grid.Row="4" |
||||||
|
Content="Ver_bose:"/> |
||||||
|
<CheckBox |
||||||
|
Grid.Row="4" |
||||||
|
Grid.ColumnSpan="2" |
||||||
|
Grid.Column="1" |
||||||
|
Margin="2" |
||||||
|
IsChecked="{Binding Verbose}"/> |
||||||
|
|
||||||
|
<Label |
||||||
|
Grid.Row="5" |
||||||
|
Content="_Debug:"/> |
||||||
|
<CheckBox |
||||||
|
Grid.Row="5" |
||||||
|
Grid.ColumnSpan="2" |
||||||
|
Grid.Column="1" |
||||||
|
Margin="2" |
||||||
|
IsChecked="{Binding Debug}"/> |
||||||
|
</Grid> |
||||||
|
</GroupBox> |
||||||
|
</StackPanel> |
||||||
|
</gui:OptionPanel> |
@ -0,0 +1,95 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2014, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using ICSharpCode.SharpDevelop.Widgets; |
||||||
|
using Microsoft.Win32; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt.Gui |
||||||
|
{ |
||||||
|
public partial class NAntAddInOptionsView : OptionPanel, INotifyPropertyChanged |
||||||
|
{ |
||||||
|
string nantFileName; |
||||||
|
|
||||||
|
public NAntAddInOptionsView() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
this.nantFileName = AddInOptions.NAntFileName; |
||||||
|
this.NAntArguments = AddInOptions.NAntArguments; |
||||||
|
this.Quiet = AddInOptions.Quiet; |
||||||
|
this.ShowLogo = AddInOptions.ShowLogo; |
||||||
|
this.Debug = AddInOptions.DebugMode; |
||||||
|
this.Verbose = AddInOptions.Verbose; |
||||||
|
this.BrowseCommand = new RelayCommand(Browse); |
||||||
|
this.DataContext = this; |
||||||
|
} |
||||||
|
|
||||||
|
public ICommand BrowseCommand { get; private set; } |
||||||
|
|
||||||
|
public string NAntFileName { |
||||||
|
get { return nantFileName; } |
||||||
|
set { |
||||||
|
nantFileName = value; |
||||||
|
base.RaisePropertyChanged(() => NAntFileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string NAntArguments { get; set; } |
||||||
|
public bool Quiet { get; set; } |
||||||
|
public bool Verbose { get; set; } |
||||||
|
public bool ShowLogo { get; set; } |
||||||
|
public bool Debug { get; set; } |
||||||
|
|
||||||
|
void Browse() |
||||||
|
{ |
||||||
|
var dialog = new OpenFileDialog(); |
||||||
|
dialog.DefaultExt = ".exe"; |
||||||
|
dialog.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); |
||||||
|
if (dialog.ShowDialog() == true) { |
||||||
|
NAntFileName = dialog.FileName; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool SaveOptions() |
||||||
|
{ |
||||||
|
AddInOptions.NAntFileName = nantFileName; |
||||||
|
AddInOptions.NAntArguments = NAntArguments; |
||||||
|
AddInOptions.Quiet = Quiet; |
||||||
|
AddInOptions.DebugMode = Debug; |
||||||
|
AddInOptions.Verbose = Verbose; |
||||||
|
AddInOptions.ShowLogo = ShowLogo; |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,78 @@ |
|||||||
|
// SharpDevelop samples
|
||||||
|
// Copyright (c) 2014, AlphaSierraPapa
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
|
||||||
|
// endorse or promote products derived from this software without specific prior written
|
||||||
|
// permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
|
||||||
|
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||||
|
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using System.Text; |
||||||
|
using ICSharpCode.SharpDevelop.Workbench; |
||||||
|
|
||||||
|
namespace ICSharpCode.NAnt |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// TextWriter implementation that writes into a MessageViewCategory.
|
||||||
|
/// </summary>
|
||||||
|
public class NAntMessageViewCategoryTextWriter : TextWriter |
||||||
|
{ |
||||||
|
readonly IOutputCategory target; |
||||||
|
StringBuilder output; |
||||||
|
|
||||||
|
public NAntMessageViewCategoryTextWriter(IOutputCategory target) |
||||||
|
{ |
||||||
|
this.target = target; |
||||||
|
this.output = new StringBuilder(); |
||||||
|
} |
||||||
|
|
||||||
|
public override Encoding Encoding { |
||||||
|
get { return Encoding.Unicode; } |
||||||
|
} |
||||||
|
|
||||||
|
public override void Write(char value) |
||||||
|
{ |
||||||
|
target.AppendText(value.ToString()); |
||||||
|
output.Append(value.ToString()); |
||||||
|
} |
||||||
|
|
||||||
|
public override void Write(string value) |
||||||
|
{ |
||||||
|
if (value != null) { |
||||||
|
target.AppendText(value); |
||||||
|
output.Append(value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void Write(char[] buffer, int index, int count) |
||||||
|
{ |
||||||
|
string text = new string(buffer, index, count); |
||||||
|
target.AppendText(text); |
||||||
|
output.Append(text); |
||||||
|
} |
||||||
|
|
||||||
|
public string Output { |
||||||
|
get { return output.ToString(); } |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue