From 1c1eabcef682e802b81c1d86a6c1caa6f4b6117f Mon Sep 17 00:00:00 2001 From: jdevito Date: Wed, 1 Feb 2023 12:02:05 -0600 Subject: [PATCH] refactor: cleaned up unused using statements --- .../RequestHandlers/DevJsonRequestHandler.cs | 1 - .../RequestHandlers/DevListRequestHandler.cs | 1 - .../RequestHandlers/DevPropsRequestHandler.cs | 1 - .../DisableAllStreamDebugRequestHandler.cs | 5 ---- .../GetFeedbacksForDeviceRequestHandler.cs | 15 +--------- .../GetJoinMapForBridgeKeyRequestHandler.cs | 20 ++----------- .../GetJoinMapForDeviceKeyRequestHandler.cs | 30 ++++--------------- .../RequestHandlers/GetTypesRequestHandler.cs | 1 - 8 files changed, 10 insertions(+), 64 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevJsonRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevJsonRequestHandler.cs index 36bfd7f6..7806095e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevJsonRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevJsonRequestHandler.cs @@ -1,7 +1,6 @@ using System; using System.Text; using Crestron.SimplSharp.WebScripting; -using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Essentials.Core.Web.RequestHandlers diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevListRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevListRequestHandler.cs index 0c57ded0..c34542e2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevListRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevListRequestHandler.cs @@ -1,7 +1,6 @@ using System.Linq; using Crestron.SimplSharp.WebScripting; using Newtonsoft.Json; -using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Essentials.Core.Web.RequestHandlers diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevPropsRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevPropsRequestHandler.cs index 1a2e9157..c9f89c46 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevPropsRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevPropsRequestHandler.cs @@ -2,7 +2,6 @@ using System.Text; using Crestron.SimplSharp.WebScripting; using Newtonsoft.Json; -using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Essentials.Core.Web.RequestHandlers diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs index cec258be..8cfc7315 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs @@ -5,11 +5,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers { public class DisableAllStreamDebugRequestHandler : WebApiBaseRequestHandler { - private const string Key = "DisableAllStreamDebugRequestHandler"; - private const uint Trace = 0; - private const uint Info = 1; - private const uint Verbose = 2; - /// /// Handles CONNECT method requests /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs index 06c7b4af..7e5c7be2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs @@ -1,20 +1,12 @@ -using System; -using System.Linq; -using System.Runtime.CompilerServices; +using System.Linq; using Crestron.SimplSharp.WebScripting; using Newtonsoft.Json; -using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Essentials.Core.Web.RequestHandlers { public class GetFeedbacksForDeviceRequestHandler : WebApiBaseRequestHandler { - private const string Key = "GetFeedbacksForDeviceRequestHandler"; - private const uint Trace = 0; - private const uint Info = 1; - private const uint Verbose = 2; - /// /// Handles CONNECT method requests /// @@ -53,14 +45,9 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers return; } - //var routeDataJson = JsonConvert.SerializeObject(routeData, Formatting.Indented); - //Debug.Console(Verbose, "[{0}] routeData:\n{1}", Key.ToLower(), routeDataJson); - object deviceObj; if (!routeData.Values.TryGetValue("deviceKey", out deviceObj)) { - Debug.Console(Verbose, "TryGetValue filter failed"); - context.Response.StatusCode = 400; context.Response.StatusDescription = "Bad Request"; context.Response.End(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs index dfc6fcb8..d037b9e6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs @@ -1,9 +1,6 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using Crestron.SimplSharp.WebScripting; using Newtonsoft.Json; -using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; using PepperDash.Essentials.Core.Bridges; @@ -11,11 +8,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers { public class GetJoinMapForBridgeKeyRequestHandler : WebApiBaseRequestHandler { - private const string Key = "GetJoinMapForBridgeKeyRequestHandler"; - private const uint Trace = 0; - private const uint Info = 1; - private const uint Verbose = 2; - /// /// Handles CONNECT method requests /// @@ -54,14 +46,9 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers return; } - var routeDataJson = JsonConvert.SerializeObject(routeData, Formatting.Indented); - //Debug.Console(Verbose, "routeData:\n{0}", routeDataJson); - object bridgeObj; if (!routeData.Values.TryGetValue("bridgeKey", out bridgeObj)) { - Debug.Console(Verbose, "TryGetValue bridgeKey failed"); - context.Response.StatusCode = 400; context.Response.StatusDescription = "Bad Request"; context.Response.End(); @@ -82,15 +69,14 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers var joinMap = bridge.JoinMaps.Select(j => EssentialsWebApiHelpers.MapJoinToObject(j)).ToList(); if (joinMap == null) { - context.Response.StatusCode = 400; - context.Response.StatusDescription = "Bad Request"; + context.Response.StatusCode = 404; + context.Response.StatusDescription = "Not Found"; context.Response.End(); return; } var js = JsonConvert.SerializeObject(joinMap, Formatting.Indented); - Debug.Console(Verbose, "[{0}] HandleGet: \x0d\x0a{1}", Key.ToLower(), js); context.Response.StatusCode = 200; context.Response.StatusDescription = "OK"; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs index a71f193c..63ca47a0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs @@ -1,8 +1,5 @@ -using System.Collections.Generic; -using System.Linq; -using Crestron.SimplSharp.WebScripting; +using Crestron.SimplSharp.WebScripting; using Newtonsoft.Json; -using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; using PepperDash.Essentials.Core.Bridges; @@ -10,11 +7,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers { public class GetJoinMapForDeviceKeyRequestHandler : WebApiBaseRequestHandler { - private const string Key = "GetJoinMapForDeviceKeyRequestHandler"; - private const uint Trace = 0; - private const uint Info = 1; - private const uint Verbose = 2; - /// /// Handles CONNECT method requests /// @@ -53,16 +45,9 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers return; } - - var routeDataJson = JsonConvert.SerializeObject(routeData, Formatting.Indented); - Debug.Console(Verbose, "routeData:\n{0}", routeDataJson); - - object bridgeObj; if (!routeData.Values.TryGetValue("bridgeKey", out bridgeObj)) { - Debug.Console(Verbose, "TryGetValue bridgeKey failed"); - context.Response.StatusCode = 400; context.Response.StatusDescription = "Bad Request"; context.Response.End(); @@ -73,8 +58,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers object deviceObj; if (!routeData.Values.TryGetValue("deviceKey", out deviceObj)) { - Debug.Console(Verbose, "TryGetValue deviceKey failed"); - context.Response.StatusCode = 400; context.Response.StatusDescription = "Bad Request"; context.Response.End(); @@ -85,8 +68,8 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers var bridge = DeviceManager.GetDeviceForKey(bridgeObj.ToString()) as EiscApiAdvanced; if (bridge == null) { - context.Response.StatusCode = 400; - context.Response.StatusDescription = "Bad Request"; + context.Response.StatusCode = 404; + context.Response.StatusDescription = "Not Found"; context.Response.End(); return; @@ -95,8 +78,8 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers JoinMapBaseAdvanced deviceJoinMap; if (!bridge.JoinMaps.TryGetValue(deviceObj.ToString(), out deviceJoinMap)) { - context.Response.StatusCode = 400; - context.Response.StatusDescription = "Bad Request"; + context.Response.StatusCode = 500; + context.Response.StatusDescription = "Internal Server Error"; context.Response.End(); return; @@ -111,8 +94,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers DefaultValueHandling = DefaultValueHandling.Ignore, TypeNameHandling = TypeNameHandling.None }); - Debug.Console(Verbose, "[{0}] HandleGet: \x0d\x0a{1}", Key.ToLower(), js); - + context.Response.StatusCode = 200; context.Response.StatusDescription = "OK"; context.Response.ContentType = "application/json"; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesRequestHandler.cs index 16f1f6b0..d83660f7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesRequestHandler.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesRequestHandler.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp.WebScripting; using Newtonsoft.Json;