From 7fdbf7c3a13db84cd1239463a81b511aefece64f Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 15 Nov 2019 13:06:37 -0700 Subject: [PATCH] Exposes DoNotStartOnNextBoot property on the Debug class properly. --- Pepperdash Core/Pepperdash Core/Logging/Debug.cs | 15 +++++++++++---- .../Pepperdash Core/Logging/DebugMemory.cs | 13 +++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Pepperdash Core/Pepperdash Core/Logging/Debug.cs b/Pepperdash Core/Pepperdash Core/Logging/Debug.cs index 083baa2..ab5a3b5 100644 --- a/Pepperdash Core/Pepperdash Core/Logging/Debug.cs +++ b/Pepperdash Core/Pepperdash Core/Logging/Debug.cs @@ -28,6 +28,8 @@ namespace PepperDash.Core public static int Level { get; private set; } + public static bool DoNotStartOnNextBoot { get; private set; } + static DebugContextCollection Contexts; static int SaveTimeoutMs = 30000; @@ -81,7 +83,10 @@ namespace PepperDash.Core CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler; LoadMemory(); - Level = Contexts.GetOrCreateItem("DEFAULT").Level; + + var context = Contexts.GetOrCreateItem("DEFAULT"); + Level = context.Level; + DoNotStartOnNextBoot = context.DoNotStartOnNextBoot; try { @@ -243,10 +248,12 @@ namespace PepperDash.Core /// public static void SetDoNotStartOnNextBoot(bool state) { - Contexts.DoNotStartOnNextBoot = state; - CrestronConsole.PrintLine("[Application {0}], Do Not Start on Next Boot set to {1}", - InitialParametersClass.ApplicationNumber, Contexts.DoNotStartOnNextBoot); + DoNotStartOnNextBoot = state; + Contexts.GetOrCreateItem("DEFAULT").DoNotStartOnNextBoot = state; SaveMemoryOnTimeout(); + + CrestronConsole.PrintLine("[Application {0}], Do Not Start on Next Boot set to {1}", + InitialParametersClass.ApplicationNumber, DoNotStartOnNextBoot); } /// diff --git a/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs b/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs index d75e3b9..2312160 100644 --- a/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs +++ b/Pepperdash Core/Pepperdash Core/Logging/DebugMemory.cs @@ -10,12 +10,6 @@ namespace PepperDash.Core.DebugThings { public class DebugContextCollection { - /// - /// Property to tell the program not to intitialize when it boots, if desired - /// - [JsonProperty("doNotStartOnNextBoot")] - public bool DoNotStartOnNextBoot { get; set; } - [JsonProperty("items")] Dictionary Items; @@ -59,6 +53,13 @@ namespace PepperDash.Core.DebugThings [JsonProperty("level")] public int Level { get; set; } + /// + /// Property to tell the program not to intitialize when it boots, if desired + /// + [JsonProperty("doNotStartOnNextBoot")] + public bool DoNotStartOnNextBoot { get; set; } + + public DebugContextItem(DebugContextCollection parent) {