Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez Gual <lluis@xamarin.com>2015-04-27 14:25:49 +0300
committerLluis Sanchez Gual <lluis@xamarin.com>2015-04-27 14:25:49 +0300
commited453e0097698c28a02b4bd6ecf2bb03672a2911 (patch)
tree2f0b46cabd8c3a7c576a488565ce6e0ab3286f7c /main/src/addins/Deployment/MonoDevelop.Deployment
parente662134048bbee039f9b8f99f181c4bf5ee35952 (diff)
IConsole revamp
Converted IConsole into the OperationConsole class. ConsoleFactory is also now a class. When creating a console, a cancellation token can be provided.
Diffstat (limited to 'main/src/addins/Deployment/MonoDevelop.Deployment')
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs32
1 files changed, 10 insertions, 22 deletions
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs
index 9bf6c7a886..ccef59d072 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs
@@ -92,9 +92,9 @@ namespace MonoDevelop.Deployment.Targets
protected override bool OnBuild (ProgressMonitor monitor, DeployContext ctx)
{
string consMsg;
- IConsole cons;
+ OperationConsole cons;
if (ExternalConsole) {
- cons = ExternalConsoleFactory.Instance.CreateConsole (CloseConsoleWhenDone);
+ cons = ExternalConsoleFactory.Instance.CreateConsole (CloseConsoleWhenDone, monitor.CancellationToken);
consMsg = GettextCatalog.GetString ("(in external terminal)");
} else {
cons = new MonitorConsole (monitor);
@@ -102,7 +102,7 @@ namespace MonoDevelop.Deployment.Targets
}
monitor.Log.WriteLine (GettextCatalog.GetString ("Executing: {0} {1} {2}", Command, Arguments, consMsg));
- ProcessAsyncOperation process = Runtime.ProcessService.StartConsoleProcess (Command, Arguments, workingDirectory, cons, null);
+ ProcessAsyncOperation process = Runtime.ProcessService.StartConsoleProcess (Command, Arguments, workingDirectory, cons);
process.Task.Wait ();
@@ -113,7 +113,7 @@ namespace MonoDevelop.Deployment.Targets
}
}
- class MonitorConsole: IConsole
+ class MonitorConsole: OperationConsole
{
StringReader nullReader;
ProgressMonitor monitor;
@@ -122,21 +122,15 @@ namespace MonoDevelop.Deployment.Targets
public MonitorConsole (ProgressMonitor monitor)
{
this.monitor = monitor;
- tr = monitor.CancellationToken.Register (OnCancel);
+ tr = monitor.CancellationToken.Register (CancellationSource.Cancel);
}
- public void Dispose ()
+ public override void Dispose ()
{
tr.Dispose ();
}
- void OnCancel ()
- {
- if (CancelRequested != null)
- CancelRequested (this, EventArgs.Empty);
- }
-
- public TextReader In {
+ public override TextReader In {
get {
if (nullReader == null)
nullReader = new StringReader ("");
@@ -144,22 +138,16 @@ namespace MonoDevelop.Deployment.Targets
}
}
- public TextWriter Out {
+ public override TextWriter Out {
get { return monitor.Log; }
}
- public TextWriter Error {
+ public override TextWriter Error {
get { return monitor.Log; }
}
- public TextWriter Log {
+ public override TextWriter Log {
get { return Out; }
}
-
- public bool CloseOnDispose {
- get { return false; }
- }
-
- public event EventHandler CancelRequested;
}
}