示例#1
0
        public void Run()
        {
            IReader        reader  = new Reader();
            WeaponsManager manager = new WeaponsManager();

            while (true)
            {
                string input = reader.ReadLine();
                if (input == "END")
                {
                    break;
                }
                else
                {
                    DoCommands(manager, input);
                }
            }
            manager.PrintAll();
        }
示例#2
0
        private static void DoCommands(WeaponsManager manager, string input)
        {
            string[] parts = input.Split(';');
            switch (parts[0])
            {
            case "Create":
                manager.Create(parts[1], parts[2]);
                break;

            case "Add":
                manager.AddGem(parts[1], int.Parse(parts[2]), parts[3]);
                break;

            case "Remove":
                manager.RemoveGem(parts[1], int.Parse(parts[2]));
                break;

            case "Print":
                manager.Print(parts[1]);
                break;
            }
        }