A NuGet package. It aim is to help you write extendable and command-based console programs in C# and .Net. https://www.craigoates.net/Software/Project/7
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
5.6 KiB

# ![Logo](Documentation/GitHub_Assets/CW_Header.png "Header")
## About Console.Waterworks
Console.Waterworks is a Nuget package. It aim is to help you write extendable and command-based console programs in C# and .Net.
One of the main struggles with writing software is the need to write "plumbing code". It is the code which does not solve the main problem but it is necessary for us to reach a solution. This is why we all feel frustrated when we need to write it. It feels like we are going the long way round to that dream holiday in the sun. This is why I created Console.Waterworks. I believe we should face frustration when it finds us and only then. Why go looking for it?
Amongst other things, Console.Waterworks has this one very handy trick. It allows you to write methods which become a run-time command -- which is quite the time saver. When you use Console.Waterworks, you, also, do not need to parse end-user input. The reason why is because Console.Waterworks does it for you. This means, when people run your program, they type the method name in and your code begins excuting. On top of that, Console.Waterworks handles bad input and method parameters, as well.
Do not panic if none of what I just said made no sense. I threw a lot of information at you in a short span of time. It is okay and not unexpected. Because of this, I have prepared several images showing Console.Waterworks in action. Please feel free to check it out. It should help explain what Console.Waterwork is and how it works.
### Good Input Data Flow
![Example 1](Documentation/GitHub_Assets/Valid_Input.png "Valid input diagram")
### Bad Input Data Flow
![Example 3](Documentation/GitHub_Assets/Invalid_Input.png "Invalid input diagram")
---
### Code Example - Good Input
![Example 2](Documentation/GitHub_Assets/Method_Mapping.gif "Method mapping example -- valid")
### Code Example - Bad Input
![Example 4](Documentation/GitHub_Assets/Method_Mapping_Invalid.gif "Method mapping example -- invalid")
### Disclaimer
Console.Waterworks is based on the [ConsoleApplicationBase](https://github.com/TypecastException/ConsoleApplicationBase "ConsoleApplicationBase GitHub Repository") repository by [TypecastException](https://github.com/TypecastException "TypecastException's GitHub Profile").
### Pre-Requisites
To use Console.Waterworks, I recommend you meet the following pre-requisites:
- You have experience with [C#](https://docs.microsoft.com/en-us/dotnet/csharp/).
- You can create a [.Net console program](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/hello-world-your-first-program) in [Visual Studio 2017](https://www.visualstudio.com/vs/).
- You have experience with [Nuget](https://www.nuget.org/).
- You have Microsoft [.Net Framework 4.7](https://docs.microsoft.com/en-us/dotnet/framework/install/guide-for-developers) or higher.
### Quick Start - Wiring Console.Waterworks in to your Console Program
Before continuing... I am skipping the part about creating a .Net console program. This is because I assume you know how to do that. I am, also, assuming you are using Visual Studio 2017 and C# (not VB or F#).
1 Add Console.Waterworks to your project via Nuget. You can do this using Visual Studio's (2017) Package Manager GUI. Or, you can use the Package Manager Console. Here is the command for the PM Console,
7 years ago
```powershell
# Enter the version of number of your choice.
7 years ago
Install-Package Console.Waterworks -Version 0.1.0-alpha1
```
2 Create a class called `ConsoleCommands`. It can go anywhere as long as it is in the same project as the console program.
3 Make a note of the `ConsoleCommands` namespace.
4 Head to the `Main` method in `Program.cs` and add the following lines of code,
```c#
public static void Main(string[] args)
{
CW_Liaison liaison = new CW_Liaison();
liaison.Run("CW_Console", true);
}
```
5 Head back to `ConsoleCommands` and make it public and static.
6 Stay in `ConsoleCommands` and write the following method,
```c#
public string Test()
{
return "Congratulations! It works.";
}
```
7 Run the program and type "Test" into the console.
8 If all has gone well, you should see the “Congratulations! It works." message.
9 Add more methods to you console program.
### Guides
7 years ago
There are several guides for Console.Waterworks and in various forms. I am hopeful you will find at least one of them helpful.
#### Offline
I have created a guided for offline usage:
- The Complete Guide to Console.Waterworks
This guide is printer friendly. And, it is best consumed on your favourite reading chair.
#### Online
For those sitting at their computer and connected to the world-wide web, there is a Wiki:
- [GitHub Wiki](https://github.com/CraigOates/Console.Waterworks/wiki)
This guide aims to be a concise as possible. It assumes you are sitting at your desk and wanting the quick answer -- not the full answer.
### Code of Conduct
Please visit the Code of Conduct page for Console.Waterworks at,
- [Code of Conduct page](https://github.com/CraigOates/Console.Waterworks/blob/master/CODE_OF_CONDUCT.md)
- [MIT License](https://github.com/CraigOates/Console.Waterworks/blob/master/LICENSE)
### Contributing to the Console.Waterworks Repository
Please visit the Contributing page for Console.Waterworks at,
- [Contributing page](https://github.com/CraigOates/Console.Waterworks/blob/master/CONTRIBUTING.md)
### About the Creator
Hi, my name is Craig and I'm the creator of Console.Waterworks. Thanks for checking it out.
- Email:craig@craigoates.net
- Web: [http://www.craigoates.net](http://www.craigoates.net)
- Project's Site: [https://craigoates.net/Software/project/7](https://craigoates.net/Software/project/7)