Exemplo n.º 1
0
        /// <summary>
        /// Writes details about the help command if it only has one parameter.
        /// </summary>
        /// <param name="command">The subject of the help details.</param>
        /// <param name="overview">The function of the command.</param>
        /// <param name="argument">The parameter to the command.</param>
        /// <param name="argumentUsage">The parameter's description and usage.</param>
        public static void WriteHelpDetail(string command, string overview, string argument, string argumentUsage)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add(argument, argumentUsage);
            ConsoleUtil.WriteHelpDetail(command, overview, dictionary);
        }
        /// <summary>
        /// Shows detailed help information for an individual console command.
        /// </summary>
        /// <param name="command">The command to show detail for.</param>
        public static void ShowHelpDetail(string command)
        {
            Dictionary <string, string> arguments;

            switch (command)
            {
            case "restart":
                ConsoleUtil.WriteHelpDetail(command, "Creates a new zoo and corresponding objects.");

                break;

            case "exit":
                ConsoleUtil.WriteHelpDetail(command, "Exits the application.");

                break;

            case "temp":
                ConsoleUtil.WriteHelpDetail(command, "Sets the temperature of the zoo's birthing room.", "temperature", "The temperature to set the birthing room to.");

                break;

            case "show":
                arguments = new Dictionary <string, string>
                {
                    { "objectType", "The type of object to show (ANIMAL, GUEST, or CAGE)." },
                    { "objectName", "The name of the object to show (use an animal name for CAGE)." }
                };

                ConsoleUtil.WriteHelpDetail(command, "Shows details of an object.", arguments);

                break;

            case "add":
                ConsoleUtil.WriteHelpDetail(command, "Adds an object to the zoo.", "objectType", "The type of object to add (ANIMAL or GUEST).");

                break;

            case "remove":
                arguments = new Dictionary <string, string>
                {
                    { "objectType", "The type of object to remove (ANIMAL or GUEST)." },
                    { "objectName", "The name of the object to remove." }
                };

                ConsoleUtil.WriteHelpDetail(command, "Removes an object from the zoo.", arguments);

                break;

            case "save":
                ConsoleUtil.WriteHelpDetail(command, "Saves a zoo to a file.", "fileName", "The name of the file to save.");

                break;

            case "load":
                ConsoleUtil.WriteHelpDetail(command, "Loads a zoo from a file.", "fileName", "The name of the file to load.");

                break;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Shows the help details from the console.
        /// </summary>
        public static void ShowHelp()
        {
            // Displays descirptive information about the following commands to the console.
            Console.WriteLine("OOP 2 Zoo Help Index: ");

            // Shows all of the commands for the console.
            ConsoleUtil.WriteHelpDetail("HELP", "Show help detail.", "[command]",
                                        "The (optional) command for which to show help details. \nKnown Commands: \nRESTART: Creates a new Zoo. \nEXIT: Exits the application. \nTEMP: Sets the temperature of the zoo's birthing room." +
                                        "\nSHOW: Shows the properties of the animal, guest, or cage. \nADD: Adds an animal or guest to the zoo. \nREMOVE: Removes a guest or animal from the zoo.");
        }
Exemplo n.º 4
0
 /// <summary>
 /// Shows help for a single command word.
 /// </summary>
 public static void ShowHelp()
 {
     ConsoleUtil.WriteHelpDetail("Help", "Show help detail", "[command]", "The command for which to show help details.");
     Console.WriteLine("Known Commands: ");
     Console.WriteLine("RESTART: Creates a new zoo.");
     Console.WriteLine("EXIT: Exits the application.");
     Console.WriteLine("TEMP: Sets the temperature of the birthing room.");
     Console.WriteLine("SHOW: Shows details of the object referenced.");
     Console.WriteLine("ADD: Adds an object to the zoo.");
     Console.WriteLine("REMOVE: Removes an animal from the zoo.");
 }
Exemplo n.º 5
0
        /// <summary>
        /// Overloaded method, the second option for the WriteHelpDetail method.
        /// </summary>
        /// <param name="command"> The command being executed.</param>
        /// <param name="overview"> A brief description of what the command accomplishes.</param>
        /// <param name="arguements"> The dictionary being used to show help commands.</param>
        /// <param name="argumentUsage"> Details about using the arguement.</param>
        public static void WriteHelpDetail(string command, string overview, string argument, string argumentUsage)
        {
            // Make a new dictionary.
            Dictionary <string, string> keyValues = new Dictionary <string, string>();

            // Add a key and value to the dictionary.
            keyValues.Add(argument, argumentUsage);

            // Call the original WriteHelpDetail to process the commands.
            ConsoleUtil.WriteHelpDetail(command, overview, keyValues);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Shows help for commands with no parameters.
 /// </summary>
 public static void ShowHelp()
 {
     ConsoleUtil.WriteHelpDetail("help", "Show help detail", "[command]", "The (optional) command for which to show help details.");
     Console.WriteLine("Known commands:");
     Console.WriteLine("HELP: Shows a list of known commands.");
     Console.WriteLine("EXIT: Exits the application.");
     Console.WriteLine("RESTART: Creates a new zoo.");
     Console.WriteLine("TEMPERATURE: Sets the birthing room temperature.");
     Console.WriteLine("SHOW ANIMAL [animal name]: Displays information for specified animal.");
     Console.WriteLine("SHOW GUEST [guest name]: Displays information for specified guest.");
     Console.WriteLine("ADD: Adds an animal or guest to the zoo.");
     Console.WriteLine("REMOVE: Removes an animal or guest from the zoo.");
 }
        /// <summary>
        /// Shows a help index of console commands.
        /// </summary>
        public static void ShowHelp()
        {
            Console.WriteLine("OOP 2 Zoo Help Index:");

            ConsoleUtil.WriteHelpDetail("help", "Show help detail.", "[command]", "The (optional) command for which to show help details.");

            Console.WriteLine("Known commands:");
            Console.WriteLine("RESTART:  Creates a new zoo.");
            Console.WriteLine("EXIT:     Exits the application.");
            Console.WriteLine("TEMP:     Sets the temperature of the zoo's birthing room.");
            Console.WriteLine("SHOW:     Shows the properties of an animal, guest, or cage.");
            Console.WriteLine("ADD:      Adds an animal or guest to the zoo.");
            Console.WriteLine("REMOVE:   Removes a guest or animal from the zoo.");
            Console.WriteLine("SAVE:     Saves a zoo to a file.");
            Console.WriteLine("LOAD:     Loads a zoo from a file.");
            Console.WriteLine();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Shows the help details.
        /// </summary>
        /// <param name="command">The command passed in.</param>
        public static void ShowHelpDetail(string command)
        {
            Dictionary <string, string> arguments = new Dictionary <string, string>();
            string overview = null;

            switch (command)
            {
            case "show":
                arguments = new Dictionary <string, string>();
                overview  = "Shows details of the object referenced.";

                arguments.Add("objectType", "The type of the object to show (ANIMAL, GUEST, or CAGE).");
                arguments.Add("objectName", "The name of the object to show (use an animal name for CAGE).");
                ConsoleUtil.WriteHelpDetail(command, overview, arguments);
                break;

            case "remove":
                arguments = new Dictionary <string, string>();
                overview  = "Removes an animal from the zoo.";

                arguments.Add("objectType", "The type of the object to remove (ANIMAL or GUEST).");
                arguments.Add("objectName", "The name of the object to remove.");
                ConsoleUtil.WriteHelpDetail(command, overview, arguments);
                break;

            case "temp":
                ConsoleUtil.WriteHelpDetail(command, "Sets the temperature of the birthing room.", "int", "Temperature in Fahrenheit.");
                break;

            case "add":
                ConsoleUtil.WriteHelpDetail(command, "Adds an object to the zoo.", "objectType", "The type of the object to add (ANIMAL or GUEST).");
                break;

            case "restart":
                ConsoleUtil.WriteHelpDetail(command, "Creates a new zoo.");
                break;

            case "exit":
                ConsoleUtil.WriteHelpDetail(command, "Exits the application.");
                break;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Shows details about help command.
        /// </summary>
        /// <param name="command">The command entered.</param>
        public static void ShowHelpDetail(string command)
        {
            Dictionary <string, string> arguments;

            switch (command)
            {
            case "show":
                arguments = new Dictionary <string, string>();
                arguments.Add("objectType", "The type of object to show (ANIMAL, GUEST, or CAGE).");
                arguments.Add("objectName", "The name of the object to show (use an animal name for CAGE).");
                ConsoleUtil.WriteHelpDetail(command, "Shows details of an object.", arguments);
                break;

            case "remove":
                arguments = new Dictionary <string, string>();
                arguments.Add("objectType", "The type of object to remove (ANIMAL, or GUEST).");
                arguments.Add("objectName", "The name of the object to remove.");
                ConsoleUtil.WriteHelpDetail(command, "Removes an object from the zoo.", arguments);
                break;

            case "temp":
                ConsoleUtil.WriteHelpDetail(command, "Changes the temperature in the zoo's birthing room.", "temperature",
                                            "The temperature you wish to change the birthing room to, in fahrenheit.");
                break;

            case "add":
                ConsoleUtil.WriteHelpDetail(command, "Adds either a guest or an animal to the zoo.", "objectType",
                                            "The type of object to add (ANIMAL or GUEST).");
                break;

            case "restart":
                ConsoleUtil.WriteHelpDetail(command, "Creates a new como zoo and erases the old one.");
                break;

            case "exit":
                ConsoleUtil.WriteHelpDetail(command, "Exits the application.");
                break;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Shows the help details from the console.
        /// </summary>
        /// <param name="command"></param>
        public static void ShowHelpDetail(string command)
        {
            // Create a dictonary variable where the key and value are both strings.
            Dictionary <string, string> arguments = null;

            switch (command)
            {
            // If the command is add.
            case ("add"):

                // Used to help write out to the console about what the command is doing.
                ConsoleUtil.WriteHelpDetail(command, "The command used for adding objects into the zoo.", "objectType:", "The type of object to add (ANIMAL or GUEST)");

                break;

            // If the command is exit.
            case ("exit"):

                // Used to help write out to the console about what the command is doing.
                ConsoleUtil.WriteHelpDetail(command, "The command used to exit the application.");

                break;

            // If the command is remove.
            case ("remove"):

                // Instantiate arguements to a new dictionary.
                arguments = new Dictionary <string, string>();

                // Adds two key-values to the dictonary.
                arguments.Add("objectType:", "The type of object to remove (ANIMAL or GUEST)");
                arguments.Add("objectName:", "The name of the object to remove");

                // Used to help write out to the console about what the command is doing.
                ConsoleUtil.WriteHelpDetail(command, "The command used to remove objects from the zoo.", arguments);

                break;

            // If the command is restart.
            case ("restart"):

                // Used to help write out to the console about what the command is doing.
                ConsoleUtil.WriteHelpDetail(command, "Creates a new zoo and corresponding objects.");

                break;

            // If the command is show.
            case ("show"):

                // Instantiate arguements to a new dictionary.
                arguments = new Dictionary <string, string> ();

                // Adds two key-values to the dictonary.
                arguments.Add("objectType:", "The type of object to show (ANIMAL, GUEST, or CAGE)");
                arguments.Add("objectName:", "The name of the object to show (use an animal name for CAGE)");

                // Used to help write out to the console about what the command is doing.
                ConsoleUtil.WriteHelpDetail(command, "Shows the details of an object.", arguments);

                break;

            // If the command is temp.
            case ("temp"):

                // Used to help write out to the console about what the command is doing.
                ConsoleUtil.WriteHelpDetail(command, "The command used to change the temperature in the zoo.", "objectType", "The temperature in the zoo.");

                break;
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Overloaded method, the third option for the WriteHelpDetail method.
 /// </summary>
 /// <param name="command"> The command being executed.</param>
 /// <param name="overview"> A brief description of what the command accomplishes.</param>
 public static void WriteHelpDetail(string command, string overview)
 {
     // Call the orginial WriteHelpMethod and tell that the command has no arguments.
     ConsoleUtil.WriteHelpDetail(command, overview, null);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Writes help detail for a console command which takes no arguments.
 /// </summary>
 /// <param name="command">The command to write help detail for.</param>
 /// <param name="overview">An overview of the command.</param>
 public static void WriteHelpDetail(string command, string overview)
 {
     ConsoleUtil.WriteHelpDetail(command, overview, null);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Writes help detail for a console command which takes a single argument.
 /// </summary>
 /// <param name="command">The command to write help detail for.</param>
 /// <param name="overview">An overview of the command.</param>
 /// <param name="argument">The command's argument.</param>
 /// <param name="argumentUsage">A dictionary of each of the arguments and their usage descriptions.</param>
 public static void WriteHelpDetail(string command, string overview, string argument, string argumentUsage)
 {
     ConsoleUtil.WriteHelpDetail(command, overview, new Dictionary <string, string> {
         { argument, argumentUsage }
     });
 }