diff options
Diffstat (limited to 'Common/OpenSim.Framework.Console/ConsoleBase.cs')
-rw-r--r-- | Common/OpenSim.Framework.Console/ConsoleBase.cs | 78 |
1 files changed, 74 insertions, 4 deletions
diff --git a/Common/OpenSim.Framework.Console/ConsoleBase.cs b/Common/OpenSim.Framework.Console/ConsoleBase.cs index 6a1c53c..0377998 100644 --- a/Common/OpenSim.Framework.Console/ConsoleBase.cs +++ b/Common/OpenSim.Framework.Console/ConsoleBase.cs | |||
@@ -1,3 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
1 | using System; | 28 | using System; |
2 | using System.IO; | 29 | using System.IO; |
3 | 30 | ||
@@ -41,7 +68,7 @@ namespace OpenSim.Framework.Console | |||
41 | 68 | ||
42 | public void Write(string format, params object[] args) | 69 | public void Write(string format, params object[] args) |
43 | { | 70 | { |
44 | WriteLine(LogPriority.NORMAL,format,args); | 71 | Notice(format,args); |
45 | return; | 72 | return; |
46 | } | 73 | } |
47 | 74 | ||
@@ -50,9 +77,9 @@ namespace OpenSim.Framework.Console | |||
50 | { | 77 | { |
51 | Log.WriteLine(format, args); | 78 | Log.WriteLine(format, args); |
52 | Log.Flush(); | 79 | Log.Flush(); |
53 | if(!m_silent) | 80 | if (!m_silent) |
54 | { | 81 | { |
55 | System.Console.WriteLine(format, args); | 82 | System.Console.WriteLine(format, args); |
56 | } | 83 | } |
57 | return; | 84 | return; |
58 | } | 85 | } |
@@ -68,6 +95,49 @@ namespace OpenSim.Framework.Console | |||
68 | return; | 95 | return; |
69 | } | 96 | } |
70 | 97 | ||
98 | public void Warn(string format, params object[] args) | ||
99 | { | ||
100 | WriteNewLine(ConsoleColor.Yellow, format, args); | ||
101 | return; | ||
102 | } | ||
103 | |||
104 | public void Notice(string format, params object[] args) | ||
105 | { | ||
106 | WriteNewLine(ConsoleColor.White, format, args); | ||
107 | return; | ||
108 | } | ||
109 | |||
110 | public void Error(string format, params object[] args) | ||
111 | { | ||
112 | WriteNewLine(ConsoleColor.Red, format, args); | ||
113 | return; | ||
114 | } | ||
115 | |||
116 | public void Verbose(string format, params object[] args) | ||
117 | { | ||
118 | WriteNewLine(ConsoleColor.Gray, format, args); | ||
119 | return; | ||
120 | } | ||
121 | |||
122 | public void Status(string format, params object[] args) | ||
123 | { | ||
124 | WriteNewLine(ConsoleColor.Blue, format, args); | ||
125 | return; | ||
126 | } | ||
127 | |||
128 | private void WriteNewLine(System.ConsoleColor color, string format, params object[] args) | ||
129 | { | ||
130 | Log.WriteLine(format, args); | ||
131 | Log.Flush(); | ||
132 | if (!m_silent) | ||
133 | { | ||
134 | System.Console.ForegroundColor = color; | ||
135 | System.Console.WriteLine(format, args); | ||
136 | System.Console.ResetColor(); | ||
137 | } | ||
138 | return; | ||
139 | } | ||
140 | |||
71 | public string ReadLine() | 141 | public string ReadLine() |
72 | { | 142 | { |
73 | string TempStr = System.Console.ReadLine(); | 143 | string TempStr = System.Console.ReadLine(); |
@@ -130,7 +200,7 @@ namespace OpenSim.Framework.Console | |||
130 | } | 200 | } |
131 | else | 201 | else |
132 | { | 202 | { |
133 | this.WriteLine(LogPriority.MEDIUM,"Valid options are " + OptionA + " or " + OptionB); | 203 | Notice("Valid options are " + OptionA + " or " + OptionB); |
134 | temp = CmdPrompt(prompt, defaultresponse); | 204 | temp = CmdPrompt(prompt, defaultresponse); |
135 | } | 205 | } |
136 | } | 206 | } |