예제 #1
0
        private static string DescribeDestinations(LinkedListStack <Node> destinations)
        {
            if (destinations == null || destinations.Count == 0)
            {
                return("nowhere");
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("to ");
            sb.Append(destinations.Count);
            sb.Append(" nodes:");
            Node[] nodes = destinations.PeekAll();

            foreach (Node node in nodes)
            {
                sb.Append(Environment.NewLine);
                sb.Append("     *");
                sb.Append(node.NodeGroup.GroupName);
                sb.Append(" ");
                sb.Append(node.Host);
                sb.Append(":");
                sb.Append(node.Port);
            }
            return(sb.ToString());
        }