5 Creating the Input Loop
Craig Oates edited this page 4 years ago

Because of how Console.Waterworks (C.W.) is set-up, the command the end-user enters into the prompt, at run-time, much match the name of the command-method -- in "ConsoleCommands.cs". Before we get too far into discussing that, though, we must look at how the program creates the input-loop.

using Console.Waterworks; // Needed to created the input-loop below.
using System;

namespace WetPancakeCLI
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // This is where the input-loop is created.
            var liaison = new CW_Liaison();
            liaison.Run("WetPancakeCLI", true);
        }
    }
}

That snippet of code is all what is in "Program.cs". Once you know what is happening in here, you should never need to look at this file much -- if at all.

What is happening is a new CW_Liaison object is created and is told to run. This is where C.W. creates the input-loop which runs indefinitely until the end-user closes the console (or the program crashes). The first argument passed into run refers to the name-space of the ConsoleCommands class. In this case it is WetPancakeCLI. The second one refers to the information displayed in the console when you run it. When set to true, the console displays information found in "AssemblyInfo.cs". If you use false, the only thing you will see is the prompt. You can check the name-space of the ConsoleCommand class via the following link:

wetpancakecli with assembly info

wetpancakecli with no assembly info

How C.W. creates and manages the input-loop is out of this wiki's scope. Although, if you would like to know more about how is is created, you can use the following link: