diff --git a/Console.Waterworks/CW_Console/App.config b/Console.Waterworks/CW_Console/App.config
index 731f6de..9d2c7ad 100644
--- a/Console.Waterworks/CW_Console/App.config
+++ b/Console.Waterworks/CW_Console/App.config
@@ -1,6 +1,6 @@
-
+
-
+
-
\ No newline at end of file
+
diff --git a/Console.Waterworks/CW_Console/CW_Console.csproj b/Console.Waterworks/CW_Console/CW_Console.csproj
index 6a83257..25c60e4 100644
--- a/Console.Waterworks/CW_Console/CW_Console.csproj
+++ b/Console.Waterworks/CW_Console/CW_Console.csproj
@@ -8,9 +8,10 @@
Exe
CW_Console
CW_Console
- v4.6.1
+ v4.7
512
true
+
AnyCPU
@@ -42,11 +43,18 @@
+
+
+
+ {d1354760-61f7-4aee-8d6f-e78a463ee3c9}
+ Console.Waterworks
+
+
\ No newline at end of file
diff --git a/Console.Waterworks/CW_Console/ConsoleCommands.cs b/Console.Waterworks/CW_Console/ConsoleCommands.cs
new file mode 100644
index 0000000..240b1b2
--- /dev/null
+++ b/Console.Waterworks/CW_Console/ConsoleCommands.cs
@@ -0,0 +1,36 @@
+using Console.Waterworks;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CW_Console
+{
+ public static class ConsoleCommands
+ {
+ public static string Help()
+ {
+ CW_Liaison liaison = new CW_Liaison();
+ return liaison.RequestHelpDocumentation("CW_Console");
+ }
+
+ public static string Command1() => "Command1 has completed";
+ public static string Command2(string input) => $"Command2 has completed... {input} was entered";
+ public static string Command3(int input) => $"Command3 has completed... The number {input} was entered";
+ public static string Command4(int int1, int int2) => $"Command4 has completed... {int1} and {int2} was entered and make {int1 + int2} when added together";
+ public static string Command5(int int1, double double1) => $"Command5 has completed... {int1} and {double1} was entered and make {int1 + double1} when added together";
+ public static void Quit() => Environment.Exit(-1);
+
+ #region Alias Methods
+ // These methods are shorthand versions of the ones above.
+ // These are useful for experienced users of your console program.
+ public static string c1() => Command1();
+ public static string c2(string input) => Command2(input);
+ public static string c3(int input) => Command3(input);
+ public static string c4(int int1, int int2) => Command4(int1, int2);
+ public static string c5(int int1, double double1) => Command5(int1, double1);
+ public static void quit() => Quit();
+ #endregion
+ }
+}
diff --git a/Console.Waterworks/CW_Console/Program.cs b/Console.Waterworks/CW_Console/Program.cs
index 7834e14..9548340 100644
--- a/Console.Waterworks/CW_Console/Program.cs
+++ b/Console.Waterworks/CW_Console/Program.cs
@@ -1,4 +1,5 @@
-using System;
+using Console.Waterworks;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,6 +11,8 @@ namespace CW_Console
{
static void Main(string[] args)
{
+ CW_Liaison bob = new CW_Liaison();
+ bob.Run("CW_Console", true);
}
}
}
diff --git a/Console.Waterworks/Console.Waterworks.sln b/Console.Waterworks/Console.Waterworks.sln
index 239ba98..dd94c8a 100644
--- a/Console.Waterworks/Console.Waterworks.sln
+++ b/Console.Waterworks/Console.Waterworks.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console.Waterworks", "Console.Waterworks\Console.Waterworks.csproj", "{D1354760-61F7-4AEE-8D6F-E78A463EE3C9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CW_Console", "CW_Console\CW_Console.csproj", "{E26D7001-2A4E-4618-8C27-8BF504993EE9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{D1354760-61F7-4AEE-8D6F-E78A463EE3C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1354760-61F7-4AEE-8D6F-E78A463EE3C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1354760-61F7-4AEE-8D6F-E78A463EE3C9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E26D7001-2A4E-4618-8C27-8BF504993EE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E26D7001-2A4E-4618-8C27-8BF504993EE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E26D7001-2A4E-4618-8C27-8BF504993EE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E26D7001-2A4E-4618-8C27-8BF504993EE9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Console.Waterworks/Console.Waterworks/Assistants/CoOrdinatorAssistant.cs b/Console.Waterworks/Console.Waterworks/Assistants/CoOrdinatorAssistant.cs
index 17a553f..398e6a1 100644
--- a/Console.Waterworks/Console.Waterworks/Assistants/CoOrdinatorAssistant.cs
+++ b/Console.Waterworks/Console.Waterworks/Assistants/CoOrdinatorAssistant.cs
@@ -1,12 +1,52 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Console.Waterworks.Loggers;
+using Console.Waterworks.Specialists;
+using System.Reflection;
+using Console.Waterworks.Constants;
namespace Console.Waterworks.Assistants
{
class CoOrdinatorAssistant
{
+ internal void SetConsoleTitle(CW_Logger logger, ProgramInfoSpecialist progInfoSpec, ConsoleIOSpecialist consoleSpec)
+ {
+ logger.LogInfoMessage("Attempting to set console title..");
+ var title = progInfoSpec.GetProductName();
+ if (!string.IsNullOrEmpty(title))
+ {
+ consoleSpec.SetConsoleTitle(title);
+ logger.LogSuccessMessage("Console title is now set");
+ }
+ else
+ logger.LogErrorMessage("Unable to determine the program's title. Check the manifest file to make sure it has been set");
+ }
+
+ internal void OutputProgramInfo(CW_Logger logger, ProgramInfoSpecialist progInfoSpec, ConsoleIOSpecialist consoleSpec)
+ {
+ logger.LogInfoMessage("Attempting to retrieve program information..");
+ List programInfo = progInfoSpec.GatherProgramInfomation();
+ logger.LogInfoMessage($"Found {programInfo.Count} out of {CW_Constants.PROGRAM_INFO_PROPERTIES_COUNT} properties");
+ logger.LogInfoMessage($"Writing program properties to console..");
+ consoleSpec.WriteProgramInfo(programInfo);
+ }
+
+
+ internal void LogCommandGatheringAttempt(List commandClasses, Dictionary>> commandLibraries, CW_Logger logger)
+ {
+ logger.LogInfoMessage($"Found {commandClasses.Count} command class(es)..");
+ logger.LogInfoMessage($"Found {GetFoundCommandsTotal(commandLibraries)} command(s)..");
+ logger.LogInfoMessage($"Found [{CW_Constants.COMMAND_CLASS_NAME}] class: { commandLibraries.ContainsKey(CW_Constants.COMMAND_CLASS_NAME)}");
+ logger.LogNoteMessage($"WaterWorks is only looking for the methods in the [{CW_Constants.COMMAND_CLASS_NAME}] class in the specified namespace. Everything else will be ignored");
+ logger.LogInfoMessage("Program is now initialised and awaiting input from the user. You are welcome ;-)");
+ }
+
+ internal int GetFoundCommandsTotal(Dictionary>> commandLibraries)
+ {
+ int total = 0;
+ foreach (var currentClass in commandLibraries.Values)
+ total += currentClass.Count;
+ return total;
+ }
}
}
diff --git a/Console.Waterworks/Console.Waterworks/Assistants/CommandsAssistant.cs b/Console.Waterworks/Console.Waterworks/Assistants/CommandsAssistant.cs
index a8b3c41..cfa76cf 100644
--- a/Console.Waterworks/Console.Waterworks/Assistants/CommandsAssistant.cs
+++ b/Console.Waterworks/Console.Waterworks/Assistants/CommandsAssistant.cs
@@ -1,12 +1,105 @@
-using System;
+using Console.Waterworks.Models;
+using Console.Waterworks.Specialists;
+using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Reflection;
namespace Console.Waterworks.Assistants
{
class CommandsAssistant
{
+ internal bool ValidateClass(Command command, Dictionary>> commandLibraries)
+ => (commandLibraries.ContainsKey(command.ClassName)) ? true : false;
+
+ internal bool ValidateCommand(Command command, Dictionary>> commandLibraries)
+ {
+ var methodDict = commandLibraries[command.ClassName];
+ return (methodDict.ContainsKey(command.Name)) ? true : false;
+ }
+
+ internal string ExecuteBadCommandProcedure(Command command, ConsoleIOSpecialist consoleSpec)
+ {
+ consoleSpec.WriteErrorSuffix();
+ return $"The command \'{command.Name}\' is not recognised.";
+ }
+
+ internal bool ValidateParamArguments(Command command, List paramInfoList)
+ {
+ var requiredParams = paramInfoList.Where(p => p.IsOptional == false);
+ var optionalParams = paramInfoList.Where(p => p.IsOptional == true);
+ int requiredCount = requiredParams.Count();
+ int optionalCount = optionalParams.Count();
+ int providedCount = command.Arguments.Count();
+ return (requiredCount > providedCount) ? false : true;
+ }
+
+ internal string ExecuteMissingArgumentProcedure(Command command, List paramInfoList, ConsoleIOSpecialist consoleSpec)
+ {
+ var requiredParams = paramInfoList.Where(p => p.IsOptional == false);
+ var optionalParams = paramInfoList.Where(p => p.IsOptional == true);
+ int requiredCount = requiredParams.Count();
+ int optionalCount = optionalParams.Count();
+ int providedCount = command.Arguments.Count();
+ return $"Missing required argument. {requiredCount} required, {optionalCount} optional, {providedCount} provided.";
+ }
+
+ internal List