mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-16 05:04:48 +00:00
Merge branch 'feature/pdc-35' into bugfix/pdc-36
This commit is contained in:
@@ -28,6 +28,8 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
public static int Level { get; private set; }
|
public static int Level { get; private set; }
|
||||||
|
|
||||||
|
public static bool DoNotLoadOnNextBoot { get; private set; }
|
||||||
|
|
||||||
static DebugContextCollection Contexts;
|
static DebugContextCollection Contexts;
|
||||||
|
|
||||||
static int SaveTimeoutMs = 30000;
|
static int SaveTimeoutMs = 30000;
|
||||||
@@ -65,6 +67,9 @@ namespace PepperDash.Core
|
|||||||
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
|
if (CrestronEnvironment.RuntimeEnvironment == eRuntimeEnvironment.SimplSharpPro)
|
||||||
{
|
{
|
||||||
// Add command to console
|
// Add command to console
|
||||||
|
CrestronConsole.AddNewConsoleCommand(SetDoNotLoadOnNextBootFromConsole, "donotloadonnextboot",
|
||||||
|
"donotloadonnextboot:P [true/false]: Should the application load on next boot", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
|
CrestronConsole.AddNewConsoleCommand(SetDebugFromConsole, "appdebug",
|
||||||
"appdebug:P [0-2]: Sets the application's console debug message level",
|
"appdebug:P [0-2]: Sets the application's console debug message level",
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
@@ -81,7 +86,12 @@ namespace PepperDash.Core
|
|||||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironment_ProgramStatusEventHandler;
|
||||||
|
|
||||||
LoadMemory();
|
LoadMemory();
|
||||||
Level = Contexts.GetOrCreateItem("DEFAULT").Level;
|
|
||||||
|
var context = Contexts.GetOrCreateItem("DEFAULT");
|
||||||
|
Level = context.Level;
|
||||||
|
DoNotLoadOnNextBoot = context.DoNotLoadOnNextBoot;
|
||||||
|
|
||||||
|
CrestronConsole.PrintLine(string.Format("Program {0} will not load config after next boot. Use console command go:{0} to load the config manually", InitialParametersClass.ApplicationNumber));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -140,6 +150,32 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Callback for console command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="stateString"></param>
|
||||||
|
public static void SetDoNotLoadOnNextBootFromConsole(string stateString)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(stateString.Trim()))
|
||||||
|
{
|
||||||
|
CrestronConsole.PrintLine("DoNotLoadOnNextBoot = {0}", DoNotLoadOnNextBoot);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDoNotLoadOnNextBoot(Boolean.Parse(stateString));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
CrestronConsole.PrintLine("Usage: donotloadonnextboot:P [true/false]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Callback for console command
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="items"></param>
|
||||||
public static void SetDebugFilterFromConsole(string items)
|
public static void SetDebugFilterFromConsole(string items)
|
||||||
{
|
{
|
||||||
var str = items.Trim();
|
var str = items.Trim();
|
||||||
@@ -237,6 +273,20 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the flag to prevent application starting on next boot
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
public static void SetDoNotLoadOnNextBoot(bool state)
|
||||||
|
{
|
||||||
|
DoNotLoadOnNextBoot = state;
|
||||||
|
Contexts.GetOrCreateItem("DEFAULT").DoNotLoadOnNextBoot = state;
|
||||||
|
SaveMemoryOnTimeout();
|
||||||
|
|
||||||
|
CrestronConsole.PrintLine("[Application {0}], Do Not Start on Next Boot set to {1}",
|
||||||
|
InitialParametersClass.ApplicationNumber, DoNotLoadOnNextBoot);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -47,9 +47,19 @@ namespace PepperDash.Core.DebugThings
|
|||||||
|
|
||||||
public class DebugContextItem
|
public class DebugContextItem
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The level of debug messages to print
|
||||||
|
/// </summary>
|
||||||
[JsonProperty("level")]
|
[JsonProperty("level")]
|
||||||
public int Level { get; set; }
|
public int Level { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Property to tell the program not to intitialize when it boots, if desired
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("doNotLoadOnNextBoot")]
|
||||||
|
public bool DoNotLoadOnNextBoot { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public DebugContextItem(DebugContextCollection parent)
|
public DebugContextItem(DebugContextCollection parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user