aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console
diff options
context:
space:
mode:
authorlbsa712007-07-01 16:07:41 +0000
committerlbsa712007-07-01 16:07:41 +0000
commit06a8c132005b4ab804f25d54c0c0f899fc98e3a1 (patch)
tree2210d9426050c11035453631735fb1f324a070a7 /OpenSim/Framework/Console
parentFixed SimpleApp - aka thankgoditssundaycommit (diff)
downloadopensim-SC_OLD-06a8c132005b4ab804f25d54c0c0f899fc98e3a1.zip
opensim-SC_OLD-06a8c132005b4ab804f25d54c0c0f899fc98e3a1.tar.gz
opensim-SC_OLD-06a8c132005b4ab804f25d54c0c0f899fc98e3a1.tar.bz2
opensim-SC_OLD-06a8c132005b4ab804f25d54c0c0f899fc98e3a1.tar.xz
MAJOR IP RESTRUCTURING
* moving towards IPEndPoints all over the place * trying to make the internal/external division
Diffstat (limited to 'OpenSim/Framework/Console')
-rw-r--r--OpenSim/Framework/Console/LogBase.cs58
1 files changed, 51 insertions, 7 deletions
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs
index 1a92d8e..a4a17e9 100644
--- a/OpenSim/Framework/Console/LogBase.cs
+++ b/OpenSim/Framework/Console/LogBase.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Net;
30 31
31namespace OpenSim.Framework.Console 32namespace OpenSim.Framework.Console
32{ 33{
@@ -48,18 +49,18 @@ namespace OpenSim.Framework.Console
48 public string componentname; 49 public string componentname;
49 private bool m_silent; 50 private bool m_silent;
50 51
51 public LogBase(string LogFile, string componentname, conscmd_callback cmdparser, bool silent ) 52 public LogBase(string LogFile, string componentname, conscmd_callback cmdparser, bool silent)
52 { 53 {
53 this.componentname = componentname; 54 this.componentname = componentname;
54 this.cmdparser = cmdparser; 55 this.cmdparser = cmdparser;
55 this.m_silent = silent; 56 this.m_silent = silent;
56 System.Console.WriteLine("ServerConsole.cs - creating new local console"); 57 System.Console.WriteLine("ServerConsole.cs - creating new local console");
57 58
58 if( String.IsNullOrEmpty( LogFile ) ) 59 if (String.IsNullOrEmpty(LogFile))
59 { 60 {
60 LogFile = componentname + ".log"; 61 LogFile = componentname + ".log";
61 } 62 }
62 63
63 System.Console.WriteLine("Logs will be saved to current directory in " + LogFile); 64 System.Console.WriteLine("Logs will be saved to current directory in " + LogFile);
64 Log = File.AppendText(LogFile); 65 Log = File.AppendText(LogFile);
65 Log.WriteLine("========================================================================"); 66 Log.WriteLine("========================================================================");
@@ -74,10 +75,10 @@ namespace OpenSim.Framework.Console
74 75
75 public void Write(string format, params object[] args) 76 public void Write(string format, params object[] args)
76 { 77 {
77 Notice(format,args); 78 Notice(format, args);
78 return; 79 return;
79 } 80 }
80 81
81 public void WriteLine(LogPriority importance, string format, params object[] args) 82 public void WriteLine(LogPriority importance, string format, params object[] args)
82 { 83 {
83 Log.WriteLine(format, args); 84 Log.WriteLine(format, args);
@@ -154,6 +155,49 @@ namespace OpenSim.Framework.Console
154 return TempInt; 155 return TempInt;
155 } 156 }
156 157
158 public IPAddress CmdPromptIPAddress(string prompt, string defaultvalue)
159 {
160 IPAddress address;
161 string addressStr;
162
163 while (true)
164 {
165 addressStr = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt(prompt, defaultvalue);
166 if (IPAddress.TryParse(addressStr, out address))
167 {
168 break;
169 }
170 else
171 {
172 OpenSim.Framework.Console.MainLog.Instance.Error("Illegal address. Please re-enter.");
173 }
174 }
175
176 return address;
177 }
178
179 public int CmdPromptIPPort(string prompt, string defaultvalue)
180 {
181 int port;
182 string portStr;
183
184 while (true)
185 {
186 portStr = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt(prompt, defaultvalue);
187 if (int.TryParse(portStr, out port))
188 {
189 if (port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort)
190 {
191 break;
192 }
193 }
194
195 OpenSim.Framework.Console.MainLog.Instance.Error("Illegal address. Please re-enter.");
196 }
197
198 return port;
199 }
200
157 // Displays a prompt and waits for the user to enter a string, then returns that string 201 // Displays a prompt and waits for the user to enter a string, then returns that string
158 // Done with no echo and suitable for passwords 202 // Done with no echo and suitable for passwords
159 public string PasswdPrompt(string prompt) 203 public string PasswdPrompt(string prompt)
@@ -178,7 +222,7 @@ namespace OpenSim.Framework.Console
178 // Displays a command prompt and returns a default value if the user simply presses enter 222 // Displays a command prompt and returns a default value if the user simply presses enter
179 public string CmdPrompt(string prompt, string defaultresponse) 223 public string CmdPrompt(string prompt, string defaultresponse)
180 { 224 {
181 string temp = CmdPrompt(String.Format( "{0} [{1}]", prompt, defaultresponse )); 225 string temp = CmdPrompt(String.Format("{0} [{1}]", prompt, defaultresponse));
182 if (temp == "") 226 if (temp == "")
183 { 227 {
184 return defaultresponse; 228 return defaultresponse;