mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
refactor: Clean up and streamline Debug and WebApiServer classes for improved readability and performance
This commit is contained in:
parent
5c26438a1c
commit
c98b48ff87
7 changed files with 379 additions and 280 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.WebScripting;
|
||||
using PepperDash.Core;
|
||||
|
|
@ -26,10 +27,6 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
? string.Format("/app{0:00}/api", InitialParametersClass.ApplicationNumber)
|
||||
: "/api";
|
||||
|
||||
private const int DebugTrace = 0;
|
||||
private const int DebugInfo = 1;
|
||||
private const int DebugVerbose = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BasePath
|
||||
/// </summary>
|
||||
|
|
@ -230,7 +227,7 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
|
||||
_server.Start();
|
||||
|
||||
GetPaths();
|
||||
PrintPaths();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -240,11 +237,11 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
|
||||
_server.Start();
|
||||
|
||||
GetPaths();
|
||||
PrintPaths();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print the available pahts
|
||||
/// Print the available paths
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// http(s)://{ipaddress}/cws/{basePath}
|
||||
|
|
@ -253,7 +250,7 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
/// <summary>
|
||||
/// GetPaths method
|
||||
/// </summary>
|
||||
public void GetPaths()
|
||||
public void PrintPaths()
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Information, this, new string('-', 50));
|
||||
|
||||
|
|
@ -267,7 +264,7 @@ public class EssentialsWebApi : EssentialsDevice
|
|||
? $"https://{hostname}/VirtualControl/Rooms/{InitialParametersClass.RoomId}/cws{BasePath}"
|
||||
: $"https://{currentIp}/cws{BasePath}";
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Server:{path:l}", path);
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Server: {path:l}", path);
|
||||
|
||||
var routeCollection = _server.GetRouteCollection();
|
||||
if (routeCollection == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue