5 CW Console Flow
Craig Oates edited this page 4 years ago

To help you get up to speed with how CW-Console works, please conside the image below.

cw-console data flow

The way it works is as follows:

  1. The console recieves a command from the end-user;
  2. Console.Waterworks (C.W.) parses the command and matches it with the corresponding command-method (in "ConsoleCommands.cs"). After that;
  3. The command-method runs and returns the result it has computered.

That's the "happy path" version at least. If the end-user enters an invalid command, C.W. will return an error message.

cw-console bad input data flow cw-console bad input run-time example

For C.W. to operate as designed, it needs to rely on certain things, which are;

  1. C.W. controls the "input-loop" from Main, in "Program.cs".
  2. The ConsoleCommands class must live in a name-space within the (console) project.
  3. The command-methods within ConsoleCommands are marked as public and static.

If you are new to the project, I recommend you take a moment to look at the code in "Program.cs" and "ConsoleCommand.cs". Once you have a good grasp of what it happening in "Program.cs", you should not need to look at it again. That is when you can start to focus on the code in "ConsoleCommands.cs" -- the place where most of the work is. The links for these files are as follows: