Alter commit 3758306
to allow region name to be substituted within a region console prompt
This is to allow broader subsitution in the future. Currently, the only substitions are \R (for region name) and \\ (for a single backslash) e.g. "Region (\R) " is the current and continuing default prompt This renames custom_prompt in [Startup] to ConsolePromptremove-scene-viewer
parent
b990914ec4
commit
2d4ac6288d
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
@ -56,7 +57,16 @@ namespace OpenSim
|
||||||
protected bool m_gui = false;
|
protected bool m_gui = false;
|
||||||
protected string m_consoleType = "local";
|
protected string m_consoleType = "local";
|
||||||
protected uint m_consolePort = 0;
|
protected uint m_consolePort = 0;
|
||||||
protected string m_custom_prompt;
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt to use for simulator command line.
|
||||||
|
/// </summary>
|
||||||
|
private string m_consolePrompt;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Regex for parsing out special characters in the prompt.
|
||||||
|
/// </summary>
|
||||||
|
private Regex m_consolePromptRegex = new Regex(@"([^\\])\\(\w)", RegexOptions.Compiled);
|
||||||
|
|
||||||
private string m_timedScript = "disabled";
|
private string m_timedScript = "disabled";
|
||||||
private Timer m_scriptTimer;
|
private Timer m_scriptTimer;
|
||||||
|
@ -111,7 +121,7 @@ namespace OpenSim
|
||||||
Util.FireAndForgetMethod = asyncCallMethod;
|
Util.FireAndForgetMethod = asyncCallMethod;
|
||||||
|
|
||||||
stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15);
|
stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15);
|
||||||
m_custom_prompt = startupConfig.GetString("custom_prompt", "Region");
|
m_consolePrompt = startupConfig.GetString("console_prompt", @"Region (\R) ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
|
if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
|
||||||
|
@ -835,7 +845,22 @@ namespace OpenSim
|
||||||
|
|
||||||
string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName);
|
string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName);
|
||||||
MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
|
MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
|
||||||
m_console.DefaultPrompt = String.Format("{0} ({1}) ", m_custom_prompt, regionName);
|
|
||||||
|
// m_log.DebugFormat("Original prompt is {0}", m_consolePrompt);
|
||||||
|
string prompt = m_consolePrompt;
|
||||||
|
|
||||||
|
// Replace "\R" with the region name
|
||||||
|
// Replace "\\" with "\"
|
||||||
|
prompt = m_consolePromptRegex.Replace(prompt, m =>
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("Matched {0}", m.Groups[2].Value);
|
||||||
|
if (m.Groups[2].Value == "R")
|
||||||
|
return m.Groups[1].Value + regionName;
|
||||||
|
else
|
||||||
|
return m.Groups[0].Value;
|
||||||
|
});
|
||||||
|
|
||||||
|
m_console.DefaultPrompt = prompt;
|
||||||
m_console.ConsoleScene = m_sceneManager.CurrentScene;
|
m_console.ConsoleScene = m_sceneManager.CurrentScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,14 @@
|
||||||
|
|
||||||
|
|
||||||
[Startup]
|
[Startup]
|
||||||
|
;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) "
|
||||||
|
;; Console prompt
|
||||||
|
;; Certain special characters can be used to customize the prompt
|
||||||
|
;; Currently, these are
|
||||||
|
;; \R - substitute region name
|
||||||
|
;; \\ - substitute \
|
||||||
|
; ConsolePrompt = "Region (\R) "
|
||||||
|
|
||||||
;# {save_crashes} {} {Save crashes to disk?} {true false} false
|
;# {save_crashes} {} {Save crashes to disk?} {true false} false
|
||||||
;; Set this to true if you want to log crashes to disk
|
;; Set this to true if you want to log crashes to disk
|
||||||
;; this can be useful when submitting bug reports.
|
;; this can be useful when submitting bug reports.
|
||||||
|
@ -230,12 +238,6 @@
|
||||||
;; by scripts have changed.
|
;; by scripts have changed.
|
||||||
; DeleteScriptsOnStartup = true
|
; DeleteScriptsOnStartup = true
|
||||||
|
|
||||||
;; Custom prompt
|
|
||||||
;; This value replaces the word "Region" in console prompt
|
|
||||||
;; (usualy "Region (regionName) # "
|
|
||||||
;; Useful only if you have to monitor serveral servers
|
|
||||||
; custom_prompt = "MyServer1"
|
|
||||||
|
|
||||||
[SMTP]
|
[SMTP]
|
||||||
;; The SMTP server enabled the email module to send email to external
|
;; The SMTP server enabled the email module to send email to external
|
||||||
;; destinations.
|
;; destinations.
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
|
|
||||||
|
|
||||||
[Startup]
|
[Startup]
|
||||||
|
; Console prompt
|
||||||
|
; Certain special characters can be used to customize the prompt
|
||||||
|
; Currently, these are
|
||||||
|
; \R - substitute region name
|
||||||
|
; \\ - substtitue \
|
||||||
|
ConsolePrompt = "Region (\R) "
|
||||||
|
|
||||||
; Set this to true if you want to log crashes to disk
|
; Set this to true if you want to log crashes to disk
|
||||||
; this can be useful when submitting bug reports.
|
; this can be useful when submitting bug reports.
|
||||||
; However, this will only log crashes within OpenSimulator that cause the entire program to exit
|
; However, this will only log crashes within OpenSimulator that cause the entire program to exit
|
||||||
|
|
Loading…
Reference in New Issue