mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
fix: use correct line endings for verbatim strings
This commit is contained in:
0
Crestron-Library-Usage-Analysis.md
Normal file
0
Crestron-Library-Usage-Analysis.md
Normal file
@@ -1,4 +1,8 @@
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.CrestronLogger;
|
||||
@@ -11,10 +15,6 @@ using Serilog.Events;
|
||||
using Serilog.Formatting.Compact;
|
||||
using Serilog.Formatting.Json;
|
||||
using Serilog.Templates;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PepperDash.Core;
|
||||
|
||||
@@ -101,15 +101,15 @@ public static class Debug
|
||||
|
||||
private static CTimer _saveTimer;
|
||||
|
||||
/// <summary>
|
||||
/// When true, the IncludedExcludedKeys dict will contain keys to include.
|
||||
/// When false (default), IncludedExcludedKeys will contain keys to exclude.
|
||||
/// </summary>
|
||||
private static bool _excludeAllMode;
|
||||
/// <summary>
|
||||
/// When true, the IncludedExcludedKeys dict will contain keys to include.
|
||||
/// When false (default), IncludedExcludedKeys will contain keys to exclude.
|
||||
/// </summary>
|
||||
private static bool _excludeAllMode;
|
||||
|
||||
//static bool ExcludeNoKeyMessages;
|
||||
//static bool ExcludeNoKeyMessages;
|
||||
|
||||
private static readonly Dictionary<string, object> IncludedExcludedKeys;
|
||||
private static readonly Dictionary<string, object> IncludedExcludedKeys;
|
||||
|
||||
private static readonly LoggerConfiguration _defaultLoggerConfiguration;
|
||||
|
||||
@@ -261,14 +261,15 @@ public static class Debug
|
||||
return LogEventLevel.Information;
|
||||
}
|
||||
|
||||
if(logLevel < 0 || logLevel > 5)
|
||||
if (logLevel < 0 || logLevel > 5)
|
||||
{
|
||||
CrestronConsole.PrintLine($"Stored Log level not valid for {levelStoreKey}: {logLevel}. Setting level to {LogEventLevel.Information}");
|
||||
return LogEventLevel.Information;
|
||||
}
|
||||
|
||||
return (LogEventLevel)logLevel;
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CrestronConsole.PrintLine($"Exception retrieving log level for {levelStoreKey}: {ex.Message}");
|
||||
return LogEventLevel.Information;
|
||||
@@ -280,7 +281,7 @@ public static class Debug
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var ver =
|
||||
assembly
|
||||
.GetCustomAttributes(typeof (AssemblyInformationalVersionAttribute), false);
|
||||
.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
|
||||
|
||||
if (ver != null && ver.Length > 0)
|
||||
{
|
||||
@@ -328,13 +329,13 @@ public static class Debug
|
||||
if (levelString.Trim() == "?")
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
$@"Used to set the minimum level of debug messages to be printed to the console:
|
||||
{_logLevels[0]} = 0
|
||||
{_logLevels[1]} = 1
|
||||
{_logLevels[2]} = 2
|
||||
{_logLevels[3]} = 3
|
||||
{_logLevels[4]} = 4
|
||||
{_logLevels[5]} = 5");
|
||||
"Used to set the minimum level of debug messages to be printed to the console:\r\n" +
|
||||
$"{_logLevels[0]} = 0\r\n" +
|
||||
$"{_logLevels[1]} = 1\r\n" +
|
||||
$"{_logLevels[2]} = 2\r\n" +
|
||||
$"{_logLevels[3]} = 3\r\n" +
|
||||
$"{_logLevels[4]} = 4\r\n" +
|
||||
$"{_logLevels[5]} = 5");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -344,18 +345,18 @@ public static class Debug
|
||||
return;
|
||||
}
|
||||
|
||||
if(int.TryParse(levelString, out var levelInt))
|
||||
if (int.TryParse(levelString, out var levelInt))
|
||||
{
|
||||
if(levelInt < 0 || levelInt > 5)
|
||||
if (levelInt < 0 || levelInt > 5)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse($"Error: Unable to parse {levelString} to valid log level. If using a number, value must be between 0-5");
|
||||
return;
|
||||
}
|
||||
SetDebugLevel((uint) levelInt);
|
||||
SetDebugLevel((uint)levelInt);
|
||||
return;
|
||||
}
|
||||
|
||||
if(Enum.TryParse<LogEventLevel>(levelString, out var levelEnum))
|
||||
if (Enum.TryParse<LogEventLevel>(levelString, out var levelEnum))
|
||||
{
|
||||
SetDebugLevel(levelEnum);
|
||||
return;
|
||||
@@ -375,7 +376,7 @@ public static class Debug
|
||||
/// <param name="level"> Valid values 0-5</param>
|
||||
public static void SetDebugLevel(uint level)
|
||||
{
|
||||
if(!_logLevels.TryGetValue(level, out var logLevel))
|
||||
if (!_logLevels.TryGetValue(level, out var logLevel))
|
||||
{
|
||||
logLevel = LogEventLevel.Information;
|
||||
|
||||
@@ -394,9 +395,9 @@ public static class Debug
|
||||
CrestronConsole.ConsoleCommandResponse("[Application {0}], Debug level set to {1}\r\n",
|
||||
InitialParametersClass.ApplicationNumber, _consoleLoggingLevelSwitch.MinimumLevel);
|
||||
|
||||
CrestronConsole.ConsoleCommandResponse($"Storing level {level}:{(int) level}");
|
||||
CrestronConsole.ConsoleCommandResponse($"Storing level {level}:{(int)level}");
|
||||
|
||||
var err = CrestronDataStoreStatic.SetLocalIntValue(LevelStoreKey, (int) level);
|
||||
var err = CrestronDataStoreStatic.SetLocalIntValue(LevelStoreKey, (int)level);
|
||||
|
||||
CrestronConsole.ConsoleCommandResponse($"Store result: {err}:{(int)level}");
|
||||
|
||||
@@ -408,7 +409,7 @@ public static class Debug
|
||||
{
|
||||
_websocketLoggingLevelSwitch.MinimumLevel = level;
|
||||
|
||||
var err = CrestronDataStoreStatic.SetLocalUintValue(WebSocketLevelStoreKey, (uint) level);
|
||||
var err = CrestronDataStoreStatic.SetLocalUintValue(WebSocketLevelStoreKey, (uint)level);
|
||||
|
||||
if (err != CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
LogMessage(LogEventLevel.Information, "Error saving websocket debug level setting: {erro}", err);
|
||||
@@ -466,80 +467,80 @@ public static class Debug
|
||||
/// Callback for console command
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
public static void SetDebugFilterFromConsole(string items)
|
||||
{
|
||||
var str = items.Trim();
|
||||
if (str == "?")
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Usage:\r APPDEBUGFILTER key1 key2 key3....\r " +
|
||||
"+all: at beginning puts filter into 'default include' mode\r" +
|
||||
" All keys that follow will be excluded from output.\r" +
|
||||
"-all: at beginning puts filter into 'default exclude all' mode.\r" +
|
||||
" All keys that follow will be the only keys that are shown\r" +
|
||||
"+nokey: Enables messages with no key (default)\r" +
|
||||
"-nokey: Disables messages with no key.\r" +
|
||||
"(nokey settings are independent of all other settings)");
|
||||
return;
|
||||
}
|
||||
var keys = Regex.Split(str, @"\s*");
|
||||
foreach (var keyToken in keys)
|
||||
{
|
||||
var lkey = keyToken.ToLower();
|
||||
if (lkey == "+all")
|
||||
{
|
||||
IncludedExcludedKeys.Clear();
|
||||
_excludeAllMode = false;
|
||||
}
|
||||
else if (lkey == "-all")
|
||||
{
|
||||
IncludedExcludedKeys.Clear();
|
||||
_excludeAllMode = true;
|
||||
}
|
||||
//else if (lkey == "+nokey")
|
||||
//{
|
||||
// ExcludeNoKeyMessages = false;
|
||||
//}
|
||||
//else if (lkey == "-nokey")
|
||||
//{
|
||||
// ExcludeNoKeyMessages = true;
|
||||
//}
|
||||
else
|
||||
{
|
||||
string key;
|
||||
if (lkey.StartsWith("-"))
|
||||
{
|
||||
key = lkey.Substring(1);
|
||||
// if in exclude all mode, we need to remove this from the inclusions
|
||||
if (_excludeAllMode)
|
||||
{
|
||||
if (IncludedExcludedKeys.ContainsKey(key))
|
||||
IncludedExcludedKeys.Remove(key);
|
||||
}
|
||||
// otherwise include all mode, add to the exclusions
|
||||
else
|
||||
{
|
||||
IncludedExcludedKeys[key] = new object();
|
||||
}
|
||||
}
|
||||
else if (lkey.StartsWith("+"))
|
||||
{
|
||||
key = lkey.Substring(1);
|
||||
// if in exclude all mode, we need to add this as inclusion
|
||||
if (_excludeAllMode)
|
||||
{
|
||||
public static void SetDebugFilterFromConsole(string items)
|
||||
{
|
||||
var str = items.Trim();
|
||||
if (str == "?")
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse("Usage:\r APPDEBUGFILTER key1 key2 key3....\r " +
|
||||
"+all: at beginning puts filter into 'default include' mode\r" +
|
||||
" All keys that follow will be excluded from output.\r" +
|
||||
"-all: at beginning puts filter into 'default exclude all' mode.\r" +
|
||||
" All keys that follow will be the only keys that are shown\r" +
|
||||
"+nokey: Enables messages with no key (default)\r" +
|
||||
"-nokey: Disables messages with no key.\r" +
|
||||
"(nokey settings are independent of all other settings)");
|
||||
return;
|
||||
}
|
||||
var keys = Regex.Split(str, @"\s*");
|
||||
foreach (var keyToken in keys)
|
||||
{
|
||||
var lkey = keyToken.ToLower();
|
||||
if (lkey == "+all")
|
||||
{
|
||||
IncludedExcludedKeys.Clear();
|
||||
_excludeAllMode = false;
|
||||
}
|
||||
else if (lkey == "-all")
|
||||
{
|
||||
IncludedExcludedKeys.Clear();
|
||||
_excludeAllMode = true;
|
||||
}
|
||||
//else if (lkey == "+nokey")
|
||||
//{
|
||||
// ExcludeNoKeyMessages = false;
|
||||
//}
|
||||
//else if (lkey == "-nokey")
|
||||
//{
|
||||
// ExcludeNoKeyMessages = true;
|
||||
//}
|
||||
else
|
||||
{
|
||||
string key;
|
||||
if (lkey.StartsWith("-"))
|
||||
{
|
||||
key = lkey.Substring(1);
|
||||
// if in exclude all mode, we need to remove this from the inclusions
|
||||
if (_excludeAllMode)
|
||||
{
|
||||
if (IncludedExcludedKeys.ContainsKey(key))
|
||||
IncludedExcludedKeys.Remove(key);
|
||||
}
|
||||
// otherwise include all mode, add to the exclusions
|
||||
else
|
||||
{
|
||||
IncludedExcludedKeys[key] = new object();
|
||||
}
|
||||
}
|
||||
else if (lkey.StartsWith("+"))
|
||||
{
|
||||
key = lkey.Substring(1);
|
||||
// if in exclude all mode, we need to add this as inclusion
|
||||
if (_excludeAllMode)
|
||||
{
|
||||
|
||||
IncludedExcludedKeys[key] = new object();
|
||||
}
|
||||
// otherwise include all mode, remove this from exclusions
|
||||
else
|
||||
{
|
||||
if (IncludedExcludedKeys.ContainsKey(key))
|
||||
IncludedExcludedKeys.Remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
IncludedExcludedKeys[key] = new object();
|
||||
}
|
||||
// otherwise include all mode, remove this from exclusions
|
||||
else
|
||||
{
|
||||
if (IncludedExcludedKeys.ContainsKey(key))
|
||||
IncludedExcludedKeys.Remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -624,7 +625,7 @@ public static class Debug
|
||||
|
||||
public static void LogMessage(LogEventLevel level, string message, params object[] args)
|
||||
{
|
||||
_logger.Write(level, message, args);
|
||||
_logger.Write(level, message, args);
|
||||
}
|
||||
|
||||
public static void LogMessage(LogEventLevel level, Exception ex, string message, params object[] args)
|
||||
@@ -648,7 +649,7 @@ public static class Debug
|
||||
#region Explicit methods for logging levels
|
||||
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
|
||||
{
|
||||
using(LogContext.PushProperty("Key", keyed?.Key))
|
||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||
{
|
||||
_logger.Write(LogEventLevel.Verbose, message, args);
|
||||
}
|
||||
@@ -656,7 +657,7 @@ public static class Debug
|
||||
|
||||
public static void LogVerbose(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||
{
|
||||
using(LogContext.PushProperty("Key", keyed?.Key))
|
||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||
{
|
||||
_logger.Write(LogEventLevel.Verbose, ex, message, args);
|
||||
}
|
||||
@@ -847,7 +848,7 @@ public static class Debug
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs to Console when at-level, and all messages to error log, including device key
|
||||
/// Logs to Console when at-level, and all messages to error log, including device key
|
||||
/// </summary>
|
||||
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
||||
public static void Console(uint level, IKeyed dev, string format, params object[] items)
|
||||
@@ -1003,7 +1004,7 @@ public static class Debug
|
||||
return string.Format(@"\user\debugSettings\program{0}", InitialParametersClass.ApplicationNumber);
|
||||
}
|
||||
|
||||
return string.Format("{0}{1}user{1}debugSettings{1}{2}.json",Directory.GetApplicationRootDirectory(), Path.DirectorySeparatorChar, InitialParametersClass.RoomId);
|
||||
return string.Format("{0}{1}user{1}debugSettings{1}{2}.json", Directory.GetApplicationRootDirectory(), Path.DirectorySeparatorChar, InitialParametersClass.RoomId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
@@ -440,9 +440,9 @@ public static class DeviceManager
|
||||
if (String.IsNullOrEmpty(s) || s.Contains("?"))
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"SETDEVICESTREAMDEBUG [{deviceKey}] [OFF |TX | RX | BOTH] [timeOutInMinutes]
|
||||
{deviceKey} [OFF | TX | RX | BOTH] - Device to set stream debugging on, and which setting to use
|
||||
timeOutInMinutes - Set timeout for stream debugging. Default is 30 minutes");
|
||||
"SETDEVICESTREAMDEBUG [{deviceKey}] [OFF |TX | RX | BOTH] [timeOutInMinutes]\r\n" +
|
||||
" {deviceKey} [OFF | TX | RX | BOTH] - Device to set stream debugging on, and which setting to use\r\n" +
|
||||
" timeOutInMinutes - Set timeout for stream debugging. Default is 30 minutes");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
|
||||
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DeviceFactory
|
||||
{
|
||||
var programAssemblies = Directory.GetFiles(InitialParametersClass.ProgramDirectory.ToString(), "*.dll");
|
||||
|
||||
foreach(var assembly in programAssemblies)
|
||||
foreach (var assembly in programAssemblies)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -98,7 +98,7 @@ public class DeviceFactory
|
||||
|
||||
var types = assembly.GetTypes().Where(ct => typeof(IDeviceFactory).IsAssignableFrom(ct) && !ct.IsInterface && !ct.IsAbstract);
|
||||
|
||||
if(types == null || !types.Any())
|
||||
if (types == null || !types.Any())
|
||||
{
|
||||
Debug.LogDebug("No DeviceFactory types found in assembly: {assemblyName}", assembly.GetName().Name);
|
||||
continue;
|
||||
@@ -146,7 +146,7 @@ public class DeviceFactory
|
||||
private static readonly Dictionary<string, DeviceFactoryWrapper> FactoryMethods =
|
||||
new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Registers a factory method for creating instances of a specific type.
|
||||
/// </summary>
|
||||
/// <remarks>This method associates a type name with a factory method, allowing instances of the type to
|
||||
@@ -155,10 +155,10 @@ public class DeviceFactory
|
||||
/// <param name="typeName">The name of the type for which the factory method is being registered. This value cannot be null or empty.</param>
|
||||
/// <param name="method">A delegate that defines the factory method. The delegate takes a <see cref="DeviceConfig"/> parameter and
|
||||
/// returns an instance of <see cref="IKeyed"/>.</param>
|
||||
public static void AddFactoryForType(string typeName, Func<DeviceConfig, IKeyed> method)
|
||||
{
|
||||
FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method});
|
||||
}
|
||||
public static void AddFactoryForType(string typeName, Func<DeviceConfig, IKeyed> method)
|
||||
{
|
||||
FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a factory method for creating instances of a specific device type.
|
||||
@@ -172,7 +172,7 @@ public class DeviceFactory
|
||||
/// cref="IKeyed"/>.</param>
|
||||
public static void AddFactoryForType(string typeName, string description, Type Type, Func<DeviceConfig, IKeyed> method)
|
||||
{
|
||||
if(FactoryMethods.ContainsKey(typeName))
|
||||
if (FactoryMethods.ContainsKey(typeName))
|
||||
{
|
||||
Debug.LogInformation("Unable to add type: '{typeName}'. Already exists in DeviceFactory", typeName);
|
||||
return;
|
||||
@@ -203,7 +203,7 @@ public class DeviceFactory
|
||||
var secretProvider = SecretsManager.GetSecretProviderByKey(data.Provider);
|
||||
if (secretProvider == null) return null;
|
||||
var secret = secretProvider.GetSecret(data.Key);
|
||||
if (secret != null) return (string) secret.Value;
|
||||
if (secret != null) return (string)secret.Value;
|
||||
Debug.LogMessage(LogEventLevel.Debug,
|
||||
"Unable to retrieve secret {0}{1} - Make sure you've added it to the secrets provider",
|
||||
data.Provider, data.Key);
|
||||
@@ -286,23 +286,23 @@ public class DeviceFactory
|
||||
}
|
||||
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"Type: '{0}'
|
||||
Type: '{1}'
|
||||
Description: {2}{3}", type.Key, Type, description, CrestronEnvironment.NewLine);
|
||||
"Type: '{0}'\r\n" +
|
||||
" Type: '{1}'\r\n" +
|
||||
" Description: {2}{3}", type.Key, Type, description, CrestronEnvironment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Retrieves a dictionary of device factory wrappers, optionally filtered by a specified string.
|
||||
/// </summary>
|
||||
/// <param name="filter">A string used to filter the dictionary keys. Only entries with keys containing the specified filter will be
|
||||
/// included. If <see langword="null"/> or empty, all entries are returned.</param>
|
||||
/// <returns>A dictionary where the keys are strings representing device identifiers and the values are <see
|
||||
/// cref="DeviceFactoryWrapper"/> instances. The dictionary may be empty if no entries match the filter.</returns>
|
||||
public static Dictionary<string, DeviceFactoryWrapper> GetDeviceFactoryDictionary(string filter)
|
||||
{
|
||||
return string.IsNullOrEmpty(filter)
|
||||
? FactoryMethods
|
||||
: FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value);
|
||||
}
|
||||
public static Dictionary<string, DeviceFactoryWrapper> GetDeviceFactoryDictionary(string filter)
|
||||
{
|
||||
return string.IsNullOrEmpty(filter)
|
||||
? FactoryMethods
|
||||
: FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
using Crestron.SimplSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.Net.Http;
|
||||
using Crestron.SimplSharp.WebScripting;
|
||||
@@ -30,12 +36,6 @@ using PepperDash.Essentials.RoomBridges;
|
||||
using PepperDash.Essentials.Services;
|
||||
using PepperDash.Essentials.WebApiHandlers;
|
||||
using PepperDash.Essentials.WebSocketServer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using WebSocketSharp;
|
||||
|
||||
namespace PepperDash.Essentials;
|
||||
@@ -1569,15 +1569,14 @@ public class MobileControlSystemController : EssentialsDevice, IMobileControl
|
||||
if (Config.EnableApiServer)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"Mobile Control Edge Server API Information:
|
||||
|
||||
Server address: {0}
|
||||
System Name: {1}
|
||||
System URL: {2}
|
||||
System UUID: {3}
|
||||
System User code: {4}
|
||||
Connected?: {5}
|
||||
Seconds Since Last Ack: {6}",
|
||||
"Mobile Control Edge Server API Information:\r\n\r\n" +
|
||||
"\tServer address: {0}\r\n" +
|
||||
"\tSystem Name: {1}\r\n" +
|
||||
"\tSystem URL: {2}\r\n" +
|
||||
"\tSystem UUID: {3}\r\n" +
|
||||
"\tSystem User code: {4}\r\n" +
|
||||
"\tConnected?: {5}\r\n" +
|
||||
"\tSeconds Since Last Ack: {6}\r\n",
|
||||
url,
|
||||
name,
|
||||
ConfigReader.ConfigObject.SystemUrl,
|
||||
@@ -1590,10 +1589,8 @@ public class MobileControlSystemController : EssentialsDevice, IMobileControl
|
||||
else
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"
|
||||
Mobile Control Edge Server API Information:
|
||||
Not Enabled in Config.
|
||||
"
|
||||
"\r\nMobile Control Edge Server API Information:\r\n" +
|
||||
" Not Enabled in Config.\r\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1604,21 +1601,17 @@ Mobile Control Edge Server API Information:
|
||||
)
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"
|
||||
Mobile Control Direct Server Information:
|
||||
User App URL: {0}
|
||||
Server port: {1}
|
||||
",
|
||||
"\r\nMobile Control Direct Server Information:\r\n" +
|
||||
" User App URL: {0}\r\n" +
|
||||
" Server port: {1}\r\n",
|
||||
string.Format("{0}[insert_client_token]", _directServer.UserAppUrlPrefix),
|
||||
_directServer.Port
|
||||
);
|
||||
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"
|
||||
UI Client Info:
|
||||
Tokens Defined: {0}
|
||||
Clients Connected: {1}
|
||||
",
|
||||
"\r\n UI Client Info:\r\n" +
|
||||
" Tokens Defined: {0}\r\n" +
|
||||
" Clients Connected: {1}\r\n",
|
||||
_directServer.UiClients.Count,
|
||||
_directServer.ConnectedUiClientsCount
|
||||
);
|
||||
@@ -1636,15 +1629,13 @@ Mobile Control Direct Server Information:
|
||||
}
|
||||
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"
|
||||
Client {0}:
|
||||
Room Key: {1}
|
||||
Touchpanel Key: {6}
|
||||
Token: {2}
|
||||
Client URL: {3}
|
||||
Connected: {4}
|
||||
Duration: {5}
|
||||
",
|
||||
"\r\nClient {0}:\r\n" +
|
||||
"Room Key: {1}\r\n" +
|
||||
"Touchpanel Key: {6}\r\n" +
|
||||
"Token: {2}\r\n" +
|
||||
"Client URL: {3}\r\n" +
|
||||
"Connected: {4}\r\n" +
|
||||
"Duration: {5}\r\n",
|
||||
clientNo,
|
||||
clientContext.Value.Token.RoomKey,
|
||||
clientContext.Key,
|
||||
@@ -1659,9 +1650,8 @@ Duration: {5}
|
||||
else
|
||||
{
|
||||
CrestronConsole.ConsoleCommandResponse(
|
||||
@"
|
||||
Mobile Control Direct Server Infromation:
|
||||
Not Enabled in Config."
|
||||
"\r\nMobile Control Direct Server Information:\r\n" +
|
||||
" Not Enabled in Config.\r\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user