diff --git a/src/PepperDash.Essentials.Core/Config/ILoadConfig.cs b/src/PepperDash.Essentials.Core/Config/ILoadConfig.cs new file mode 100644 index 00000000..00bbf5f6 --- /dev/null +++ b/src/PepperDash.Essentials.Core/Config/ILoadConfig.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PepperDash.Essentials.Core +{ + public interface ILoadConfig + { + void GoWithLoad(); + } +} diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index 7ff80505..9372f0bf 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -26,7 +26,7 @@ Full - + diff --git a/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs b/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs index dac1dd19..3030cd81 100644 --- a/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs +++ b/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs @@ -163,7 +163,7 @@ namespace PepperDash.Essentials.Core.Web new HttpCwsRoute("loadConfig") { Name = "Load Config", - RouteHandler = new RestartProgramRequestHandler() + RouteHandler = new LoadConfigRequestHandler() } }; diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs index 280e03da..a375bbf2 100644 --- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs +++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs @@ -2,6 +2,8 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; +using System; +using Serilog.Events; namespace PepperDash.Essentials.Core.Web.RequestHandlers { @@ -26,7 +28,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers { var appDebug = new AppDebug { MinimumLevel = Debug.WebsocketMinimumLogLevel }; - var body = JsonConvert.SerializeObject(appDebug, Formatting.Indented); + var body = JsonConvert.SerializeObject((appDebug, Formatting.Indented, new JsonSerializerSettings( )); context.Response.StatusCode = 200; context.Response.StatusDescription = "OK"; @@ -60,7 +62,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers } var appDebug = new AppDebug(); - var requestBody = JsonConvert.DeserializeAnonymousType(data, appDebug); + var requestBody = JsonConvert.DeserializeObject(data); Debug.SetWebSocketMinimumDebugLevel(requestBody.MinimumLevel); @@ -77,6 +79,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers public class AppDebug { [JsonProperty("minimumLevel", NullValueHandling = NullValueHandling.Ignore)] - public Serilog.Events.LogEventLevel MinimumLevel { get; set; } + public LogEventLevel MinimumLevel { get; set; } } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/LoadConfigRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/LoadConfigRequestHandler.cs index 6975d478..61932f30 100644 --- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/LoadConfigRequestHandler.cs +++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/LoadConfigRequestHandler.cs @@ -26,8 +26,10 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers protected override void HandlePost(HttpCwsContext context) { var message = ""; - //Global.ControlSystem.GoWithLoad(); - + var cs = Global.ControlSystem as ILoadConfig; + if(cs != null) + cs.GoWithLoad(); + context.Response.StatusCode = 200; context.Response.StatusDescription = "OK"; context.Response.Write(message, false); diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index 906b53ea..206ac337 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -31,6 +31,6 @@ Full - + \ No newline at end of file diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index 026c5085..aeb30ee2 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -18,7 +18,7 @@ using System.Linq; namespace PepperDash.Essentials { - public class ControlSystem : CrestronControlSystem + public class ControlSystem : CrestronControlSystem, ILoadConfig { HttpLogoServer LogoServer; diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index 0ff8faab..b47c5a3b 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -51,7 +51,7 @@ Full - +