Make show bots pCampbot console command print connected, connecting, etc. bot totals at end.
parent
377fe63c60
commit
c49ea491a3
|
@ -330,17 +330,30 @@ namespace pCampBot
|
||||||
string outputFormat = "{0,-30} {1, -30} {2,-14}";
|
string outputFormat = "{0,-30} {1, -30} {2,-14}";
|
||||||
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status");
|
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Region", "Status");
|
||||||
|
|
||||||
|
Dictionary<ConnectionState, int> totals = new Dictionary<ConnectionState, int>();
|
||||||
|
foreach (object o in Enum.GetValues(typeof(ConnectionState)))
|
||||||
|
totals[(ConnectionState)o] = 0;
|
||||||
|
|
||||||
lock (m_lBot)
|
lock (m_lBot)
|
||||||
{
|
{
|
||||||
foreach (Bot pb in m_lBot)
|
foreach (Bot pb in m_lBot)
|
||||||
{
|
{
|
||||||
Simulator currentSim = pb.Client.Network.CurrentSim;
|
Simulator currentSim = pb.Client.Network.CurrentSim;
|
||||||
|
totals[pb.ConnectionState]++;
|
||||||
|
|
||||||
MainConsole.Instance.OutputFormat(
|
MainConsole.Instance.OutputFormat(
|
||||||
outputFormat,
|
outputFormat,
|
||||||
pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState);
|
pb.Name, currentSim != null ? currentSim.Name : "(none)", pb.ConnectionState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConsoleDisplayList cdl = new ConsoleDisplayList();
|
||||||
|
|
||||||
|
foreach (KeyValuePair<ConnectionState, int> kvp in totals)
|
||||||
|
cdl.AddRow(kvp.Key, kvp.Value);
|
||||||
|
|
||||||
|
|
||||||
|
MainConsole.Instance.OutputFormat("\n{0}", cdl.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue