feat: improved console responses in JoinMapBase

This commit is contained in:
Trevor Payne
2023-02-17 22:59:20 -06:00
parent 8a77b134e4
commit e005a30383

View File

@@ -101,22 +101,22 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public void PrintJoinMapInfo() public void PrintJoinMapInfo()
{ {
Debug.Console(0, "{0}:\n", GetType().Name); CrestronConsole.ConsoleCommandResponse("{0}:\n", GetType().Name);
// Get the joins of each type and print them // Get the joins of each type and print them
Debug.Console(0, "Digitals:"); CrestronConsole.ConsoleCommandResponse("Digitals:");
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Digital Joins", digitals.Count); CrestronConsole.ConsoleCommandResponse("Found {0} Digital Joins", digitals.Count);
PrintJoinList(GetSortedJoins(digitals)); PrintJoinList(GetSortedJoins(digitals));
Debug.Console(0, "Analogs:"); CrestronConsole.ConsoleCommandResponse("Analogs:");
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Analog Joins", analogs.Count); CrestronConsole.ConsoleCommandResponse("Found {0} Analog Joins", analogs.Count);
PrintJoinList(GetSortedJoins(analogs)); PrintJoinList(GetSortedJoins(analogs));
Debug.Console(0, "Serials:"); CrestronConsole.ConsoleCommandResponse("Serials:");
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
Debug.Console(2, "Found {0} Serial Joins", serials.Count); CrestronConsole.ConsoleCommandResponse("Found {0} Serial Joins", serials.Count);
PrintJoinList(GetSortedJoins(serials)); PrintJoinList(GetSortedJoins(serials));
} }
@@ -139,7 +139,7 @@ namespace PepperDash.Essentials.Core
{ {
foreach (var join in joins) foreach (var join in joins)
{ {
Debug.Console(0, CrestronConsole.ConsoleCommandResponse(
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'", @"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber, join.Value.JoinNumber,
join.Value.Label, join.Value.Label,
@@ -280,7 +280,7 @@ namespace PepperDash.Essentials.Core
{ {
var pluginType = GetType().Name; var pluginType = GetType().Name;
Debug.Console(0, "{0}:\n", pluginType); CrestronConsole.ConsoleCommandResponse("{0}:\n", pluginType);
@@ -295,7 +295,7 @@ namespace PepperDash.Essentials.Core
using (var sw = new StreamWriter(fileName)) using (var sw = new StreamWriter(fileName))
{ {
sw.WriteLine(stringBuilder.ToString()); sw.WriteLine(stringBuilder.ToString());
Debug.Console(0, "Joinmap Readme generated and written to {0}", fileName); CrestronConsole.ConsoleCommandResponse("Joinmap Readme generated and written to {0}", fileName);
} }
} }
@@ -314,20 +314,6 @@ namespace PepperDash.Essentials.Core
return sortedJoins; return sortedJoins;
} }
void PrintJoinList(IEnumerable<KeyValuePair<string, JoinDataComplete>> joins)
{
foreach (var join in joins)
{
Debug.Console(0,
@"Join Number: {0} | JoinSpan: '{1}' | JoinName: {2} | Description: '{3}' | Type: '{4}' | Capabilities: '{5}'",
join.Value.JoinNumber,
join.Value.JoinSpan,
join.Key,
String.IsNullOrEmpty(join.Value.AttributeName) ? join.Value.Metadata.Label : join.Value.AttributeName,
join.Value.Metadata.JoinType.ToString(),
join.Value.Metadata.JoinCapabilities.ToString());
}
}
static StringBuilder AppendJoinList(List<KeyValuePair<string, JoinDataComplete>> joins) static StringBuilder AppendJoinList(List<KeyValuePair<string, JoinDataComplete>> joins)
{ {