public TopLevelNodeServer (IPAddress ip, int port) { listener = new TcpListener (ip, port); tksource = new CancellationTokenSource (); self = CipEntry.GenerateFor (new IPEndPoint (ip, port), CipNodeType.TopLevelNode); info = new NodeInformation (self, MAX_CONNECTIONS, MAX_CONCURRENT_CONNECTIONS); NodeConnected += TopLevelNodeServer_NodeConnected; NodeDisconnected += TopLevelNodeServer_NodeDisconnected; UpdateTriggered += delegate { }; }
static void UpdateGraph(NodeInformation info) { var buffer = new StringBuilder (); buffer.Append ("TheSilentNet Server\n\n"); buffer.AppendLine (WriteCat ("Property") + WriteCat ("Primary") + WriteCat ("Secondary")); buffer.AppendLine (string.Empty.PadLeft (20 * 3, '=')); buffer.AppendLine (WriteCat ("Uptime") + WriteCat ("{0:hh':'mm':'ss}", info.Uptime)); buffer.AppendLine (WriteCat ("Node") + WriteCat (info.CipId) + WriteCat (info.CipTypeString)); buffer.AppendLine (WriteCat ("Connections") + WriteCat ("{0} / {1}", info.CurrentlyHeldClients, info.TotalAllowedClients) + WriteCat ("{0} concurrent", info.MaxConcurrentClients)); Console.Clear (); Console.Write (buffer); }