示例#1
0
        private static string GetRecipeName(string tool, RecipeType type, string[] items)
        {
            var recipeName = tool + "(";

            if (type == RecipeType.NonOrdered)
            {
                Array.Sort(items);
            }

            foreach (var item in items)
            {
                recipeName += item + ",";
            }

            recipeName += ")";
            recipeName += type.ToString();

            return("island.recipe:" + recipeName);
        }
示例#2
0
        private void DoListRecipes()
        {
            Console.Clear();
            Console.WriteLine("RECIPES!");

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();
                command.CommandText = @"
                    SELECT RecipeTypeId
                         , Name
                      FROM Recipes
                  ORDER BY RecipeTypeId
                         , Name
                ";

                int           currentRecipeTypeId = -323;
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    int    recipeTypeId = reader.GetInt32(0);
                    string title        = reader.GetString(1);

                    if (recipeTypeId != currentRecipeTypeId)
                    {
                        currentRecipeTypeId = recipeTypeId;
                        RecipeType pretty = (RecipeType)currentRecipeTypeId;
                        Console.WriteLine(pretty.ToString().ToUpper());
                    }

                    Console.WriteLine($"  {title}");
                }
            }

            Console.ReadLine();
        }
示例#3
0
        public static string GetName(this RecipeType?prop)
        {
            var description = EnumHelper.GetAttributeOfType <DisplayAttribute>(prop);

            return(description?.Name ?? prop?.ToString() ?? "");
        }