aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Console')
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs2
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs51
-rw-r--r--OpenSim/Framework/Console/LocalConsole.cs23
-rw-r--r--OpenSim/Framework/Console/MockConsole.cs29
4 files changed, 92 insertions, 13 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index b17dbc0..52bcd55 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Framework.Console
151 help.Add(commandInfo.descriptive_help); 151 help.Add(commandInfo.descriptive_help);
152 152
153 if (descriptiveHelp != string.Empty) 153 if (descriptiveHelp != string.Empty)
154 help.Add(string.Empty); 154 help.Add(string.Empty);
155 } 155 }
156 else 156 else
157 { 157 {
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index aab920b..22ce880 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console
89 89
90 return ret; 90 return ret;
91 } 91 }
92
93 public string CmdPrompt(string p, List<char> excludedCharacters)
94 {
95 bool itisdone = false;
96 string ret = String.Empty;
97 while (!itisdone)
98 {
99 itisdone = true;
100 ret = CmdPrompt(p);
101
102 foreach (char c in excludedCharacters)
103 {
104 if (ret.Contains(c.ToString()))
105 {
106 System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
107 itisdone = false;
108 }
109 }
110 }
111
112 return ret;
113 }
114
115 public string CmdPrompt(string p, string def, List<char> excludedCharacters)
116 {
117 bool itisdone = false;
118 string ret = String.Empty;
119 while (!itisdone)
120 {
121 itisdone = true;
122 ret = CmdPrompt(p, def);
123
124 if (ret == String.Empty)
125 {
126 ret = def;
127 }
128 else
129 {
130 foreach (char c in excludedCharacters)
131 {
132 if (ret.Contains(c.ToString()))
133 {
134 System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
135 itisdone = false;
136 }
137 }
138 }
139 }
140
141 return ret;
142 }
92 143
93 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options 144 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
94 public string CmdPrompt(string prompt, string defaultresponse, List<string> options) 145 public string CmdPrompt(string prompt, string defaultresponse, List<string> options)
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs
index a3036d0..6043094 100644
--- a/OpenSim/Framework/Console/LocalConsole.cs
+++ b/OpenSim/Framework/Console/LocalConsole.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// A console that uses cursor control and color 40 /// A console that uses cursor control and color
41 /// </summary> 41 /// </summary>
42 public class LocalConsole : CommandConsole 42 public class LocalConsole : CommandConsole
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console
100 private int SetCursorTop(int top) 100 private int SetCursorTop(int top)
101 { 101 {
102 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try 102 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
103 // to set a cursor row position with a currently invalid column, mono will throw an exception. 103 // to set a cursor row position with a currently invalid column, mono will throw an exception.
104 // Therefore, we need to make sure that the column position is valid first. 104 // Therefore, we need to make sure that the column position is valid first.
105 int left = System.Console.CursorLeft; 105 int left = System.Console.CursorLeft;
106 106
107 if (left < 0) 107 if (left < 0)
@@ -121,7 +121,7 @@ namespace OpenSim.Framework.Console
121 { 121 {
122 top = 0; 122 top = 0;
123 } 123 }
124 else 124 else
125 { 125 {
126 int bh = System.Console.BufferHeight; 126 int bh = System.Console.BufferHeight;
127 127
@@ -133,7 +133,7 @@ namespace OpenSim.Framework.Console
133 System.Console.CursorTop = top; 133 System.Console.CursorTop = top;
134 134
135 return top; 135 return top;
136 } 136 }
137 137
138 /// <summary> 138 /// <summary>
139 /// Set the cursor column. 139 /// Set the cursor column.
@@ -145,12 +145,12 @@ namespace OpenSim.Framework.Console
145 /// </param> 145 /// </param>
146 /// <returns> 146 /// <returns>
147 /// The new cursor column. 147 /// The new cursor column.
148 /// </returns> 148 /// </returns>
149 private int SetCursorLeft(int left) 149 private int SetCursorLeft(int left)
150 { 150 {
151 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try 151 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
152 // to set a cursor column position with a currently invalid row, mono will throw an exception. 152 // to set a cursor column position with a currently invalid row, mono will throw an exception.
153 // Therefore, we need to make sure that the row position is valid first. 153 // Therefore, we need to make sure that the row position is valid first.
154 int top = System.Console.CursorTop; 154 int top = System.Console.CursorTop;
155 155
156 if (top < 0) 156 if (top < 0)
@@ -214,7 +214,7 @@ namespace OpenSim.Framework.Console
214 System.Console.Write("{0}", prompt); 214 System.Console.Write("{0}", prompt);
215 215
216 SetCursorTop(new_y); 216 SetCursorTop(new_y);
217 SetCursorLeft(new_x); 217 SetCursorLeft(new_x);
218 } 218 }
219 } 219 }
220 220
@@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
461 SetCursorLeft(0); 461 SetCursorLeft(0);
462 y = SetCursorTop(y); 462 y = SetCursorTop(y);
463 463
464 System.Console.WriteLine("{0}{1}", prompt, cmdline); 464 System.Console.WriteLine();
465 //Show();
465 466
466 lock (cmdline) 467 lock (cmdline)
467 { 468 {
@@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
486 } 487 }
487 } 488 }
488 489
489 AddToHistory(cmdline.ToString()); 490 //AddToHistory(cmdline.ToString());
490 return cmdline.ToString(); 491 return cmdline.ToString();
491 default: 492 default:
492 break; 493 break;
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs
index 9eb1977..a29b370 100644
--- a/OpenSim/Framework/Console/MockConsole.cs
+++ b/OpenSim/Framework/Console/MockConsole.cs
@@ -1,4 +1,31 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.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 OpenSimulator 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
28using System;
2using System.Threading; 29using System.Threading;
3using System.Collections.Generic; 30using System.Collections.Generic;
4using System.Text; 31using System.Text;