Console.Waterworks.Core is the .Net Core version of Console.Waterworks.
https://www.craigoates.net/Software/project/8
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.
52 lines
2.6 KiB
52 lines
2.6 KiB
using Console.Waterworks.Core.Constants; |
|
using Console.Waterworks.Core.Loggers; |
|
using Console.Waterworks.Core.Specialists; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Reflection; |
|
|
|
namespace Console.Waterworks.Core.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<string> 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<Type> commandClasses, Dictionary<string, Dictionary<string, IEnumerable<ParameterInfo>>> 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<string, Dictionary<string, IEnumerable<ParameterInfo>>> commandLibraries) |
|
{ |
|
int total = 0; |
|
foreach (var currentClass in commandLibraries.Values) |
|
total += currentClass.Count; |
|
return total; |
|
} |
|
} |
|
}
|
|
|