Esempio n. 1
0
        }                       //Constructor

        //Instance -: returns PokeCalc instance and instantiates if it wasn't called previously.
        public static PokeCalc Instance()
        {
            if (PokeCalcInstance == null)
            {
                PokeCalcInstance = new PokeCalc();
            }
            return(PokeCalcInstance);
        }//End Instance()
Esempio n. 2
0
        static void Main(string[] args)
        {
            Help();

            PokeCalc pokecalc = PokeCalc.Instance();

            //Create an REPL flow on control
            bool repl = true;

            while (repl)
            {
                //Collect user input
                string command = Console.ReadLine();

                //Normalize input
                command = command.Trim('\n');
                command = command.ToLower();

                //What we're gonna do
                switch (command)
                {
                case "quit":
                { repl = false;  break; }

                case "help":
                { Help(); break; }

                default:
                {
                    if (String.IsNullOrWhiteSpace(command))
                    {
                        break;
                    }
                    pokecalc.Calculate(command); break;
                }
                } //end switch
            }     //End while
        }         //End Main()