refactor: cleaned up unused using statements

This commit is contained in:
jdevito
2023-02-01 12:02:05 -06:00
parent 12f3f519cc
commit 1c1eabcef6
8 changed files with 10 additions and 64 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;
/// <summary>
/// Handles CONNECT method requests
/// </summary>

View File

@@ -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;
/// <summary>
/// Handles CONNECT method requests
/// </summary>
@@ -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();

View File

@@ -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;
/// <summary>
/// Handles CONNECT method requests
/// </summary>
@@ -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";

View File

@@ -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;
/// <summary>
/// Handles CONNECT method requests
/// </summary>
@@ -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";

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;