Show number of connections each bot has established in "show bots" command.
parent
85a9cb260a
commit
a90a5f52dd
|
@ -97,6 +97,19 @@ namespace pCampBot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ConnectionState ConnectionState { get; private set; }
|
public ConnectionState ConnectionState { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of connections that this bot has to different simulators.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>Includes both root and child connections.</value>
|
||||||
|
public int ConnectionsCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (Client.Network.Simulators)
|
||||||
|
return Client.Network.Simulators.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string FirstName { get; private set; }
|
public string FirstName { get; private set; }
|
||||||
public string LastName { get; private set; }
|
public string LastName { get; private set; }
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
|
|
|
@ -395,8 +395,11 @@ namespace pCampBot
|
||||||
|
|
||||||
private void HandleShowStatus(string module, string[] cmd)
|
private void HandleShowStatus(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
string outputFormat = "{0,-30} {1, -30} {2,-14}";
|
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
|
||||||
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status");
|
cdt.AddColumn("Name", 30);
|
||||||
|
cdt.AddColumn("Region", 30);
|
||||||
|
cdt.AddColumn("Status", 14);
|
||||||
|
cdt.AddColumn("Connections", 11);
|
||||||
|
|
||||||
Dictionary<ConnectionState, int> totals = new Dictionary<ConnectionState, int>();
|
Dictionary<ConnectionState, int> totals = new Dictionary<ConnectionState, int>();
|
||||||
foreach (object o in Enum.GetValues(typeof(ConnectionState)))
|
foreach (object o in Enum.GetValues(typeof(ConnectionState)))
|
||||||
|
@ -409,19 +412,19 @@ namespace pCampBot
|
||||||
Simulator currentSim = pb.Client.Network.CurrentSim;
|
Simulator currentSim = pb.Client.Network.CurrentSim;
|
||||||
totals[pb.ConnectionState]++;
|
totals[pb.ConnectionState]++;
|
||||||
|
|
||||||
MainConsole.Instance.OutputFormat(
|
cdt.AddRow(
|
||||||
outputFormat,
|
pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState, pb.ConnectionsCount);
|
||||||
pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainConsole.Instance.Output(cdt.ToString());
|
||||||
|
|
||||||
ConsoleDisplayList cdl = new ConsoleDisplayList();
|
ConsoleDisplayList cdl = new ConsoleDisplayList();
|
||||||
|
|
||||||
foreach (KeyValuePair<ConnectionState, int> kvp in totals)
|
foreach (KeyValuePair<ConnectionState, int> kvp in totals)
|
||||||
cdl.AddRow(kvp.Key, kvp.Value);
|
cdl.AddRow(kvp.Key, kvp.Value);
|
||||||
|
|
||||||
|
MainConsole.Instance.Output(cdl.ToString());
|
||||||
MainConsole.Instance.OutputFormat("\n{0}", cdl.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue