Ejemplo n.º 1
0
        public static void Loop()
        {
            Maker crafter = new Maker()
            {
                Recipes = recipes
            };


            String ss = "";

            do
            {
                ss = Console.ReadLine();



                int c = 0;
                if (String.IsNullOrWhiteSpace(ss))
                {
                }
                else if (items.Keys.Where((s) => s.ToUpper() == ss.ToUpper()).FirstOrDefault() != null)
                {
                    var x = items[items.Keys.Where((s) => s.ToUpper() == ss.ToUpper()).First()];
                    crafter.Craft(x, 1);
                }
                else if (int.TryParse(ss.Substring(0, 2), out c))
                {
                    crafter.Craft(items[ss.Substring(2)], c);
                }
                else if (ss == "list")
                {
                    foreach (var r in recipes)
                    {
                        r.Print();
                    }
                }
            } while (ss != "exit");
        }