Add "show regions" console command to ROBUST to show all regions currently registered.

Command is not added in standalone, which has its own version of "show regions" that can also show estate name
0.7.4.1
Justin Clark-Casey (justincc) 2012-06-26 00:34:37 +01:00
parent 854f2a913c
commit 5292b8b8be
1 changed files with 44 additions and 0 deletions

View File

@ -91,6 +91,18 @@ namespace OpenSim.Services.GridService
String.Empty,
HandleDeregisterRegion);
// A messy way of stopping this command being added if we are in standalone (since the simulator
// has an identically named command
//
// XXX: We're relying on the OpenSimulator version being registered first, which is not well defined.
if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0)
MainConsole.Instance.Commands.AddCommand("Regions", true,
"show regions",
"show all regions",
"Show details on all regions",
String.Empty,
HandleShowRegions);
MainConsole.Instance.Commands.AddCommand("Regions", true,
"show region name",
"show region name <Region name>",
@ -547,6 +559,20 @@ namespace OpenSim.Services.GridService
return;
}
private void HandleShowRegions(string module, string[] cmd)
{
if (cmd.Length != 2)
{
MainConsole.Instance.Output("Syntax: show regions");
return;
}
List<RegionData> regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero);
OutputRegionsToConsoleSummary(regions);
}
private void HandleShowRegion(string module, string[] cmd)
{
if (cmd.Length != 4)
@ -619,6 +645,24 @@ namespace OpenSim.Services.GridService
OutputRegionToConsole(r);
}
private void OutputRegionsToConsoleSummary(List<RegionData> regions)
{
ConsoleDisplayTable dispTable = new ConsoleDisplayTable();
dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16));
dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36));
dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36));
dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60));
foreach (RegionData r in regions)
{
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
dispTable.Rows.Add(
new ConsoleDisplayTableRow(new List<string> { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() }));
}
MainConsole.Instance.Output(dispTable.ToString());
}
private int ParseFlags(int prev, string flags)
{
OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev;