Merged in bugfiix/pdc-3 (pull request #6)

Bugfiix/pdc 3

Approved-by: Neil Dorin <ndorin@pepperdash.com>
Approved-by: Heath Volmer <hvolmer@pepperdash.com>
This commit is contained in:
Neil Dorin
2019-04-02 21:43:47 +00:00
committed by Heath Volmer
5 changed files with 40 additions and 19 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -67,7 +67,7 @@ namespace PepperDash.Core.Config
/// </summary> /// </summary>
/// <param name="doubleConfig"></param> /// <param name="doubleConfig"></param>
/// <returns></returns> /// <returns></returns>
static JObject MergeConfigs(JObject doubleConfig) public static JObject MergeConfigs(JObject doubleConfig)
{ {
var system = JObject.FromObject(doubleConfig["system"]); var system = JObject.FromObject(doubleConfig["system"]);
var template = JObject.FromObject(doubleConfig["template"]); var template = JObject.FromObject(doubleConfig["template"]);
@@ -114,15 +114,21 @@ namespace PepperDash.Core.Config
/// <summary> /// <summary>
/// Merges the contents of a base and a delta array, matching the entries on a top-level property /// Merges the contents of a base and a delta array, matching the entries on a top-level property
/// given by propertyName. Returns a merge of them. Items in the delta array that do not have /// given by propertyName. Returns a merge of them. Items in the delta array that do not have
/// a matched item in base array will not be merged. /// a matched item in base array will not be merged. Non keyed system items will replace the template items.
/// </summary> /// </summary>
static JArray MergeArraysOnTopLevelProperty(JArray a1, JArray a2, string propertyName, string path) static JArray MergeArraysOnTopLevelProperty(JArray a1, JArray a2, string propertyName, string path)
{ {
var result = new JArray(); var result = new JArray();
if (a2 == null) if (a2 == null || a2.Count == 0) // If the system array is null or empty, return the template array
result = a1; return a1;
else if (a1 != null) else if (a1 != null)
{ {
if (a2[0]["key"] == null) // If the first item in the system array has no key, overwrite the template array
{ // with the system array
return a2;
}
else // The arrays are keyed, merge them by key
{
for (int i = 0; i < a1.Count(); i++) for (int i = 0; i < a1.Count(); i++)
{ {
var a1Dev = a1[i]; var a1Dev = a1[i];
@@ -135,6 +141,7 @@ namespace PepperDash.Core.Config
} }
else else
result.Add(a1Dev); result.Add(a1Dev);
}
} }
} }
return result; return result;

View File

@@ -69,7 +69,21 @@ namespace PepperDash.Core
LoadMemory(); LoadMemory();
Level = Contexts.GetOrCreateItem("DEFAULT").Level; Level = Contexts.GetOrCreateItem("DEFAULT").Level;
CrestronLogger.Initialize(2, LoggerModeEnum.RM); // Use RM instead of DEFAULT as not to double-up console messages. try
{
if (InitialParametersClass.NumberOfRemovableDrives > 0)
{
CrestronConsole.PrintLine("{0} RM Drive(s) Present.", InitialParametersClass.NumberOfRemovableDrives);
CrestronLogger.Initialize(2, LoggerModeEnum.DEFAULT); // Use RM instead of DEFAULT as not to double-up console messages.
}
else
CrestronConsole.PrintLine("No RM Drive(s) Present.");
}
catch (Exception e)
{
CrestronConsole.PrintLine("Initializing of CrestronLogger failed: {0}", e);
}
} }
/// <summary> /// <summary>

View File

@@ -4,4 +4,4 @@
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pepperdash_Core")] [assembly: AssemblyProduct("Pepperdash_Core")]
[assembly: AssemblyCopyright("Copyright © PepperDash 2019")] [assembly: AssemblyCopyright("Copyright © PepperDash 2019")]
[assembly: AssemblyVersion("1.0.14.*")] [assembly: AssemblyVersion("1.0.15.*")]