2
// NullProgressMonitor.cs
7
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
9
// Permission is hereby granted, free of charge, to any person obtaining
10
// a copy of this software and associated documentation files (the
11
// "Software"), to deal in the Software without restriction, including
12
// without limitation the rights to use, copy, modify, merge, publish,
13
// distribute, sublicense, and/or sell copies of the Software, and to
14
// permit persons to whom the Software is furnished to do so, subject to
15
// the following conditions:
17
// The above copyright notice and this permission notice shall be
18
// included in all copies or substantial portions of the Software.
20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
using System.Collections;
32
using System.Threading;
35
namespace Mono.Addins.Setup.ProgressMonitoring
37
internal class NullProgressMonitor: MarshalByRefObject, IProgressMonitor
44
public string[] Messages {
47
return (string[]) messages.ToArray (typeof(string));
49
return new string [0];
53
public string[] Warnings {
56
return (string[]) warnings.ToArray (typeof(string));
58
return new string [0];
62
public ProgressError[] Errors {
65
return (ProgressError[]) errors.ToArray (typeof(ProgressError));
67
return new ProgressError [0];
71
public virtual void BeginTask (string name, int totalWork)
75
public virtual void EndTask ()
79
public virtual void BeginStepTask (string name, int totalWork, int stepSize)
83
public virtual void Step (int work)
87
public virtual TextWriter Log {
88
get { return TextWriter.Null; }
91
public virtual void ReportSuccess (string message)
94
messages = new ArrayList ();
95
messages.Add (message);
98
public virtual void ReportWarning (string message)
100
if (warnings == null)
101
warnings = new ArrayList ();
102
messages.Add (message);
105
public virtual void ReportError (string message, Exception ex)
108
errors = new ArrayList ();
110
if (message == null && ex != null)
111
message = ex.Message;
112
else if (message != null && ex != null) {
113
if (!message.EndsWith (".")) message += ".";
114
message += " " + ex.Message;
117
errors.Add (new ProgressError (message, ex));
120
public bool IsCancelRequested {
121
get { return canceled; }
124
public void Cancel ()
129
public virtual int LogLevel {
133
public virtual void Dispose ()
142
protected virtual void OnCompleted ()
147
internal class ProgressError
152
public ProgressError (string message, Exception ex)
155
this.message = message;
158
public string Message {
159
get { return message; }
162
public Exception Exception {