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
path: root/main/src
diff options
context:
space:
mode:
authorMichael Hutchinson <m.j.hutchinson@gmail.com>2011-08-24 20:31:26 +0400
committerMichael Hutchinson <m.j.hutchinson@gmail.com>2011-08-24 23:05:47 +0400
commit248ae4de2dcc3c7c3bb3ce7731f2350f4702693b (patch)
treecfa99b5ec18e6110a4e42f309077a9403b324958 /main/src
parent2324fe6a67a183fa390c05e1d636528974275018 (diff)
[Core] Allow ConsoleProgressMonitor to write to arbirtary TextWriter
Diffstat (limited to 'main/src')
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs20
1 files changed, 13 insertions, 7 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs
index 919b0fb7cd..fe0248f130 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.ProgressMonitoring/ConsoleProgressMonitor.cs
@@ -41,9 +41,15 @@ namespace MonoDevelop.Core.ProgressMonitoring
int col = -1;
LogTextWriter logger;
bool ignoreLogMessages;
+ TextWriter writer;
- public ConsoleProgressMonitor ()
+ public ConsoleProgressMonitor () : this (Console.Out)
{
+ }
+
+ public ConsoleProgressMonitor (TextWriter writer)
+ {
+ this.writer = writer;
logger = new LogTextWriter ();
logger.TextWritten += new LogTextEventHandler (WriteLog);
}
@@ -138,7 +144,7 @@ namespace MonoDevelop.Core.ProgressMonitoring
while (n < text.Length)
{
if (col == -1) {
- Console.Write (new String (' ', leftMargin));
+ writer.Write (new String (' ', leftMargin));
col = leftMargin;
}
@@ -167,11 +173,11 @@ namespace MonoDevelop.Core.ProgressMonitoring
else if (col >= maxCols)
n = lastWhite + 1;
- Console.Write (text.Substring (sn, lastWhite - sn));
+ writer.Write (text.Substring (sn, lastWhite - sn));
if (eol || col >= maxCols) {
col = -1;
- Console.WriteLine ();
+ writer.WriteLine ();
if (eol) n++;
}
}
@@ -181,7 +187,7 @@ namespace MonoDevelop.Core.ProgressMonitoring
{
ilevel += isize;
if (col != -1) {
- Console.WriteLine ();
+ writer.WriteLine ();
col = -1;
}
}
@@ -191,9 +197,9 @@ namespace MonoDevelop.Core.ProgressMonitoring
ilevel -= isize;
if (ilevel < 0) ilevel = 0;
if (col != -1) {
- Console.WriteLine ();
+ writer.WriteLine ();
col = -1;
}
}
}
-}
+} \ No newline at end of file