コード例 #1
0
        public int Run()
        {
            var state = int.MinValue;

            while (state != -1)
            {
                ShowMenu();
                state = _keyboardInteraction.ReadNumber();
                switch (state)
                {
                case 1:
                    ServeDecimal();
                    break;

                case 2:
                    ServeBinary();
                    break;

                case -1:
                    break;

                default:
                    Console.WriteLine(state + " is not an option");
                    break;
                }
            }
            return(state);
        }
コード例 #2
0
        public int Run()
        {
            int state = Int32.MinValue;

            while (state != 0 && state != -1)
            {
                ShowMenu();
                state = _keyboardInteraction.ReadNumber();
                switch (state)
                {
                case 1:
                    Console.WriteLine(_actions.ServeIsHostValid());
                    break;

                case 2:
                    Console.WriteLine(_actions.ServeGetAddressType());
                    break;

                case 3:
                    Console.WriteLine(_actions.GetNetworkAddress());
                    break;

                case 4:
                    Console.WriteLine(_actions.GetBroadcastAddress());
                    break;

                case 5:
                    Console.WriteLine(_actions.GetFirstHostAddress());
                    break;

                case 6:
                    Console.WriteLine(_actions.GetLastHostAddress());
                    break;

                case 7:
                    new SubnetMaskOfNetworkActionManager(_keyboardInteraction).Run();
                    break;

                case 8:
                    Console.WriteLine(_actions.GetClassAddress());
                    break;

                case 9:
                    Console.WriteLine(_actions.SubnetNetworkBitCount());
                    break;

                case 10:
                    Console.WriteLine(_actions.GetHostBitCount());
                    break;

                case 11:
                    Console.WriteLine(_actions.GetPossibleSubnetsCount());
                    break;

                case 12:
                    Console.WriteLine(_actions.GetPossibleHostCount());
                    break;

                case 13:
                    Console.WriteLine(_actions.GetFullNetworkData());
                    break;

                case 14:
                    Console.WriteLine(_actions.BinaryFromDecimal());
                    break;

                case 15:
                    Console.WriteLine(_actions.DecimalFromBinary());
                    break;

                case -1:
                case 0:
                    break;

                default:
                    Console.WriteLine(state + " is not in options.");
                    break;
                }
            }
            return(state);
        }