Add much easier ConsoleDisplayTable AddColumn() and AddRow() methods.
Use these for new "show regions" command rather than old cumbersome stuff.0.7.4.1
parent
5292b8b8be
commit
1f22b29ca3
|
@ -79,6 +79,16 @@ namespace OpenSim.Framework.Console
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddColumn(string name, int width)
|
||||||
|
{
|
||||||
|
Columns.Add(new ConsoleDisplayTableColumn(name, width));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddRow(params string[] cells)
|
||||||
|
{
|
||||||
|
Rows.Add(new ConsoleDisplayTableRow(cells));
|
||||||
|
}
|
||||||
|
|
||||||
public void AddToStringBuilder(StringBuilder sb)
|
public void AddToStringBuilder(StringBuilder sb)
|
||||||
{
|
{
|
||||||
string formatString = GetFormatString();
|
string formatString = GetFormatString();
|
||||||
|
@ -135,5 +145,10 @@ namespace OpenSim.Framework.Console
|
||||||
{
|
{
|
||||||
Cells = cells;
|
Cells = cells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConsoleDisplayTableRow(params string[] cells) : this()
|
||||||
|
{
|
||||||
|
Cells = new List<string>(cells);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -648,16 +648,15 @@ namespace OpenSim.Services.GridService
|
||||||
private void OutputRegionsToConsoleSummary(List<RegionData> regions)
|
private void OutputRegionsToConsoleSummary(List<RegionData> regions)
|
||||||
{
|
{
|
||||||
ConsoleDisplayTable dispTable = new ConsoleDisplayTable();
|
ConsoleDisplayTable dispTable = new ConsoleDisplayTable();
|
||||||
dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16));
|
dispTable.AddColumn("Name", 16);
|
||||||
dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36));
|
dispTable.AddColumn("ID", 36);
|
||||||
dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36));
|
dispTable.AddColumn("Owner ID", 36);
|
||||||
dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60));
|
dispTable.AddColumn("Flags", 60);
|
||||||
|
|
||||||
foreach (RegionData r in regions)
|
foreach (RegionData r in regions)
|
||||||
{
|
{
|
||||||
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
||||||
dispTable.Rows.Add(
|
dispTable.AddRow(r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString());
|
||||||
new ConsoleDisplayTableRow(new List<string> { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainConsole.Instance.Output(dispTable.ToString());
|
MainConsole.Instance.Output(dispTable.ToString());
|
||||||
|
|
Loading…
Reference in New Issue