Put output for "show connections" command into standard table format.

Also moves into own method.
0.7.4.1
Justin Clark-Casey (justincc) 2012-07-12 21:36:33 +01:00
parent 916e3bf886
commit ca412032e8
1 changed files with 16 additions and 19 deletions

View File

@ -996,25 +996,7 @@ namespace OpenSim
break;
case "connections":
System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n");
m_sceneManager.ForEachScene(
delegate(Scene scene) {
scene.ForEachClient(
delegate(IClientAPI client) {
connections.AppendFormat(
"{0}: {1} ({2}) from {3} on circuit {4}\n",
scene.RegionInfo.RegionName,
client.Name,
client.AgentId,
client.RemoteEndPoint,
client.CircuitCode
);
}
);
}
);
MainConsole.Instance.Output(connections.ToString());
HandleShowConnections();
break;
case "circuits":
@ -1138,6 +1120,21 @@ namespace OpenSim
}
}
private void HandleShowConnections()
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Region", 20);
cdt.AddColumn("Avatar name", 25);
cdt.AddColumn("Remote endpoint", 23);
cdt.AddColumn("Circuit number", 14);
m_sceneManager.ForEachScene(
s => s.ForEachClient(
c => cdt.AddRow(s.RegionInfo.RegionName, c.Name, c.RemoteEndPoint.ToString(), c.CircuitCode.ToString())));
MainConsole.Instance.Output(cdt.ToString());
}
/// <summary>
/// Use XML2 format to serialize data to a file
/// </summary>