aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console/ConsoleUtil.cs
diff options
context:
space:
mode:
authorMelanie Thielker2014-06-21 00:39:55 +0200
committerMelanie Thielker2014-06-21 00:39:55 +0200
commit159fcbf150b7da0e229b29aa7b94793484543d12 (patch)
treeb8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Framework/Console/ConsoleUtil.cs
parentMerge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.zip
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2
opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Framework/Console/ConsoleUtil.cs')
-rw-r--r--OpenSim/Framework/Console/ConsoleUtil.cs47
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Framework/Console/ConsoleUtil.cs b/OpenSim/Framework/Console/ConsoleUtil.cs
index 97a86a8..794bfaf 100644
--- a/OpenSim/Framework/Console/ConsoleUtil.cs
+++ b/OpenSim/Framework/Console/ConsoleUtil.cs
@@ -156,12 +156,32 @@ namespace OpenSim.Framework.Console
156 } 156 }
157 157
158 /// <summary> 158 /// <summary>
159 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 159 /// Convert a console integer to an int, automatically complaining if a console is given.
160 /// </summary> 160 /// </summary>
161 /// <param name='console'>Can be null if no console is available.</param> 161 /// <param name='console'>Can be null if no console is available.</param>
162 /// <param name='rawConsoleVector'>/param> 162 /// <param name='rawConsoleVector'>/param>
163 /// <param name='vector'></param> 163 /// <param name='vector'></param>
164 /// <returns></returns> 164 /// <returns></returns>
165 public static bool TryParseConsoleBool(ICommandConsole console, string rawConsoleString, out bool b)
166 {
167 if (!bool.TryParse(rawConsoleString, out b))
168 {
169 if (console != null)
170 console.OutputFormat("ERROR: {0} is not a true or false value", rawConsoleString);
171
172 return false;
173 }
174
175 return true;
176 }
177
178 /// <summary>
179 /// Convert a console integer to an int, automatically complaining if a console is given.
180 /// </summary>
181 /// <param name='console'>Can be null if no console is available.</param>
182 /// <param name='rawConsoleInt'>/param>
183 /// <param name='i'></param>
184 /// <returns></returns>
165 public static bool TryParseConsoleInt(ICommandConsole console, string rawConsoleInt, out int i) 185 public static bool TryParseConsoleInt(ICommandConsole console, string rawConsoleInt, out int i)
166 { 186 {
167 if (!int.TryParse(rawConsoleInt, out i)) 187 if (!int.TryParse(rawConsoleInt, out i))
@@ -174,6 +194,31 @@ namespace OpenSim.Framework.Console
174 194
175 return true; 195 return true;
176 } 196 }
197
198 /// <summary>
199 /// Convert a console integer to a natural int, automatically complaining if a console is given.
200 /// </summary>
201 /// <param name='console'>Can be null if no console is available.</param>
202 /// <param name='rawConsoleInt'>/param>
203 /// <param name='i'></param>
204 /// <returns></returns>
205 public static bool TryParseConsoleNaturalInt(ICommandConsole console, string rawConsoleInt, out int i)
206 {
207 if (TryParseConsoleInt(console, rawConsoleInt, out i))
208 {
209 if (i < 0)
210 {
211 if (console != null)
212 console.OutputFormat("ERROR: {0} is not a positive integer", rawConsoleInt);
213
214 return false;
215 }
216
217 return true;
218 }
219
220 return false;
221 }
177 222
178 /// <summary> 223 /// <summary>
179 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3 224 /// Convert a minimum vector input from the console to an OpenMetaverse.Vector3