Exemple #1
0
        public override int Execute(string[] args)
        {
            // sanity check
            if (args.Length != 1)
            {
                throw new ArgumentException("incorrect number of arguments");
            }

            foreach (NetworkAdapter adapter in NetHelper.Adapters())
            {
                ConsoleHelper.Write(adapter.Name, ConsoleColor.White);
                ConsoleHelper.Write(": ");

                if (adapter.DHCP)
                {
                    ConsoleHelper.Write("dhcp", ConsoleColor.Yellow);
                    ConsoleHelper.Write(": ");
                }

                ConsoleHelper.Write(adapter.IPAddress + " " + adapter.SubnetMask);
                ConsoleHelper.WriteLine();
            }


            return(ConsoleHelper.EXIT_OK);
        }