mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 20:47:04 +00:00
docs: add XML documentation to PepperDash.Core project
Co-authored-by: andrew-welker <1765622+andrew-welker@users.noreply.github.com>
This commit is contained in:
parent
eeb0e84dc7
commit
260677a37f
59 changed files with 1072 additions and 5 deletions
|
|
@ -88,6 +88,9 @@ namespace PepperDash.Core
|
||||||
/// Disconnects this gather from the Port's TextReceived event. This will not fire LineReceived
|
/// Disconnects this gather from the Port's TextReceived event. This will not fire LineReceived
|
||||||
/// after the this call.
|
/// after the this call.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Stop method
|
||||||
|
/// </summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
Port.TextReceived -= Port_TextReceived;
|
Port.TextReceived -= Port_TextReceived;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current debug setting
|
/// The current debug setting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the DebugSetting
|
||||||
|
/// </summary>
|
||||||
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
public eStreamDebuggingSetting DebugSetting { get; private set; }
|
||||||
|
|
||||||
private uint _DebugTimeoutInMs;
|
private uint _DebugTimeoutInMs;
|
||||||
|
|
@ -44,6 +47,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates that receive stream debugging is enabled
|
/// Indicates that receive stream debugging is enabled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the RxStreamDebuggingIsEnabled
|
||||||
|
/// </summary>
|
||||||
public bool RxStreamDebuggingIsEnabled{ get; private set; }
|
public bool RxStreamDebuggingIsEnabled{ get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -65,6 +71,9 @@ namespace PepperDash.Core
|
||||||
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
/// Sets the debugging setting and if not setting to off, assumes the default of 30 mintues
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="setting"></param>
|
/// <param name="setting"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebuggingWithDefaultTimeout method
|
||||||
|
/// </summary>
|
||||||
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
|
public void SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting setting)
|
||||||
{
|
{
|
||||||
if (setting == eStreamDebuggingSetting.Off)
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
|
|
@ -81,6 +90,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="setting"></param>
|
/// <param name="setting"></param>
|
||||||
/// <param name="minutes"></param>
|
/// <param name="minutes"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebuggingWithSpecificTimeout method
|
||||||
|
/// </summary>
|
||||||
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
|
public void SetDebuggingWithSpecificTimeout(eStreamDebuggingSetting setting, uint minutes)
|
||||||
{
|
{
|
||||||
if (setting == eStreamDebuggingSetting.Off)
|
if (setting == eStreamDebuggingSetting.Off)
|
||||||
|
|
@ -135,6 +147,9 @@ namespace PepperDash.Core
|
||||||
/// The available settings for stream debugging
|
/// The available settings for stream debugging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
|
/// <summary>
|
||||||
|
/// Enumeration of eStreamDebuggingSetting values
|
||||||
|
/// </summary>
|
||||||
public enum eStreamDebuggingSetting
|
public enum eStreamDebuggingSetting
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Config properties that indicate how to communicate with a device for control
|
/// Config properties that indicate how to communicate with a device for control
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ControlPropertiesConfig
|
||||||
|
/// </summary>
|
||||||
public class ControlPropertiesConfig
|
public class ControlPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Client
|
||||||
|
/// </summary>
|
||||||
public ISocketStatus Client { get; private set; }
|
public ISocketStatus Client { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -62,6 +65,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the State
|
||||||
|
/// </summary>
|
||||||
public ServerState State { get; private set; }
|
public ServerState State { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -156,6 +162,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Text
|
||||||
|
/// </summary>
|
||||||
public string Text { get; private set; }
|
public string Text { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port on server
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Port
|
||||||
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -151,6 +154,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// bool to track if auto reconnect should be set on the socket
|
/// bool to track if auto reconnect should be set on the socket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutoReconnect
|
||||||
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -190,6 +196,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bool to show whether the server requires a preshared key. This is used in the DynamicTCPServer class
|
/// Bool to show whether the server requires a preshared key. This is used in the DynamicTCPServer class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SharedKeyRequired
|
||||||
|
/// </summary>
|
||||||
public bool SharedKeyRequired { get; set; }
|
public bool SharedKeyRequired { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -209,6 +218,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SharedKey
|
||||||
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -224,6 +236,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bool showing if socket is ready for communication after shared key exchange
|
/// Bool showing if socket is ready for communication after shared key exchange
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsReadyForCommunication
|
||||||
|
/// </summary>
|
||||||
public bool IsReadyForCommunication { get; set; }
|
public bool IsReadyForCommunication { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -344,6 +359,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just to help S+ set the key
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -421,6 +439,9 @@ namespace PepperDash.Core
|
||||||
/// Deactivate the client
|
/// Deactivate the client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// Deactivate method
|
||||||
|
/// </summary>
|
||||||
public override bool Deactivate()
|
public override bool Deactivate()
|
||||||
{
|
{
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
|
|
@ -434,6 +455,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
ConnectionCount++;
|
ConnectionCount++;
|
||||||
|
|
@ -565,6 +589,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
this.LogVerbose("Disconnect Called");
|
this.LogVerbose("Disconnect Called");
|
||||||
|
|
@ -588,6 +615,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does the actual disconnect business
|
/// Does the actual disconnect business
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// DisconnectClient method
|
||||||
|
/// </summary>
|
||||||
public void DisconnectClient()
|
public void DisconnectClient()
|
||||||
{
|
{
|
||||||
if (_client == null) return;
|
if (_client == null) return;
|
||||||
|
|
@ -848,6 +878,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General send method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(text))
|
if (!string.IsNullOrEmpty(text))
|
||||||
|
|
@ -877,6 +910,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (bytes.Length > 0)
|
if (bytes.Length > 0)
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port on server
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Port
|
||||||
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -115,6 +118,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SharedKey
|
||||||
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -125,6 +131,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 2000
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the BufferSize
|
||||||
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -338,6 +347,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just to help S+ set the key
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -397,6 +409,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
ConnectionCount++;
|
ConnectionCount++;
|
||||||
|
|
@ -528,6 +543,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
this.LogVerbose("Disconnect Called");
|
this.LogVerbose("Disconnect Called");
|
||||||
|
|
@ -806,6 +824,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General send method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(text))
|
if (!string.IsNullOrEmpty(text))
|
||||||
|
|
@ -835,6 +856,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (bytes.Length > 0)
|
if (bytes.Length > 0)
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for ServerHasChokedCallbackDelegate
|
||||||
|
/// </summary>
|
||||||
public delegate void ServerHasChokedCallbackDelegate();
|
public delegate void ServerHasChokedCallbackDelegate();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -106,6 +109,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 3 by default
|
/// 3 by default
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the MonitorClientMaxFailureCount
|
||||||
|
/// </summary>
|
||||||
public int MonitorClientMaxFailureCount { get; set; }
|
public int MonitorClientMaxFailureCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -192,6 +198,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port Server should listen on
|
/// Port Server should listen on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Port
|
||||||
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -226,6 +235,9 @@ namespace PepperDash.Core
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
|
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
|
||||||
/// If SharedKey changes while server is listening or clients are connected, disconnect and stop listening will be called
|
/// If SharedKey changes while server is listening or clients are connected, disconnect and stop listening will be called
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SharedKey
|
||||||
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -250,6 +262,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the HeartbeatRequiredIntervalMs
|
||||||
|
/// </summary>
|
||||||
public int HeartbeatRequiredIntervalMs { get; set; }
|
public int HeartbeatRequiredIntervalMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -260,6 +275,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the HeartbeatStringToMatch
|
||||||
|
/// </summary>
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
//private timers for Heartbeats per client
|
//private timers for Heartbeats per client
|
||||||
|
|
@ -278,6 +296,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 2000
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the BufferSize
|
||||||
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -341,6 +362,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnects all clients and stops the server
|
/// Disconnects all clients and stops the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// KillServer method
|
||||||
|
/// </summary>
|
||||||
public void KillServer()
|
public void KillServer()
|
||||||
{
|
{
|
||||||
ServerStopped = true;
|
ServerStopped = true;
|
||||||
|
|
@ -356,6 +380,9 @@ namespace PepperDash.Core
|
||||||
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -397,6 +424,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start listening on the specified port
|
/// Start listening on the specified port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Listen method
|
||||||
|
/// </summary>
|
||||||
public void Listen()
|
public void Listen()
|
||||||
{
|
{
|
||||||
ServerCCSection.Enter();
|
ServerCCSection.Enter();
|
||||||
|
|
@ -455,6 +485,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop Listeneing
|
/// Stop Listeneing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// StopListening method
|
||||||
|
/// </summary>
|
||||||
public void StopListening()
|
public void StopListening()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -478,6 +511,9 @@ namespace PepperDash.Core
|
||||||
/// Disconnects Client
|
/// Disconnects Client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// DisconnectClient method
|
||||||
|
/// </summary>
|
||||||
public void DisconnectClient(uint client)
|
public void DisconnectClient(uint client)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -493,6 +529,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect All Clients
|
/// Disconnect All Clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// DisconnectAllClientsForShutdown method
|
||||||
|
/// </summary>
|
||||||
public void DisconnectAllClientsForShutdown()
|
public void DisconnectAllClientsForShutdown()
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Disconnecting All Clients");
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Disconnecting All Clients");
|
||||||
|
|
@ -533,6 +572,9 @@ namespace PepperDash.Core
|
||||||
/// Broadcast text from server to all connected clients
|
/// Broadcast text from server to all connected clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// BroadcastText method
|
||||||
|
/// </summary>
|
||||||
public void BroadcastText(string text)
|
public void BroadcastText(string text)
|
||||||
{
|
{
|
||||||
CCriticalSection CCBroadcast = new CCriticalSection();
|
CCriticalSection CCBroadcast = new CCriticalSection();
|
||||||
|
|
@ -566,6 +608,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendTextToClient method
|
||||||
|
/// </summary>
|
||||||
public void SendTextToClient(string text, uint clientIndex)
|
public void SendTextToClient(string text, uint clientIndex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -634,6 +679,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetClientIPAddress method
|
||||||
|
/// </summary>
|
||||||
public string GetClientIPAddress(uint clientIndex)
|
public string GetClientIPAddress(uint clientIndex)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Address of server
|
/// Address of server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Hostname
|
||||||
|
/// </summary>
|
||||||
public string Hostname { get; set; }
|
public string Hostname { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -54,11 +57,17 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Username for server
|
/// Username for server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Username
|
||||||
|
/// </summary>
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// And... Password for server. That was worth documenting!
|
/// And... Password for server. That was worth documenting!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Password
|
||||||
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -126,6 +135,9 @@ namespace PepperDash.Core
|
||||||
/// Millisecond value, determines the timeout period in between reconnect attempts.
|
/// Millisecond value, determines the timeout period in between reconnect attempts.
|
||||||
/// Set to 5000 by default
|
/// Set to 5000 by default
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutoReconnectIntervalMs
|
||||||
|
/// </summary>
|
||||||
public int AutoReconnectIntervalMs { get; set; }
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
SshClient Client;
|
SshClient Client;
|
||||||
|
|
@ -200,6 +212,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect to the server, using the provided properties.
|
/// Connect to the server, using the provided properties.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
// Don't go unless everything is here
|
// Don't go unless everything is here
|
||||||
|
|
@ -327,6 +342,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect the clients and put away it's resources.
|
/// Disconnect the clients and put away it's resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
ConnectEnabled = false;
|
ConnectEnabled = false;
|
||||||
|
|
@ -476,6 +494,9 @@ namespace PepperDash.Core
|
||||||
/// Sends text to the server
|
/// Sends text to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -513,6 +534,9 @@ namespace PepperDash.Core
|
||||||
/// Sends Bytes to the server
|
/// Sends Bytes to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -551,6 +575,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired when connection changes
|
/// Fired when connection changes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a SshConnectionChangeEventArgs
|
||||||
|
/// </summary>
|
||||||
public class SshConnectionChangeEventArgs : EventArgs
|
public class SshConnectionChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -561,16 +588,25 @@ public class SshConnectionChangeEventArgs : EventArgs
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connection Status represented as a ushort
|
/// Connection Status represented as a ushort
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the UIsConnected
|
||||||
|
/// </summary>
|
||||||
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
|
public ushort UIsConnected { get { return (ushort)(Client.IsConnected ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The client
|
/// The client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Client
|
||||||
|
/// </summary>
|
||||||
public GenericSshClient Client { get; private set; }
|
public GenericSshClient Client { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Socket Status as represented by
|
/// Socket Status as represented by
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Status
|
||||||
|
/// </summary>
|
||||||
public ushort Status { get { return Client.UStatus; } }
|
public ushort Status { get { return Client.UStatus; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port on server
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Port
|
||||||
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -138,6 +141,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// bool to track if auto reconnect should be set on the socket
|
/// bool to track if auto reconnect should be set on the socket
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutoReconnect
|
||||||
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -234,6 +240,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just to help S+ set the key
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -255,6 +264,9 @@ namespace PepperDash.Core
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// Deactivate method
|
||||||
|
/// </summary>
|
||||||
public override bool Deactivate()
|
public override bool Deactivate()
|
||||||
{
|
{
|
||||||
RetryTimer.Stop();
|
RetryTimer.Stop();
|
||||||
|
|
@ -270,6 +282,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to connect to the server
|
/// Attempts to connect to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Hostname))
|
if (string.IsNullOrEmpty(Hostname))
|
||||||
|
|
@ -337,6 +352,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to disconnect the client
|
/// Attempts to disconnect the client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -357,6 +375,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does the actual disconnect business
|
/// Does the actual disconnect business
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// DisconnectClient method
|
||||||
|
/// </summary>
|
||||||
public void DisconnectClient()
|
public void DisconnectClient()
|
||||||
{
|
{
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
|
|
@ -449,6 +470,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General send method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
|
@ -462,6 +486,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is useful from console and...?
|
/// This is useful from console and...?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendEscapedText method
|
||||||
|
/// </summary>
|
||||||
public void SendEscapedText(string text)
|
public void SendEscapedText(string text)
|
||||||
{
|
{
|
||||||
var unescapedText = Regex.Replace(text, @"\\x([0-9a-fA-F][0-9a-fA-F])", s =>
|
var unescapedText = Regex.Replace(text, @"\\x([0-9a-fA-F][0-9a-fA-F])", s =>
|
||||||
|
|
@ -476,6 +503,9 @@ namespace PepperDash.Core
|
||||||
/// Sends Bytes to the server
|
/// Sends Bytes to the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
|
@ -511,6 +541,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configuration properties for TCP/SSH Connections
|
/// Configuration properties for TCP/SSH Connections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a TcpSshPropertiesConfig
|
||||||
|
/// </summary>
|
||||||
public class TcpSshPropertiesConfig
|
public class TcpSshPropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -532,6 +565,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Passord credential
|
/// Passord credential
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Password
|
||||||
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -542,11 +578,17 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to true
|
/// Defaults to true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutoReconnect
|
||||||
|
/// </summary>
|
||||||
public bool AutoReconnect { get; set; }
|
public bool AutoReconnect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 5000ms
|
/// Defaults to 5000ms
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the AutoReconnectIntervalMs
|
||||||
|
/// </summary>
|
||||||
public int AutoReconnectIntervalMs { get; set; }
|
public int AutoReconnectIntervalMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port on server
|
/// Port on server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Port
|
||||||
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -104,6 +107,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SharedKey
|
||||||
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -114,6 +120,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 2000
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the BufferSize
|
||||||
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -291,6 +300,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just to help S+ set the key
|
/// Just to help S+ set the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -313,6 +325,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
/// Connect Method. Will return if already connected. Will write errors if missing address, port, or unique key/name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
ConnectionCount++;
|
ConnectionCount++;
|
||||||
|
|
@ -444,6 +459,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
this.LogVerbose("Disconnect Called");
|
this.LogVerbose("Disconnect Called");
|
||||||
|
|
@ -671,6 +689,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// General send method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(text))
|
if (!string.IsNullOrEmpty(text))
|
||||||
|
|
@ -700,6 +721,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (bytes.Length > 0)
|
if (bytes.Length > 0)
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Delegate for ServerHasChokedCallbackDelegate
|
||||||
|
/// </summary>
|
||||||
public delegate void ServerHasChokedCallbackDelegate();
|
public delegate void ServerHasChokedCallbackDelegate();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -84,6 +87,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 3 by default
|
/// 3 by default
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the MonitorClientMaxFailureCount
|
||||||
|
/// </summary>
|
||||||
public int MonitorClientMaxFailureCount { get; set; }
|
public int MonitorClientMaxFailureCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -173,6 +179,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Port Server should listen on
|
/// Port Server should listen on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Port
|
||||||
|
/// </summary>
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -207,6 +216,9 @@ namespace PepperDash.Core
|
||||||
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
|
/// SharedKey is sent for varification to the server. Shared key can be any text (255 char limit in SIMPL+ Module), but must match the Shared Key on the Server module.
|
||||||
/// If SharedKey changes while server is listening or clients are connected, disconnect and stop listening will be called
|
/// If SharedKey changes while server is listening or clients are connected, disconnect and stop listening will be called
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SharedKey
|
||||||
|
/// </summary>
|
||||||
public string SharedKey { get; set; }
|
public string SharedKey { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -231,6 +243,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
/// Milliseconds before server expects another heartbeat. Set by property HeartbeatRequiredIntervalInSeconds which is driven from S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the HeartbeatRequiredIntervalMs
|
||||||
|
/// </summary>
|
||||||
public int HeartbeatRequiredIntervalMs { get; set; }
|
public int HeartbeatRequiredIntervalMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -241,6 +256,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
/// String to Match for heartbeat. If null or empty any string will reset heartbeat timer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the HeartbeatStringToMatch
|
||||||
|
/// </summary>
|
||||||
public string HeartbeatStringToMatch { get; set; }
|
public string HeartbeatStringToMatch { get; set; }
|
||||||
|
|
||||||
//private timers for Heartbeats per client
|
//private timers for Heartbeats per client
|
||||||
|
|
@ -259,6 +277,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to 2000
|
/// Defaults to 2000
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the BufferSize
|
||||||
|
/// </summary>
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -322,6 +343,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnects all clients and stops the server
|
/// Disconnects all clients and stops the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// KillServer method
|
||||||
|
/// </summary>
|
||||||
public void KillServer()
|
public void KillServer()
|
||||||
{
|
{
|
||||||
ServerStopped = true;
|
ServerStopped = true;
|
||||||
|
|
@ -337,6 +361,9 @@ namespace PepperDash.Core
|
||||||
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
/// Initialize Key for device using client name from SIMPL+. Called on Listen from SIMPL+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key)
|
public void Initialize(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -377,6 +404,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start listening on the specified port
|
/// Start listening on the specified port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Listen method
|
||||||
|
/// </summary>
|
||||||
public void Listen()
|
public void Listen()
|
||||||
{
|
{
|
||||||
ServerCCSection.Enter();
|
ServerCCSection.Enter();
|
||||||
|
|
@ -434,6 +464,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop Listening
|
/// Stop Listening
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// StopListening method
|
||||||
|
/// </summary>
|
||||||
public void StopListening()
|
public void StopListening()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -457,6 +490,9 @@ namespace PepperDash.Core
|
||||||
/// Disconnects Client
|
/// Disconnects Client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// DisconnectClient method
|
||||||
|
/// </summary>
|
||||||
public void DisconnectClient(uint client)
|
public void DisconnectClient(uint client)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -472,6 +508,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disconnect All Clients
|
/// Disconnect All Clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// DisconnectAllClientsForShutdown method
|
||||||
|
/// </summary>
|
||||||
public void DisconnectAllClientsForShutdown()
|
public void DisconnectAllClientsForShutdown()
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Disconnecting All Clients");
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Disconnecting All Clients");
|
||||||
|
|
@ -512,6 +551,9 @@ namespace PepperDash.Core
|
||||||
/// Broadcast text from server to all connected clients
|
/// Broadcast text from server to all connected clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// BroadcastText method
|
||||||
|
/// </summary>
|
||||||
public void BroadcastText(string text)
|
public void BroadcastText(string text)
|
||||||
{
|
{
|
||||||
CCriticalSection CCBroadcast = new CCriticalSection();
|
CCriticalSection CCBroadcast = new CCriticalSection();
|
||||||
|
|
@ -545,6 +587,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendTextToClient method
|
||||||
|
/// </summary>
|
||||||
public void SendTextToClient(string text, uint clientIndex)
|
public void SendTextToClient(string text, uint clientIndex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -613,6 +658,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="clientIndex"></param>
|
/// <param name="clientIndex"></param>
|
||||||
/// <returns>IP address of the client</returns>
|
/// <returns>IP address of the client</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetClientIPAddress method
|
||||||
|
/// </summary>
|
||||||
public string GetClientIPAddress(uint clientIndex)
|
public string GetClientIPAddress(uint clientIndex)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "GetClientIPAddress Index: {0}", clientIndex);
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,9 @@ namespace PepperDash.Core
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="address"></param>
|
/// <param name="address"></param>
|
||||||
/// <param name="port"></param>
|
/// <param name="port"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key, string address, ushort port)
|
public void Initialize(string key, string address, ushort port)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -187,6 +190,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables the UDP Server
|
/// Enables the UDP Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Connect method
|
||||||
|
/// </summary>
|
||||||
public void Connect()
|
public void Connect()
|
||||||
{
|
{
|
||||||
if (Server == null)
|
if (Server == null)
|
||||||
|
|
@ -224,6 +230,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disabled the UDP Server
|
/// Disabled the UDP Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Disconnect method
|
||||||
|
/// </summary>
|
||||||
public void Disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
if(Server != null)
|
if(Server != null)
|
||||||
|
|
@ -292,6 +301,9 @@ namespace PepperDash.Core
|
||||||
/// General send method
|
/// General send method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendText method
|
||||||
|
/// </summary>
|
||||||
public void SendText(string text)
|
public void SendText(string text)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
|
@ -309,6 +321,9 @@ namespace PepperDash.Core
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bytes"></param>
|
/// <param name="bytes"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendBytes method
|
||||||
|
/// </summary>
|
||||||
public void SendBytes(byte[] bytes)
|
public void SendBytes(byte[] bytes)
|
||||||
{
|
{
|
||||||
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
if (StreamDebugging.TxStreamDebuggingIsEnabled)
|
||||||
|
|
@ -323,6 +338,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a GenericUdpReceiveTextExtraArgs
|
||||||
|
/// </summary>
|
||||||
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
public class GenericUdpReceiveTextExtraArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Client config object for TCP client with server that inherits from TcpSshPropertiesConfig and adds properties for shared key and heartbeat
|
/// Client config object for TCP client with server that inherits from TcpSshPropertiesConfig and adds properties for shared key and heartbeat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a TcpClientConfigObject
|
||||||
|
/// </summary>
|
||||||
public class TcpClientConfigObject
|
public class TcpClientConfigObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a device that uses basic connection
|
/// Represents a device that uses basic connection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the contract for IBasicCommunication
|
||||||
|
/// </summary>
|
||||||
public interface IBasicCommunication : ICommunicationReceiver
|
public interface IBasicCommunication : ICommunicationReceiver
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -150,6 +153,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Bytes
|
||||||
|
/// </summary>
|
||||||
public byte[] Bytes { get; private set; }
|
public byte[] Bytes { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -228,6 +234,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetEscapedText method
|
||||||
|
/// </summary>
|
||||||
public static string GetEscapedText(string text)
|
public static string GetEscapedText(string text)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
var bytes = Encoding.GetEncoding(28591).GetBytes(text);
|
||||||
|
|
@ -239,6 +248,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetDebugText method
|
||||||
|
/// </summary>
|
||||||
public static string GetDebugText(string text)
|
public static string GetDebugText(string text)
|
||||||
{
|
{
|
||||||
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
return Regex.Replace(text, @"[^\u0020-\u007E]", a => GetEscapedText(a.Value));
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,9 @@ namespace PepperDash.Core.Config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="doubleConfig"></param>
|
/// <param name="doubleConfig"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// MergeConfigs method
|
||||||
|
/// </summary>
|
||||||
public static JObject MergeConfigs(JObject doubleConfig)
|
public static JObject MergeConfigs(JObject doubleConfig)
|
||||||
{
|
{
|
||||||
var system = JObject.FromObject(doubleConfig["system"]);
|
var system = JObject.FromObject(doubleConfig["system"]);
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,22 @@ using Crestron.SimplSharp;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a EncodingHelper
|
||||||
|
/// </summary>
|
||||||
public class EncodingHelper
|
public class EncodingHelper
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ConvertUtf8ToAscii method
|
||||||
|
/// </summary>
|
||||||
public static string ConvertUtf8ToAscii(string utf8String)
|
public static string ConvertUtf8ToAscii(string utf8String)
|
||||||
{
|
{
|
||||||
return Encoding.ASCII.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
return Encoding.ASCII.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ConvertUtf8ToUtf16 method
|
||||||
|
/// </summary>
|
||||||
public static string ConvertUtf8ToUtf16(string utf8String)
|
public static string ConvertUtf8ToUtf16(string utf8String)
|
||||||
{
|
{
|
||||||
return Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
return Encoding.Unicode.GetString(Encoding.UTF8.GetBytes(utf8String), 0, utf8String.Length);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The core event and status-bearing class that most if not all device and connectors can derive from.
|
/// The core event and status-bearing class that most if not all device and connectors can derive from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a Device
|
||||||
|
/// </summary>
|
||||||
public class Device : IKeyName
|
public class Device : IKeyName
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -18,6 +21,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name of the devie
|
/// Name of the devie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Name
|
||||||
|
/// </summary>
|
||||||
public string Name { get; protected set; }
|
public string Name { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
@ -86,6 +92,9 @@ namespace PepperDash.Core
|
||||||
/// Adds a post activation action
|
/// Adds a post activation action
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="act"></param>
|
/// <param name="act"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// AddPostActivationAction method
|
||||||
|
/// </summary>
|
||||||
public void AddPostActivationAction(Action act)
|
public void AddPostActivationAction(Action act)
|
||||||
{
|
{
|
||||||
if (_PostActivationActions == null)
|
if (_PostActivationActions == null)
|
||||||
|
|
@ -96,6 +105,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes the preactivation actions
|
/// Executes the preactivation actions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// PreActivate method
|
||||||
|
/// </summary>
|
||||||
public void PreActivate()
|
public void PreActivate()
|
||||||
{
|
{
|
||||||
if (_PreActivationActions != null)
|
if (_PreActivationActions != null)
|
||||||
|
|
@ -117,6 +129,9 @@ namespace PepperDash.Core
|
||||||
/// all post-activation at end. Classes needing additional logic to
|
/// all post-activation at end. Classes needing additional logic to
|
||||||
/// run should override CustomActivate()
|
/// run should override CustomActivate()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Activate method
|
||||||
|
/// </summary>
|
||||||
public bool Activate()
|
public bool Activate()
|
||||||
{
|
{
|
||||||
//if (_PreActivationActions != null)
|
//if (_PreActivationActions != null)
|
||||||
|
|
@ -130,6 +145,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes the postactivation actions
|
/// Executes the postactivation actions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// PostActivate method
|
||||||
|
/// </summary>
|
||||||
public void PostActivate()
|
public void PostActivate()
|
||||||
{
|
{
|
||||||
if (_PostActivationActions != null)
|
if (_PostActivationActions != null)
|
||||||
|
|
@ -152,6 +170,9 @@ namespace PepperDash.Core
|
||||||
/// do not need to call base.CustomActivate()
|
/// do not need to call base.CustomActivate()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>true if device activated successfully.</returns>
|
/// <returns>true if device activated successfully.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// CustomActivate method
|
||||||
|
/// </summary>
|
||||||
public virtual bool CustomActivate() { return true; }
|
public virtual bool CustomActivate() { return true; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -184,6 +205,9 @@ namespace PepperDash.Core
|
||||||
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
|
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
|
||||||
/// null or empty, "---" is used in place of the name.</remarks>
|
/// null or empty, "---" is used in place of the name.</remarks>
|
||||||
/// <returns>A string that represents the object, containing the key and name in the format "{Key} - {Name}".</returns>
|
/// <returns>A string that represents the object, containing the key and name in the format "{Key} - {Name}".</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ToString method
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);
|
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class to help with accessing values from the CrestronEthernetHelper class
|
/// Class to help with accessing values from the CrestronEthernetHelper class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a EthernetHelper
|
||||||
|
/// </summary>
|
||||||
public class EthernetHelper
|
public class EthernetHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -27,6 +30,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PortNumber
|
||||||
|
/// </summary>
|
||||||
public int PortNumber { get; private set; }
|
public int PortNumber { get; private set; }
|
||||||
|
|
||||||
private EthernetHelper(int portNumber)
|
private EthernetHelper(int portNumber)
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,25 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Boolean ushort value property
|
/// Boolean ushort value property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IntValue
|
||||||
|
/// </summary>
|
||||||
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
|
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Boolean change event args type
|
/// Boolean change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Type
|
||||||
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Boolean change event args index
|
/// Boolean change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Index
|
||||||
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -67,6 +76,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ushort change event args
|
/// Ushort change event args
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a UshrtChangeEventArgs
|
||||||
|
/// </summary>
|
||||||
public class UshrtChangeEventArgs : EventArgs
|
public class UshrtChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -77,11 +89,17 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ushort change event args type
|
/// Ushort change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Type
|
||||||
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ushort change event args index
|
/// Ushort change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Index
|
||||||
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -120,6 +138,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String change event args
|
/// String change event args
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a StringChangeEventArgs
|
||||||
|
/// </summary>
|
||||||
public class StringChangeEventArgs : EventArgs
|
public class StringChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -130,11 +151,17 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String change event args type
|
/// String change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Type
|
||||||
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// string change event args index
|
/// string change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Index
|
||||||
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,17 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Device change event args type
|
/// Device change event args type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Type
|
||||||
|
/// </summary>
|
||||||
public ushort Type { get; set; }
|
public ushort Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Device change event args index
|
/// Device change event args index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Index
|
||||||
|
/// </summary>
|
||||||
public ushort Index { get; set; }
|
public ushort Index { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uniqueID"></param>
|
/// <param name="uniqueID"></param>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string uniqueID, string deviceKey)
|
public void Initialize(string uniqueID, string deviceKey)
|
||||||
{
|
{
|
||||||
// S+ set EvaluateFb low
|
// S+ set EvaluateFb low
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,17 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Device communication parameter class
|
/// Device communication parameter class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ComParamsConfig
|
||||||
|
/// </summary>
|
||||||
public class ComParamsConfig
|
public class ComParamsConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the baudRate
|
||||||
|
/// </summary>
|
||||||
public int baudRate { get; set; }
|
public int baudRate { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
@ -89,10 +95,16 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the simplBaudRate
|
||||||
|
/// </summary>
|
||||||
public ushort simplBaudRate { get { return Convert.ToUInt16(baudRate); } }
|
public ushort simplBaudRate { get { return Convert.ToUInt16(baudRate); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the simplDataBits
|
||||||
|
/// </summary>
|
||||||
public ushort simplDataBits { get { return Convert.ToUInt16(dataBits); } }
|
public ushort simplDataBits { get { return Convert.ToUInt16(dataBits); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
@ -146,10 +158,16 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the simplPort
|
||||||
|
/// </summary>
|
||||||
public ushort simplPort { get { return Convert.ToUInt16(port); } }
|
public ushort simplPort { get { return Convert.ToUInt16(port); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the simplAutoReconnect
|
||||||
|
/// </summary>
|
||||||
public ushort simplAutoReconnect { get { return (ushort)(autoReconnect ? 1 : 0); } }
|
public ushort simplAutoReconnect { get { return (ushort)(autoReconnect ? 1 : 0); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
@ -195,6 +213,9 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the simplControlPortNumber
|
||||||
|
/// </summary>
|
||||||
public ushort simplControlPortNumber { get { return Convert.ToUInt16(controlPortNumber); } }
|
public ushort simplControlPortNumber { get { return Convert.ToUInt16(controlPortNumber); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -210,6 +231,9 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Device properties class
|
/// Device properties class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a PropertiesConfig
|
||||||
|
/// </summary>
|
||||||
public class PropertiesConfig
|
public class PropertiesConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -229,10 +253,16 @@ namespace PepperDash.Core.JsonStandardObjects
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the simplDeviceId
|
||||||
|
/// </summary>
|
||||||
public ushort simplDeviceId { get { return Convert.ToUInt16(deviceId); } }
|
public ushort simplDeviceId { get { return Convert.ToUInt16(deviceId); } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the simplEnabled
|
||||||
|
/// </summary>
|
||||||
public ushort simplEnabled { get { return (ushort)(enabled ? 1 : 0); } }
|
public ushort simplEnabled { get { return (ushort)(enabled ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ValueType
|
||||||
|
/// </summary>
|
||||||
public SPlusType ValueType { get; private set; }
|
public SPlusType ValueType { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
@ -125,6 +128,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ types enum
|
/// S+ types enum
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Enumeration of SPlusType values
|
||||||
|
/// </summary>
|
||||||
public enum SPlusType
|
public enum SPlusType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="master">New master to add</param>
|
/// <param name="master">New master to add</param>
|
||||||
///
|
///
|
||||||
|
/// <summary>
|
||||||
|
/// AddMaster method
|
||||||
|
/// </summary>
|
||||||
public static void AddMaster(JsonToSimplMaster master)
|
public static void AddMaster(JsonToSimplMaster master)
|
||||||
{
|
{
|
||||||
if (master == null)
|
if (master == null)
|
||||||
|
|
@ -52,6 +55,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a master by its key. Case-insensitive
|
/// Gets a master by its key. Case-insensitive
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// GetMasterByFile method
|
||||||
|
/// </summary>
|
||||||
public static JsonToSimplMaster GetMasterByFile(string file)
|
public static JsonToSimplMaster GetMasterByFile(string file)
|
||||||
{
|
{
|
||||||
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));
|
return Masters.FirstOrDefault(m => m.UniqueID.Equals(file, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to interact with an array of values with the S+ modules
|
/// Used to interact with an array of values with the S+ modules
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a JsonToSimplArrayLookupChild
|
||||||
|
/// </summary>
|
||||||
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
public class JsonToSimplArrayLookupChild : JsonToSimplChildObjectBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -79,6 +82,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process all values
|
/// Process all values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// ProcessAll method
|
||||||
|
/// </summary>
|
||||||
public override void ProcessAll()
|
public override void ProcessAll()
|
||||||
{
|
{
|
||||||
if (FindInArray())
|
if (FindInArray())
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,17 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use a callback to reduce task switch/threading
|
/// Use a callback to reduce task switch/threading
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SetAllPathsDelegate
|
||||||
|
/// </summary>
|
||||||
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
public SPlusValuesDelegate SetAllPathsDelegate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique identifier for instance
|
/// Unique identifier for instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Key
|
||||||
|
/// </summary>
|
||||||
public string Key { get; protected set; }
|
public string Key { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -52,6 +58,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if the instance is linked to an object
|
/// Indicates if the instance is linked to an object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the LinkedToObject
|
||||||
|
/// </summary>
|
||||||
public bool LinkedToObject { get; protected set; }
|
public bool LinkedToObject { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -96,6 +105,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// Sets the path prefix for the object
|
/// Sets the path prefix for the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pathPrefix"></param>
|
/// <param name="pathPrefix"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetPathPrefix method
|
||||||
|
/// </summary>
|
||||||
public void SetPathPrefix(string pathPrefix)
|
public void SetPathPrefix(string pathPrefix)
|
||||||
{
|
{
|
||||||
PathPrefix = pathPrefix;
|
PathPrefix = pathPrefix;
|
||||||
|
|
@ -113,6 +125,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the JPath for a ushort out index.
|
/// Set the JPath for a ushort out index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SetUshortPath method
|
||||||
|
/// </summary>
|
||||||
public void SetUshortPath(ushort index, string path)
|
public void SetUshortPath(ushort index, string path)
|
||||||
{
|
{
|
||||||
Debug.Console(1, "JSON Child[{0}] SetUshortPath {1}={2}", Key, index, path);
|
Debug.Console(1, "JSON Child[{0}] SetUshortPath {1}={2}", Key, index, path);
|
||||||
|
|
@ -123,6 +138,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the JPath for a string output index.
|
/// Set the JPath for a string output index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// SetStringPath method
|
||||||
|
/// </summary>
|
||||||
public void SetStringPath(ushort index, string path)
|
public void SetStringPath(ushort index, string path)
|
||||||
{
|
{
|
||||||
Debug.Console(1, "JSON Child[{0}] SetStringPath {1}={2}", Key, index, path);
|
Debug.Console(1, "JSON Child[{0}] SetStringPath {1}={2}", Key, index, path);
|
||||||
|
|
@ -134,6 +152,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// Evalutates all outputs with defined paths. called by S+ when paths are ready to process
|
/// Evalutates all outputs with defined paths. called by S+ when paths are ready to process
|
||||||
/// and by Master when file is read.
|
/// and by Master when file is read.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// ProcessAll method
|
||||||
|
/// </summary>
|
||||||
public virtual void ProcessAll()
|
public virtual void ProcessAll()
|
||||||
{
|
{
|
||||||
if (!LinkedToObject)
|
if (!LinkedToObject)
|
||||||
|
|
@ -277,6 +298,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// USetBoolValue method
|
||||||
|
/// </summary>
|
||||||
public void USetBoolValue(ushort key, ushort theValue)
|
public void USetBoolValue(ushort key, ushort theValue)
|
||||||
{
|
{
|
||||||
SetBoolValue(key, theValue == 1);
|
SetBoolValue(key, theValue == 1);
|
||||||
|
|
@ -287,6 +311,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetBoolValue method
|
||||||
|
/// </summary>
|
||||||
public void SetBoolValue(ushort key, bool theValue)
|
public void SetBoolValue(ushort key, bool theValue)
|
||||||
{
|
{
|
||||||
if (BoolPaths.ContainsKey(key))
|
if (BoolPaths.ContainsKey(key))
|
||||||
|
|
@ -298,6 +325,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetUShortValue method
|
||||||
|
/// </summary>
|
||||||
public void SetUShortValue(ushort key, ushort theValue)
|
public void SetUShortValue(ushort key, ushort theValue)
|
||||||
{
|
{
|
||||||
if (UshortPaths.ContainsKey(key))
|
if (UshortPaths.ContainsKey(key))
|
||||||
|
|
@ -309,6 +339,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="theValue"></param>
|
/// <param name="theValue"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetStringValue method
|
||||||
|
/// </summary>
|
||||||
public void SetStringValue(ushort key, string theValue)
|
public void SetStringValue(ushort key, string theValue)
|
||||||
{
|
{
|
||||||
if (StringPaths.ContainsKey(key))
|
if (StringPaths.ContainsKey(key))
|
||||||
|
|
@ -320,6 +353,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="keyPath"></param>
|
/// <param name="keyPath"></param>
|
||||||
/// <param name="valueToSave"></param>
|
/// <param name="valueToSave"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetValueOnMaster method
|
||||||
|
/// </summary>
|
||||||
public void SetValueOnMaster(string keyPath, JValue valueToSave)
|
public void SetValueOnMaster(string keyPath, JValue valueToSave)
|
||||||
{
|
{
|
||||||
var path = GetFullPath(keyPath);
|
var path = GetFullPath(keyPath);
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,17 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Filepath to the actual file that will be read (Portal or local)
|
/// Filepath to the actual file that will be read (Portal or local)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ActualFilePath
|
||||||
|
/// </summary>
|
||||||
public string ActualFilePath { get; private set; }
|
public string ActualFilePath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Filename
|
||||||
|
/// </summary>
|
||||||
public string Filename { get; private set; }
|
public string Filename { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
@ -194,6 +200,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// Sets the debug level
|
/// Sets the debug level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// setDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public void setDebugLevel(uint level)
|
public void setDebugLevel(uint level)
|
||||||
{
|
{
|
||||||
Debug.SetDebugLevel(level);
|
Debug.SetDebugLevel(level);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a JsonToSimplFixedPathObject
|
||||||
|
/// </summary>
|
||||||
public class JsonToSimplFixedPathObject : JsonToSimplChildObjectBase
|
public class JsonToSimplFixedPathObject : JsonToSimplChildObjectBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generic Master
|
/// Generic Master
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a JsonToSimplGenericMaster
|
||||||
|
/// </summary>
|
||||||
public class JsonToSimplGenericMaster : JsonToSimplMaster
|
public class JsonToSimplGenericMaster : JsonToSimplMaster
|
||||||
{
|
{
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
@ -23,6 +26,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback action for saving
|
/// Callback action for saving
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the SaveCallback
|
||||||
|
/// </summary>
|
||||||
public Action<string> SaveCallback { get; set; }
|
public Action<string> SaveCallback { get; set; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
@ -60,6 +66,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// Loads JSON into JsonObject, but does not trigger evaluation by children
|
/// Loads JSON into JsonObject, but does not trigger evaluation by children
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="json"></param>
|
/// <param name="json"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetJsonWithoutEvaluating method
|
||||||
|
/// </summary>
|
||||||
public void SetJsonWithoutEvaluating(string json)
|
public void SetJsonWithoutEvaluating(string json)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -75,6 +84,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Save method
|
||||||
|
/// </summary>
|
||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
// this code is duplicated in the other masters!!!!!!!!!!!!!
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A unique ID
|
/// A unique ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the UniqueID
|
||||||
|
/// </summary>
|
||||||
public string UniqueID { get; protected set; }
|
public string UniqueID { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -57,6 +60,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// This will be prepended to all paths to allow path swapping or for more organized
|
/// This will be prepended to all paths to allow path swapping or for more organized
|
||||||
/// sub-paths
|
/// sub-paths
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PathPrefix
|
||||||
|
/// </summary>
|
||||||
public string PathPrefix { get; set; }
|
public string PathPrefix { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -86,6 +92,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the JsonObject
|
||||||
|
/// </summary>
|
||||||
public JObject JsonObject { get; protected set; }
|
public JObject JsonObject { get; protected set; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
@ -120,6 +129,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// Adds a child "module" to this master
|
/// Adds a child "module" to this master
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="child"></param>
|
/// <param name="child"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// AddChild method
|
||||||
|
/// </summary>
|
||||||
public void AddChild(JsonToSimplChildObjectBase child)
|
public void AddChild(JsonToSimplChildObjectBase child)
|
||||||
{
|
{
|
||||||
if (!Children.Contains(child))
|
if (!Children.Contains(child))
|
||||||
|
|
@ -131,6 +143,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called from the child to add changed or new values for saving
|
/// Called from the child to add changed or new values for saving
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// AddUnsavedValue method
|
||||||
|
/// </summary>
|
||||||
public void AddUnsavedValue(string path, JValue value)
|
public void AddUnsavedValue(string path, JValue value)
|
||||||
{
|
{
|
||||||
if (UnsavedValues.ContainsKey(path))
|
if (UnsavedValues.ContainsKey(path))
|
||||||
|
|
@ -179,6 +194,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="json"></param>
|
/// <param name="json"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ParseArray method
|
||||||
|
/// </summary>
|
||||||
public static JArray ParseArray(string json)
|
public static JArray ParseArray(string json)
|
||||||
{
|
{
|
||||||
#if NET6_0
|
#if NET6_0
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// File path of the actual file being read (Portal or local)
|
/// File path of the actual file being read (Portal or local)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ActualFilePath
|
||||||
|
/// </summary>
|
||||||
public string ActualFilePath { get; private set; }
|
public string ActualFilePath { get; private set; }
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
@ -128,6 +131,9 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// setDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public void setDebugLevel(uint level)
|
public void setDebugLevel(uint level)
|
||||||
{
|
{
|
||||||
Debug.SetDebugLevel(level);
|
Debug.SetDebugLevel(level);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a CrestronEnricher
|
||||||
|
/// </summary>
|
||||||
public class CrestronEnricher : ILogEventEnricher
|
public class CrestronEnricher : ILogEventEnricher
|
||||||
{
|
{
|
||||||
static readonly string _appName;
|
static readonly string _appName;
|
||||||
|
|
@ -27,6 +30,9 @@ namespace PepperDash.Core.Logging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich method
|
||||||
|
/// </summary>
|
||||||
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
||||||
{
|
{
|
||||||
var property = propertyFactory.CreateProperty("App", _appName);
|
var property = propertyFactory.CreateProperty("App", _appName);
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,17 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Debug level to set for a given program.
|
/// Debug level to set for a given program.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Level
|
||||||
|
/// </summary>
|
||||||
public static int Level { get; private set; }
|
public static int Level { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When this is true, the configuration file will NOT be loaded until triggered by either a console command or a signal
|
/// When this is true, the configuration file will NOT be loaded until triggered by either a console command or a signal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the DoNotLoadConfigOnNextBoot
|
||||||
|
/// </summary>
|
||||||
public static bool DoNotLoadConfigOnNextBoot { get; private set; }
|
public static bool DoNotLoadConfigOnNextBoot { get; private set; }
|
||||||
|
|
||||||
private static DebugContextCollection _contexts;
|
private static DebugContextCollection _contexts;
|
||||||
|
|
@ -96,6 +102,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version for the currently loaded PepperDashCore dll
|
/// Version for the currently loaded PepperDashCore dll
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PepperDashCoreVersion
|
||||||
|
/// </summary>
|
||||||
public static string PepperDashCoreVersion { get; private set; }
|
public static string PepperDashCoreVersion { get; private set; }
|
||||||
|
|
||||||
private static CTimer _saveTimer;
|
private static CTimer _saveTimer;
|
||||||
|
|
@ -233,6 +242,9 @@ namespace PepperDash.Core
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UpdateLoggerConfiguration method
|
||||||
|
/// </summary>
|
||||||
public static void UpdateLoggerConfiguration(LoggerConfiguration config)
|
public static void UpdateLoggerConfiguration(LoggerConfiguration config)
|
||||||
{
|
{
|
||||||
_loggerConfiguration = config;
|
_loggerConfiguration = config;
|
||||||
|
|
@ -240,6 +252,9 @@ namespace PepperDash.Core
|
||||||
_logger = config.CreateLogger();
|
_logger = config.CreateLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ResetLoggerConfiguration method
|
||||||
|
/// </summary>
|
||||||
public static void ResetLoggerConfiguration()
|
public static void ResetLoggerConfiguration()
|
||||||
{
|
{
|
||||||
_loggerConfiguration = _defaultLoggerConfiguration;
|
_loggerConfiguration = _defaultLoggerConfiguration;
|
||||||
|
|
@ -319,6 +334,9 @@ namespace PepperDash.Core
|
||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="levelString"></param>
|
/// <param name="levelString"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugFromConsole method
|
||||||
|
/// </summary>
|
||||||
public static void SetDebugFromConsole(string levelString)
|
public static void SetDebugFromConsole(string levelString)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -371,6 +389,9 @@ namespace PepperDash.Core
|
||||||
/// Sets the debug level
|
/// Sets the debug level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"> Valid values 0-5</param>
|
/// <param name="level"> Valid values 0-5</param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetDebugLevel(uint level)
|
public static void SetDebugLevel(uint level)
|
||||||
{
|
{
|
||||||
if(!_logLevels.TryGetValue(level, out var logLevel))
|
if(!_logLevels.TryGetValue(level, out var logLevel))
|
||||||
|
|
@ -385,6 +406,9 @@ namespace PepperDash.Core
|
||||||
SetDebugLevel(logLevel);
|
SetDebugLevel(logLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetDebugLevel(LogEventLevel level)
|
public static void SetDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_consoleLoggingLevelSwitch.MinimumLevel = level;
|
_consoleLoggingLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -402,6 +426,9 @@ namespace PepperDash.Core
|
||||||
CrestronConsole.PrintLine($"Error saving console debug level setting: {err}");
|
CrestronConsole.PrintLine($"Error saving console debug level setting: {err}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetWebSocketMinimumDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
|
public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_websocketLoggingLevelSwitch.MinimumLevel = level;
|
_websocketLoggingLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -414,6 +441,9 @@ namespace PepperDash.Core
|
||||||
LogMessage(LogEventLevel.Information, "Websocket debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
LogMessage(LogEventLevel.Information, "Websocket debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetErrorLogMinimumDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetErrorLogMinimumDebugLevel(LogEventLevel level)
|
public static void SetErrorLogMinimumDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_errorLogLevelSwitch.MinimumLevel = level;
|
_errorLogLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -426,6 +456,9 @@ namespace PepperDash.Core
|
||||||
LogMessage(LogEventLevel.Information, "Error log debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
LogMessage(LogEventLevel.Information, "Error log debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SetFileMinimumDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public static void SetFileMinimumDebugLevel(LogEventLevel level)
|
public static void SetFileMinimumDebugLevel(LogEventLevel level)
|
||||||
{
|
{
|
||||||
_errorLogLevelSwitch.MinimumLevel = level;
|
_errorLogLevelSwitch.MinimumLevel = level;
|
||||||
|
|
@ -442,6 +475,9 @@ namespace PepperDash.Core
|
||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stateString"></param>
|
/// <param name="stateString"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDoNotLoadOnNextBootFromConsole method
|
||||||
|
/// </summary>
|
||||||
public static void SetDoNotLoadOnNextBootFromConsole(string stateString)
|
public static void SetDoNotLoadOnNextBootFromConsole(string stateString)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -464,6 +500,9 @@ namespace PepperDash.Core
|
||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="items"></param>
|
/// <param name="items"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugFilterFromConsole method
|
||||||
|
/// </summary>
|
||||||
public static void SetDebugFilterFromConsole(string items)
|
public static void SetDebugFilterFromConsole(string items)
|
||||||
{
|
{
|
||||||
var str = items.Trim();
|
var str = items.Trim();
|
||||||
|
|
@ -559,6 +598,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetDeviceDebugSettingsForKey method
|
||||||
|
/// </summary>
|
||||||
public static object GetDeviceDebugSettingsForKey(string deviceKey)
|
public static object GetDeviceDebugSettingsForKey(string deviceKey)
|
||||||
{
|
{
|
||||||
return _contexts.GetDebugSettingsForKey(deviceKey);
|
return _contexts.GetDebugSettingsForKey(deviceKey);
|
||||||
|
|
@ -581,6 +623,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// ShowDebugLog method
|
||||||
|
/// </summary>
|
||||||
public static void ShowDebugLog(string s)
|
public static void ShowDebugLog(string s)
|
||||||
{
|
{
|
||||||
var loglist = CrestronLogger.PrintTheLog(s.ToLower() == "all");
|
var loglist = CrestronLogger.PrintTheLog(s.ToLower() == "all");
|
||||||
|
|
@ -595,6 +640,9 @@ namespace PepperDash.Core
|
||||||
/// <param name="message">Message template</param>
|
/// <param name="message">Message template</param>
|
||||||
/// <param name="device">Optional IKeyed device. If provided, the Key of the device will be added to the log message</param>
|
/// <param name="device">Optional IKeyed device. If provided, the Key of the device will be added to the log message</param>
|
||||||
/// <param name="args">Args to put into message template</param>
|
/// <param name="args">Args to put into message template</param>
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(Exception ex, string message, IKeyed device = null, params object[] args)
|
public static void LogMessage(Exception ex, string message, IKeyed device = null, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", device?.Key))
|
using (LogContext.PushProperty("Key", device?.Key))
|
||||||
|
|
@ -623,16 +671,25 @@ namespace PepperDash.Core
|
||||||
_logger.Write(level, message, args);
|
_logger.Write(level, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(LogEventLevel level, Exception ex, string message, params object[] args)
|
public static void LogMessage(LogEventLevel level, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(level, ex, message, args);
|
_logger.Write(level, ex, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(LogEventLevel level, IKeyed keyed, string message, params object[] args)
|
public static void LogMessage(LogEventLevel level, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
LogMessage(level, message, keyed, args);
|
LogMessage(level, message, keyed, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogMessage method
|
||||||
|
/// </summary>
|
||||||
public static void LogMessage(LogEventLevel level, Exception ex, IKeyed device, string message, params object[] args)
|
public static void LogMessage(LogEventLevel level, Exception ex, IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", device?.Key))
|
using (LogContext.PushProperty("Key", device?.Key))
|
||||||
|
|
@ -642,6 +699,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Explicit methods for logging levels
|
#region Explicit methods for logging levels
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
|
public static void LogVerbose(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using(LogContext.PushProperty("Key", keyed?.Key))
|
using(LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -650,6 +710,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(Exception ex, IKeyed keyed, string message, params object[] args)
|
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))
|
||||||
|
|
@ -658,16 +721,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(string message, params object[] args)
|
public static void LogVerbose(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Verbose, message, args);
|
_logger.Write(LogEventLevel.Verbose, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(Exception ex, string message, params object[] args)
|
public static void LogVerbose(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Verbose, ex, null, message, args);
|
_logger.Write(LogEventLevel.Verbose, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(IKeyed keyed, string message, params object[] args)
|
public static void LogDebug(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -676,6 +748,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogDebug(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -684,16 +759,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(string message, params object[] args)
|
public static void LogDebug(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Debug, message, args);
|
_logger.Write(LogEventLevel.Debug, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(Exception ex, string message, params object[] args)
|
public static void LogDebug(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Debug, ex, null, message, args);
|
_logger.Write(LogEventLevel.Debug, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(IKeyed keyed, string message, params object[] args)
|
public static void LogInformation(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -702,6 +786,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogInformation(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -710,16 +797,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(string message, params object[] args)
|
public static void LogInformation(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Information, message, args);
|
_logger.Write(LogEventLevel.Information, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(Exception ex, string message, params object[] args)
|
public static void LogInformation(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Information, ex, null, message, args);
|
_logger.Write(LogEventLevel.Information, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(IKeyed keyed, string message, params object[] args)
|
public static void LogWarning(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -728,6 +824,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogWarning(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -736,16 +835,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(string message, params object[] args)
|
public static void LogWarning(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Warning, message, args);
|
_logger.Write(LogEventLevel.Warning, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(Exception ex, string message, params object[] args)
|
public static void LogWarning(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Warning, ex, null, message, args);
|
_logger.Write(LogEventLevel.Warning, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(IKeyed keyed, string message, params object[] args)
|
public static void LogError(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -754,6 +862,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogError(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -762,16 +873,25 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(string message, params object[] args)
|
public static void LogError(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Error, message, args);
|
_logger.Write(LogEventLevel.Error, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(Exception ex, string message, params object[] args)
|
public static void LogError(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Error, ex, null, message, args);
|
_logger.Write(LogEventLevel.Error, ex, null, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(IKeyed keyed, string message, params object[] args)
|
public static void LogFatal(IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -780,6 +900,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(Exception ex, IKeyed keyed, string message, params object[] args)
|
public static void LogFatal(Exception ex, IKeyed keyed, string message, params object[] args)
|
||||||
{
|
{
|
||||||
using (LogContext.PushProperty("Key", keyed?.Key))
|
using (LogContext.PushProperty("Key", keyed?.Key))
|
||||||
|
|
@ -788,11 +911,17 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(string message, params object[] args)
|
public static void LogFatal(string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Fatal, message, args);
|
_logger.Write(LogEventLevel.Fatal, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(Exception ex, string message, params object[] args)
|
public static void LogFatal(Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
_logger.Write(LogEventLevel.Fatal, ex, null, message, args);
|
_logger.Write(LogEventLevel.Fatal, ex, null, message, args);
|
||||||
|
|
@ -869,6 +998,9 @@ namespace PepperDash.Core
|
||||||
/// Logs to Console when at-level, and all messages to error log
|
/// Logs to Console when at-level, and all messages to error log
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
||||||
|
/// <summary>
|
||||||
|
/// Console method
|
||||||
|
/// </summary>
|
||||||
public static void Console(uint level, ErrorLogLevel errorLogLevel,
|
public static void Console(uint level, ErrorLogLevel errorLogLevel,
|
||||||
string format, params object[] items)
|
string format, params object[] items)
|
||||||
{
|
{
|
||||||
|
|
@ -881,6 +1013,9 @@ namespace PepperDash.Core
|
||||||
/// it will only be written to the log.
|
/// it will only be written to the log.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
[Obsolete("Use LogMessage methods, Will be removed in 2.2.0 and later versions")]
|
||||||
|
/// <summary>
|
||||||
|
/// ConsoleWithLog method
|
||||||
|
/// </summary>
|
||||||
public static void ConsoleWithLog(uint level, string format, params object[] items)
|
public static void ConsoleWithLog(uint level, string format, params object[] items)
|
||||||
{
|
{
|
||||||
LogMessage(level, format, items);
|
LogMessage(level, format, items);
|
||||||
|
|
@ -1005,6 +1140,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Error level to for message to be logged at
|
/// Error level to for message to be logged at
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Enumeration of ErrorLogLevel values
|
||||||
|
/// </summary>
|
||||||
public enum ErrorLogLevel
|
public enum ErrorLogLevel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,16 @@ using System.Text;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DebugConsoleSink
|
||||||
|
/// </summary>
|
||||||
public class DebugConsoleSink : ILogEventSink
|
public class DebugConsoleSink : ILogEventSink
|
||||||
{
|
{
|
||||||
private readonly ITextFormatter _textFormatter;
|
private readonly ITextFormatter _textFormatter;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Emit method
|
||||||
|
/// </summary>
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
if (!Debug.IsRunningOnAppliance) return;
|
if (!Debug.IsRunningOnAppliance) return;
|
||||||
|
|
@ -44,6 +50,9 @@ namespace PepperDash.Core
|
||||||
|
|
||||||
public static class DebugConsoleSinkExtensions
|
public static class DebugConsoleSinkExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DebugConsoleSink method
|
||||||
|
/// </summary>
|
||||||
public static LoggerConfiguration DebugConsoleSink(
|
public static LoggerConfiguration DebugConsoleSink(
|
||||||
this LoggerSinkConfiguration loggerConfiguration,
|
this LoggerSinkConfiguration loggerConfiguration,
|
||||||
ITextFormatter formatProvider = null)
|
ITextFormatter formatProvider = null)
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetDebugContext method
|
||||||
|
/// </summary>
|
||||||
public static DebugContext GetDebugContext(string key)
|
public static DebugContext GetDebugContext(string key)
|
||||||
{
|
{
|
||||||
var context = Contexts.FirstOrDefault(c => c.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
var context = Contexts.FirstOrDefault(c => c.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
@ -92,6 +95,9 @@ namespace PepperDash.Core
|
||||||
/// Callback for console command
|
/// Callback for console command
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="levelString"></param>
|
/// <param name="levelString"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugFromConsole method
|
||||||
|
/// </summary>
|
||||||
public void SetDebugFromConsole(string levelString)
|
public void SetDebugFromConsole(string levelString)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -114,6 +120,9 @@ namespace PepperDash.Core
|
||||||
/// Sets the debug level
|
/// Sets the debug level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
|
/// <param name="level"> Valid values 0 (no debug), 1 (critical), 2 (all messages)</param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugLevel method
|
||||||
|
/// </summary>
|
||||||
public void SetDebugLevel(int level)
|
public void SetDebugLevel(int level)
|
||||||
{
|
{
|
||||||
if (level <= 2)
|
if (level <= 2)
|
||||||
|
|
@ -143,6 +152,9 @@ namespace PepperDash.Core
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Appends a device Key to the beginning of a message
|
/// Appends a device Key to the beginning of a message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Console method
|
||||||
|
/// </summary>
|
||||||
public void Console(uint level, IKeyed dev, string format, params object[] items)
|
public void Console(uint level, IKeyed dev, string format, params object[] items)
|
||||||
{
|
{
|
||||||
if (SaveData.Level >= level)
|
if (SaveData.Level >= level)
|
||||||
|
|
@ -191,6 +203,9 @@ namespace PepperDash.Core
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="errorLogLevel"></param>
|
/// <param name="errorLogLevel"></param>
|
||||||
/// <param name="str"></param>
|
/// <param name="str"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public void LogError(Debug.ErrorLogLevel errorLogLevel, string str)
|
public void LogError(Debug.ErrorLogLevel errorLogLevel, string str)
|
||||||
{
|
{
|
||||||
string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);
|
string msg = string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,14 @@ using Serilog.Events;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DebugCrestronLoggerSink
|
||||||
|
/// </summary>
|
||||||
public class DebugCrestronLoggerSink : ILogEventSink
|
public class DebugCrestronLoggerSink : ILogEventSink
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Emit method
|
||||||
|
/// </summary>
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
if (!Debug.IsRunningOnAppliance) return;
|
if (!Debug.IsRunningOnAppliance) return;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace PepperDash.Core.Logging
|
namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DebugErrorLogSink
|
||||||
|
/// </summary>
|
||||||
public class DebugErrorLogSink : ILogEventSink
|
public class DebugErrorLogSink : ILogEventSink
|
||||||
{
|
{
|
||||||
private ITextFormatter _formatter;
|
private ITextFormatter _formatter;
|
||||||
|
|
@ -24,6 +27,9 @@ namespace PepperDash.Core.Logging
|
||||||
{LogEventLevel.Error, (msg) => ErrorLog.Error(msg) },
|
{LogEventLevel.Error, (msg) => ErrorLog.Error(msg) },
|
||||||
{LogEventLevel.Fatal, (msg) => ErrorLog.Error(msg) }
|
{LogEventLevel.Fatal, (msg) => ErrorLog.Error(msg) }
|
||||||
};
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Emit method
|
||||||
|
/// </summary>
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
string message;
|
string message;
|
||||||
|
|
|
||||||
|
|
@ -6,66 +6,105 @@ namespace PepperDash.Core.Logging
|
||||||
{
|
{
|
||||||
public static class DebugExtensions
|
public static class DebugExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// LogException method
|
||||||
|
/// </summary>
|
||||||
public static void LogException(this IKeyed device, Exception ex, string message, params object[] args)
|
public static void LogException(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(ex, message, device, args);
|
Log.LogMessage(ex, message, device, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(this IKeyed device, Exception ex, string message, params object[] args)
|
public static void LogVerbose(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Verbose, ex, message, device, args);
|
Log.LogMessage(LogEventLevel.Verbose, ex, message, device, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogVerbose method
|
||||||
|
/// </summary>
|
||||||
public static void LogVerbose(this IKeyed device, string message, params object[] args)
|
public static void LogVerbose(this IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Verbose, device, message, args);
|
Log.LogMessage(LogEventLevel.Verbose, device, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(this IKeyed device, Exception ex, string message, params object[] args)
|
public static void LogDebug(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Debug, ex, message, device, args);
|
Log.LogMessage(LogEventLevel.Debug, ex, message, device, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogDebug method
|
||||||
|
/// </summary>
|
||||||
public static void LogDebug(this IKeyed device, string message, params object[] args)
|
public static void LogDebug(this IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Debug, device, message, args);
|
Log.LogMessage(LogEventLevel.Debug, device, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(this IKeyed device, Exception ex, string message, params object[] args)
|
public static void LogInformation(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Information, ex, message, device, args);
|
Log.LogMessage(LogEventLevel.Information, ex, message, device, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogInformation method
|
||||||
|
/// </summary>
|
||||||
public static void LogInformation(this IKeyed device, string message, params object[] args)
|
public static void LogInformation(this IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Information, device, message, args);
|
Log.LogMessage(LogEventLevel.Information, device, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(this IKeyed device, Exception ex, string message, params object[] args)
|
public static void LogWarning(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Warning, ex, message, device, args);
|
Log.LogMessage(LogEventLevel.Warning, ex, message, device, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogWarning method
|
||||||
|
/// </summary>
|
||||||
public static void LogWarning(this IKeyed device, string message, params object[] args)
|
public static void LogWarning(this IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Warning, device, message, args);
|
Log.LogMessage(LogEventLevel.Warning, device, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(this IKeyed device, Exception ex, string message, params object[] args)
|
public static void LogError(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Error, ex, message, device, args);
|
Log.LogMessage(LogEventLevel.Error, ex, message, device, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogError method
|
||||||
|
/// </summary>
|
||||||
public static void LogError(this IKeyed device, string message, params object[] args)
|
public static void LogError(this IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Error, device, message, args);
|
Log.LogMessage(LogEventLevel.Error, device, message, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(this IKeyed device, Exception ex, string message, params object[] args)
|
public static void LogFatal(this IKeyed device, Exception ex, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Fatal, ex, message, device, args);
|
Log.LogMessage(LogEventLevel.Fatal, ex, message, device, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LogFatal method
|
||||||
|
/// </summary>
|
||||||
public static void LogFatal(this IKeyed device, string message, params object[] args)
|
public static void LogFatal(this IKeyed device, string message, params object[] args)
|
||||||
{
|
{
|
||||||
Log.LogMessage(LogEventLevel.Fatal, device, message, args);
|
Log.LogMessage(LogEventLevel.Fatal, device, message, args);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ namespace PepperDash.Core.Logging
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class to persist current Debug settings across program restarts
|
/// Class to persist current Debug settings across program restarts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DebugContextCollection
|
||||||
|
/// </summary>
|
||||||
public class DebugContextCollection
|
public class DebugContextCollection
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -39,6 +42,9 @@ namespace PepperDash.Core.Logging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="contextKey"></param>
|
/// <param name="contextKey"></param>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SetLevel method
|
||||||
|
/// </summary>
|
||||||
public void SetLevel(string contextKey, int level)
|
public void SetLevel(string contextKey, int level)
|
||||||
{
|
{
|
||||||
if (level < 0 || level > 2)
|
if (level < 0 || level > 2)
|
||||||
|
|
@ -51,6 +57,9 @@ namespace PepperDash.Core.Logging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="contextKey"></param>
|
/// <param name="contextKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetOrCreateItem method
|
||||||
|
/// </summary>
|
||||||
public DebugContextItem GetOrCreateItem(string contextKey)
|
public DebugContextItem GetOrCreateItem(string contextKey)
|
||||||
{
|
{
|
||||||
if (!_items.ContainsKey(contextKey))
|
if (!_items.ContainsKey(contextKey))
|
||||||
|
|
@ -65,6 +74,9 @@ namespace PepperDash.Core.Logging
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <param name="settings"></param>
|
/// <param name="settings"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// SetDebugSettingsForKey method
|
||||||
|
/// </summary>
|
||||||
public void SetDebugSettingsForKey(string deviceKey, object settings)
|
public void SetDebugSettingsForKey(string deviceKey, object settings)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -89,6 +101,9 @@ namespace PepperDash.Core.Logging
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceKey"></param>
|
/// <param name="deviceKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetDebugSettingsForKey method
|
||||||
|
/// </summary>
|
||||||
public object GetDebugSettingsForKey(string deviceKey)
|
public object GetDebugSettingsForKey(string deviceKey)
|
||||||
{
|
{
|
||||||
return DeviceDebugSettings[deviceKey];
|
return DeviceDebugSettings[deviceKey];
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ using Serilog.Formatting.Json;
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DebugWebsocketSink
|
||||||
|
/// </summary>
|
||||||
public class DebugWebsocketSink : ILogEventSink
|
public class DebugWebsocketSink : ILogEventSink
|
||||||
{
|
{
|
||||||
private HttpServer _httpsServer;
|
private HttpServer _httpsServer;
|
||||||
|
|
@ -47,6 +50,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsRunning
|
||||||
|
/// </summary>
|
||||||
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
public bool IsRunning { get => _httpsServer?.IsListening ?? false; }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -105,6 +111,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Emit method
|
||||||
|
/// </summary>
|
||||||
public void Emit(LogEvent logEvent)
|
public void Emit(LogEvent logEvent)
|
||||||
{
|
{
|
||||||
if (_httpsServer == null || !_httpsServer.IsListening) return;
|
if (_httpsServer == null || !_httpsServer.IsListening) return;
|
||||||
|
|
@ -116,6 +125,9 @@ namespace PepperDash.Core
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// StartServerAndSetPort method
|
||||||
|
/// </summary>
|
||||||
public void StartServerAndSetPort(int port)
|
public void StartServerAndSetPort(int port)
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
Debug.Console(0, "Starting Websocket Server on port: {0}", port);
|
||||||
|
|
@ -193,6 +205,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// StopServer method
|
||||||
|
/// </summary>
|
||||||
public void StopServer()
|
public void StopServer()
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Stopping Websocket Server");
|
Debug.Console(0, "Stopping Websocket Server");
|
||||||
|
|
@ -204,6 +219,9 @@ namespace PepperDash.Core
|
||||||
|
|
||||||
public static class DebugWebsocketSinkExtensions
|
public static class DebugWebsocketSinkExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DebugWebsocketSink method
|
||||||
|
/// </summary>
|
||||||
public static LoggerConfiguration DebugWebsocketSink(
|
public static LoggerConfiguration DebugWebsocketSink(
|
||||||
this LoggerSinkConfiguration loggerConfiguration,
|
this LoggerSinkConfiguration loggerConfiguration,
|
||||||
ITextFormatter formatProvider = null)
|
ITextFormatter formatProvider = null)
|
||||||
|
|
@ -212,6 +230,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DebugClient
|
||||||
|
/// </summary>
|
||||||
public class DebugClient : WebSocketBehavior
|
public class DebugClient : WebSocketBehavior
|
||||||
{
|
{
|
||||||
private DateTime _connectionTime;
|
private DateTime _connectionTime;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A class to allow user interaction with the PasswordManager
|
/// A class to allow user interaction with the PasswordManager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a PasswordClient
|
||||||
|
/// </summary>
|
||||||
public class PasswordClient
|
public class PasswordClient
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -59,6 +62,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// Retrieve password by index
|
/// Retrieve password by index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// GetPasswordByIndex method
|
||||||
|
/// </summary>
|
||||||
public void GetPasswordByIndex(ushort key)
|
public void GetPasswordByIndex(ushort key)
|
||||||
{
|
{
|
||||||
OnUshrtChange((ushort)PasswordManager.Passwords.Count, 0, PasswordManagementConstants.PasswordManagerCountChange);
|
OnUshrtChange((ushort)PasswordManager.Passwords.Count, 0, PasswordManagementConstants.PasswordManagerCountChange);
|
||||||
|
|
@ -81,6 +87,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// Password validation method
|
/// Password validation method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// ValidatePassword method
|
||||||
|
/// </summary>
|
||||||
public void ValidatePassword(string password)
|
public void ValidatePassword(string password)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(password))
|
if (string.IsNullOrEmpty(password))
|
||||||
|
|
@ -99,6 +108,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// password against the selected password when the length of the 2 are equal
|
/// password against the selected password when the length of the 2 are equal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// BuildPassword method
|
||||||
|
/// </summary>
|
||||||
public void BuildPassword(string data)
|
public void BuildPassword(string data)
|
||||||
{
|
{
|
||||||
PasswordToValidate = String.Concat(PasswordToValidate, data);
|
PasswordToValidate = String.Concat(PasswordToValidate, data);
|
||||||
|
|
@ -111,6 +123,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears the user entered password and resets the LEDs
|
/// Clears the user entered password and resets the LEDs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// ClearPassword method
|
||||||
|
/// </summary>
|
||||||
public void ClearPassword()
|
public void ClearPassword()
|
||||||
{
|
{
|
||||||
PasswordToValidate = "";
|
PasswordToValidate = "";
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows passwords to be stored and managed
|
/// Allows passwords to be stored and managed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a PasswordManager
|
||||||
|
/// </summary>
|
||||||
public class PasswordManager
|
public class PasswordManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -71,6 +74,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// UpdatePassword method
|
||||||
|
/// </summary>
|
||||||
public void UpdatePassword(ushort key, string password)
|
public void UpdatePassword(ushort key, string password)
|
||||||
{
|
{
|
||||||
// validate the parameters
|
// validate the parameters
|
||||||
|
|
@ -152,6 +158,9 @@ namespace PepperDash.Core.PasswordManagement
|
||||||
/// Method to change the default timer value, (default 5000ms/5s)
|
/// Method to change the default timer value, (default 5000ms/5s)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="time"></param>
|
/// <param name="time"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// PasswordTimerMs method
|
||||||
|
/// </summary>
|
||||||
public void PasswordTimerMs(ushort time)
|
public void PasswordTimerMs(ushort time)
|
||||||
{
|
{
|
||||||
PasswordTimerElapsedMs = Convert.ToInt64(time);
|
PasswordTimerElapsedMs = Convert.ToInt64(time);
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processor Change Event Args Class
|
/// Processor Change Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ProcessorChangeEventArgs
|
||||||
|
/// </summary>
|
||||||
public class ProcessorChangeEventArgs : EventArgs
|
public class ProcessorChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -117,6 +120,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ethernet Change Event Args Class
|
/// Ethernet Change Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a EthernetChangeEventArgs
|
||||||
|
/// </summary>
|
||||||
public class EthernetChangeEventArgs : EventArgs
|
public class EthernetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -168,6 +174,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control Subnet Chage Event Args Class
|
/// Control Subnet Chage Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ControlSubnetChangeEventArgs
|
||||||
|
/// </summary>
|
||||||
public class ControlSubnetChangeEventArgs : EventArgs
|
public class ControlSubnetChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -214,6 +223,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Program Change Event Args Class
|
/// Program Change Event Args Class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a ProgramChangeEventArgs
|
||||||
|
/// </summary>
|
||||||
public class ProgramChangeEventArgs : EventArgs
|
public class ProgramChangeEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current ethernet info
|
/// Gets the current ethernet info
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// GetEthernetInfo method
|
||||||
|
/// </summary>
|
||||||
public void GetEthernetInfo()
|
public void GetEthernetInfo()
|
||||||
{
|
{
|
||||||
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
|
|
@ -164,6 +167,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current control subnet info
|
/// Gets the current control subnet info
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// GetControlSubnetInfo method
|
||||||
|
/// </summary>
|
||||||
public void GetControlSubnetInfo()
|
public void GetControlSubnetInfo()
|
||||||
{
|
{
|
||||||
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange);
|
||||||
|
|
@ -206,6 +212,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// Gets the program info by index
|
/// Gets the program info by index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// GetProgramInfoByIndex method
|
||||||
|
/// </summary>
|
||||||
public void GetProgramInfoByIndex(ushort index)
|
public void GetProgramInfoByIndex(ushort index)
|
||||||
{
|
{
|
||||||
if (index < 1 || index > 10)
|
if (index < 1 || index > 10)
|
||||||
|
|
@ -266,6 +275,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the processor uptime and passes it to S+
|
/// Gets the processor uptime and passes it to S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// RefreshProcessorUptime method
|
||||||
|
/// </summary>
|
||||||
public void RefreshProcessorUptime()
|
public void RefreshProcessorUptime()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -287,6 +299,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// Gets the program uptime, by index, and passes it to S+
|
/// Gets the program uptime, by index, and passes it to S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// RefreshProgramUptimeByIndex method
|
||||||
|
/// </summary>
|
||||||
public void RefreshProgramUptimeByIndex(int index)
|
public void RefreshProgramUptimeByIndex(int index)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -308,6 +323,9 @@ namespace PepperDash.Core.SystemInfo
|
||||||
/// Sends command to console, passes response back using string change event
|
/// Sends command to console, passes response back using string change event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmd"></param>
|
/// <param name="cmd"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SendConsoleCommand method
|
||||||
|
/// </summary>
|
||||||
public void SendConsoleCommand(string cmd)
|
public void SendConsoleCommand(string cmd)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(cmd))
|
if (string.IsNullOrEmpty(cmd))
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ namespace PepperDash.Core
|
||||||
return issuerCertificate;
|
return issuerCertificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IssueCertificate method
|
||||||
|
/// </summary>
|
||||||
public X509Certificate2 IssueCertificate(string subjectName, X509Certificate2 issuerCertificate, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
public X509Certificate2 IssueCertificate(string subjectName, X509Certificate2 issuerCertificate, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
// It's self-signed, so these are the same.
|
||||||
|
|
@ -56,6 +59,9 @@ namespace PepperDash.Core
|
||||||
return ConvertCertificate(certificate, subjectKeyPair, random);
|
return ConvertCertificate(certificate, subjectKeyPair, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CreateCertificateAuthorityCertificate method
|
||||||
|
/// </summary>
|
||||||
public X509Certificate2 CreateCertificateAuthorityCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
public X509Certificate2 CreateCertificateAuthorityCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
// It's self-signed, so these are the same.
|
||||||
|
|
@ -78,6 +84,9 @@ namespace PepperDash.Core
|
||||||
return ConvertCertificate(certificate, subjectKeyPair, random);
|
return ConvertCertificate(certificate, subjectKeyPair, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CreateSelfSignedCertificate method
|
||||||
|
/// </summary>
|
||||||
public X509Certificate2 CreateSelfSignedCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
public X509Certificate2 CreateSelfSignedCertificate(string subjectName, string[] subjectAlternativeNames, KeyPurposeID[] usages)
|
||||||
{
|
{
|
||||||
// It's self-signed, so these are the same.
|
// It's self-signed, so these are the same.
|
||||||
|
|
@ -305,6 +314,9 @@ namespace PepperDash.Core
|
||||||
return convertedCertificate;
|
return convertedCertificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WriteCertificate method
|
||||||
|
/// </summary>
|
||||||
public void WriteCertificate(X509Certificate2 certificate, string outputDirectory, string certName)
|
public void WriteCertificate(X509Certificate2 certificate, string outputDirectory, string certName)
|
||||||
{
|
{
|
||||||
// This password is the one attached to the PFX file. Use 'null' for no password.
|
// This password is the one attached to the PFX file. Use 'null' for no password.
|
||||||
|
|
@ -332,6 +344,9 @@ namespace PepperDash.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// AddCertToStore method
|
||||||
|
/// </summary>
|
||||||
public bool AddCertToStore(X509Certificate2 cert, System.Security.Cryptography.X509Certificates.StoreName st, System.Security.Cryptography.X509Certificates.StoreLocation sl)
|
public bool AddCertToStore(X509Certificate2 cert, System.Security.Cryptography.X509Certificates.StoreName st, System.Security.Cryptography.X509Certificates.StoreLocation sl)
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ namespace PepperDash.Core.Web.RequestHandlers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Web API default request handler
|
/// Web API default request handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a DefaultRequestHandler
|
||||||
|
/// </summary>
|
||||||
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
public class DefaultRequestHandler : WebApiBaseRequestHandler
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,9 @@ namespace PepperDash.Core.Web.RequestHandlers
|
||||||
/// Process request
|
/// Process request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// ProcessRequest method
|
||||||
|
/// </summary>
|
||||||
public void ProcessRequest(HttpCwsContext context)
|
public void ProcessRequest(HttpCwsContext context)
|
||||||
{
|
{
|
||||||
if (!_handlers.TryGetValue(context.Request.HttpMethod, out Func<HttpCwsContext, Task> handler))
|
if (!_handlers.TryGetValue(context.Request.HttpMethod, out Func<HttpCwsContext, Task> handler))
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,9 @@ namespace PepperDash.Core.Web.RequestHandlers
|
||||||
/// Process request
|
/// Process request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// ProcessRequest method
|
||||||
|
/// </summary>
|
||||||
public void ProcessRequest(HttpCwsContext context)
|
public void ProcessRequest(HttpCwsContext context)
|
||||||
{
|
{
|
||||||
Action<HttpCwsContext> handler;
|
Action<HttpCwsContext> handler;
|
||||||
|
|
|
||||||
|
|
@ -28,21 +28,33 @@ namespace PepperDash.Core.Web
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Web API server key
|
/// Web API server key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Key
|
||||||
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Web API server name
|
/// Web API server name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Name
|
||||||
|
/// </summary>
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CWS base path, will default to "/api" if not set via initialize method
|
/// CWS base path, will default to "/api" if not set via initialize method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the BasePath
|
||||||
|
/// </summary>
|
||||||
public string BasePath { get; private set; }
|
public string BasePath { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates CWS is registered with base path
|
/// Indicates CWS is registered with base path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsRegistered
|
||||||
|
/// </summary>
|
||||||
public bool IsRegistered { get; private set; }
|
public bool IsRegistered { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -140,6 +152,9 @@ namespace PepperDash.Core.Web
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes CWS class
|
/// Initializes CWS class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize method
|
||||||
|
/// </summary>
|
||||||
public void Initialize(string key, string basePath)
|
public void Initialize(string key, string basePath)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
|
|
@ -165,6 +180,9 @@ namespace PepperDash.Core.Web
|
||||||
/// Removes a route from CWS
|
/// Removes a route from CWS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="route"></param>
|
/// <param name="route"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// RemoveRoute method
|
||||||
|
/// </summary>
|
||||||
public void RemoveRoute(HttpCwsRoute route)
|
public void RemoveRoute(HttpCwsRoute route)
|
||||||
{
|
{
|
||||||
if (route == null)
|
if (route == null)
|
||||||
|
|
@ -179,6 +197,9 @@ namespace PepperDash.Core.Web
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a list of the current routes
|
/// Returns a list of the current routes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// GetRouteCollection method
|
||||||
|
/// </summary>
|
||||||
public HttpCwsRouteCollection GetRouteCollection()
|
public HttpCwsRouteCollection GetRouteCollection()
|
||||||
{
|
{
|
||||||
return _server.Routes;
|
return _server.Routes;
|
||||||
|
|
@ -225,6 +246,9 @@ namespace PepperDash.Core.Web
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop CWS instance
|
/// Stop CWS instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Stop method
|
||||||
|
/// </summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a preset
|
/// Represents a preset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a Preset
|
||||||
|
/// </summary>
|
||||||
public class Preset
|
public class Preset
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -15,26 +18,41 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User ID
|
/// User ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the UserId
|
||||||
|
/// </summary>
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Room Type ID
|
/// Room Type ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the RoomTypeId
|
||||||
|
/// </summary>
|
||||||
public int RoomTypeId { get; set; }
|
public int RoomTypeId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preset Name
|
/// Preset Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PresetName
|
||||||
|
/// </summary>
|
||||||
public string PresetName { get; set; }
|
public string PresetName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preset Number
|
/// Preset Number
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PresetNumber
|
||||||
|
/// </summary>
|
||||||
public int PresetNumber { get; set; }
|
public int PresetNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preset Data
|
/// Preset Data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Data
|
||||||
|
/// </summary>
|
||||||
public string Data { get; set; }
|
public string Data { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -51,6 +69,9 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a PresetReceivedEventArgs
|
||||||
|
/// </summary>
|
||||||
public class PresetReceivedEventArgs : EventArgs
|
public class PresetReceivedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -61,11 +82,17 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// S+ helper
|
/// S+ helper
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ULookupSuccess
|
||||||
|
/// </summary>
|
||||||
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The preset
|
/// The preset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Preset
|
||||||
|
/// </summary>
|
||||||
public Preset Preset { get; private set; }
|
public Preset Preset { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,25 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ExternalId
|
||||||
|
/// </summary>
|
||||||
public string ExternalId { get; set; }
|
public string ExternalId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the FirstName
|
||||||
|
/// </summary>
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the LastName
|
||||||
|
/// </summary>
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,11 +55,17 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For stupid S+
|
/// For stupid S+
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ULookupSuccess
|
||||||
|
/// </summary>
|
||||||
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
public ushort ULookupSuccess { get { return (ushort)(LookupSuccess ? 1 : 0); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the User
|
||||||
|
/// </summary>
|
||||||
public User User { get; private set; }
|
public User User { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -73,6 +88,9 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a UserAndRoomMessage
|
||||||
|
/// </summary>
|
||||||
public class UserAndRoomMessage
|
public class UserAndRoomMessage
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -83,11 +101,17 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the RoomTypeId
|
||||||
|
/// </summary>
|
||||||
public int RoomTypeId { get; set; }
|
public int RoomTypeId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the PresetNumber
|
||||||
|
/// </summary>
|
||||||
public int PresetNumber { get; set; }
|
public int PresetNumber { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,6 +28,9 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique identifier for this instance
|
/// Unique identifier for this instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Key
|
||||||
|
/// </summary>
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
//string JsonMasterKey;
|
//string JsonMasterKey;
|
||||||
|
|
@ -77,6 +80,9 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// Gets the user for a passcode
|
/// Gets the user for a passcode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="passcode"></param>
|
/// <param name="passcode"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// GetUserForPasscode method
|
||||||
|
/// </summary>
|
||||||
public void GetUserForPasscode(string passcode)
|
public void GetUserForPasscode(string passcode)
|
||||||
{
|
{
|
||||||
// Bullshit duplicate code here... These two cases should be the same
|
// Bullshit duplicate code here... These two cases should be the same
|
||||||
|
|
@ -115,6 +121,9 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomTypeId"></param>
|
/// <param name="roomTypeId"></param>
|
||||||
/// <param name="presetNumber"></param>
|
/// <param name="presetNumber"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// GetPresetForThisUser method
|
||||||
|
/// </summary>
|
||||||
public void GetPresetForThisUser(int roomTypeId, int presetNumber)
|
public void GetPresetForThisUser(int roomTypeId, int presetNumber)
|
||||||
{
|
{
|
||||||
if (CurrentUser == null)
|
if (CurrentUser == null)
|
||||||
|
|
@ -212,6 +221,9 @@ namespace PepperDash.Core.WebApi.Presets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roomTypeId"></param>
|
/// <param name="roomTypeId"></param>
|
||||||
/// <param name="presetNumber"></param>
|
/// <param name="presetNumber"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// SavePresetForThisUser method
|
||||||
|
/// </summary>
|
||||||
public void SavePresetForThisUser(int roomTypeId, int presetNumber)
|
public void SavePresetForThisUser(int roomTypeId, int presetNumber)
|
||||||
{
|
{
|
||||||
if (CurrentPreset == null)
|
if (CurrentPreset == null)
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetTokenWithOffset method
|
||||||
|
/// </summary>
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
{
|
{
|
||||||
if (offset == 0) return this;
|
if (offset == 0) return this;
|
||||||
|
|
@ -69,6 +72,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ToString method
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Index + " = 0x" + Value.ToString("X4");
|
return Index + " = 0x" + Value.ToString("X4");
|
||||||
|
|
@ -80,6 +86,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
/// <param name="format"></param>
|
/// <param name="format"></param>
|
||||||
/// <param name="formatProvider"></param>
|
/// <param name="formatProvider"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ToString method
|
||||||
|
/// </summary>
|
||||||
public string ToString(string format, IFormatProvider formatProvider)
|
public string ToString(string format, IFormatProvider formatProvider)
|
||||||
{
|
{
|
||||||
return Value.ToString(format, formatProvider);
|
return Value.ToString(format, formatProvider);
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetTokenWithOffset method
|
||||||
|
/// </summary>
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
{
|
{
|
||||||
if (offset == 0) return this;
|
if (offset == 0) return this;
|
||||||
|
|
@ -67,6 +70,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ToString method
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Index + " = " + (Value ? "High" : "Low");
|
return Index + " = " + (Value ? "High" : "Low");
|
||||||
|
|
@ -77,6 +83,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="formatProvider"></param>
|
/// <param name="formatProvider"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ToString method
|
||||||
|
/// </summary>
|
||||||
public string ToString(IFormatProvider formatProvider)
|
public string ToString(IFormatProvider formatProvider)
|
||||||
{
|
{
|
||||||
return Value.ToString(formatProvider);
|
return Value.ToString(formatProvider);
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="offset"></param>
|
/// <param name="offset"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetTokenWithOffset method
|
||||||
|
/// </summary>
|
||||||
public override XSigToken GetTokenWithOffset(int offset)
|
public override XSigToken GetTokenWithOffset(int offset)
|
||||||
{
|
{
|
||||||
if (offset == 0) return this;
|
if (offset == 0) return this;
|
||||||
|
|
@ -73,6 +76,9 @@ namespace PepperDash.Core.Intersystem.Tokens
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ToString method
|
||||||
|
/// </summary>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Index + " = \"" + Value + "\"";
|
return Index + " = \"" + Value + "\"";
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xSigSerialization">XSig state resolver.</param>
|
/// <param name="xSigSerialization">XSig state resolver.</param>
|
||||||
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(IXSigSerialization xSigSerialization)
|
public static byte[] GetBytes(IXSigSerialization xSigSerialization)
|
||||||
{
|
{
|
||||||
return GetBytes(xSigSerialization, 0);
|
return GetBytes(xSigSerialization, 0);
|
||||||
|
|
@ -63,6 +66,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="xSigSerialization">XSig state resolver.</param>
|
/// <param name="xSigSerialization">XSig state resolver.</param>
|
||||||
/// <param name="offset">Offset to which the data will be aligned.</param>
|
/// <param name="offset">Offset to which the data will be aligned.</param>
|
||||||
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
/// <returns>Bytes in XSig format for each token within the state representation.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(IXSigSerialization xSigSerialization, int offset)
|
public static byte[] GetBytes(IXSigSerialization xSigSerialization, int offset)
|
||||||
{
|
{
|
||||||
var tokens = xSigSerialization.Serialize();
|
var tokens = xSigSerialization.Serialize();
|
||||||
|
|
@ -82,6 +88,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="index">1-based digital index</param>
|
/// <param name="index">1-based digital index</param>
|
||||||
/// <param name="value">Digital data to be encoded</param>
|
/// <param name="value">Digital data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for digtial information.</returns>
|
/// <returns>Bytes in XSig format for digtial information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int index, bool value)
|
public static byte[] GetBytes(int index, bool value)
|
||||||
{
|
{
|
||||||
return GetBytes(index, 0, value);
|
return GetBytes(index, 0, value);
|
||||||
|
|
@ -94,6 +103,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="value">Digital data to be encoded</param>
|
/// <param name="value">Digital data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for digtial information.</returns>
|
/// <returns>Bytes in XSig format for digtial information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int index, int offset, bool value)
|
public static byte[] GetBytes(int index, int offset, bool value)
|
||||||
{
|
{
|
||||||
return new XSigDigitalToken(index + offset, value).GetBytes();
|
return new XSigDigitalToken(index + offset, value).GetBytes();
|
||||||
|
|
@ -105,6 +117,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
/// <param name="values">Digital signal value array.</param>
|
/// <param name="values">Digital signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int startIndex, bool[] values)
|
public static byte[] GetBytes(int startIndex, bool[] values)
|
||||||
{
|
{
|
||||||
return GetBytes(startIndex, 0, values);
|
return GetBytes(startIndex, 0, values);
|
||||||
|
|
@ -117,6 +132,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="values">Digital signal value array.</param>
|
/// <param name="values">Digital signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
/// <returns>Byte sequence in XSig format for digital signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int startIndex, int offset, bool[] values)
|
public static byte[] GetBytes(int startIndex, int offset, bool[] values)
|
||||||
{
|
{
|
||||||
// Digital XSig data is 2 bytes per value
|
// Digital XSig data is 2 bytes per value
|
||||||
|
|
@ -134,6 +152,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="index">1-based analog index</param>
|
/// <param name="index">1-based analog index</param>
|
||||||
/// <param name="value">Analog data to be encoded</param>
|
/// <param name="value">Analog data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int index, ushort value)
|
public static byte[] GetBytes(int index, ushort value)
|
||||||
{
|
{
|
||||||
return GetBytes(index, 0, value);
|
return GetBytes(index, 0, value);
|
||||||
|
|
@ -146,6 +167,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="value">Analog data to be encoded</param>
|
/// <param name="value">Analog data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
/// <returns>Bytes in XSig format for analog signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int index, int offset, ushort value)
|
public static byte[] GetBytes(int index, int offset, ushort value)
|
||||||
{
|
{
|
||||||
return new XSigAnalogToken(index + offset, value).GetBytes();
|
return new XSigAnalogToken(index + offset, value).GetBytes();
|
||||||
|
|
@ -157,6 +181,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
/// <param name="values">Analog signal value array.</param>
|
/// <param name="values">Analog signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int startIndex, ushort[] values)
|
public static byte[] GetBytes(int startIndex, ushort[] values)
|
||||||
{
|
{
|
||||||
return GetBytes(startIndex, 0, values);
|
return GetBytes(startIndex, 0, values);
|
||||||
|
|
@ -169,6 +196,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="values">Analog signal value array.</param>
|
/// <param name="values">Analog signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
/// <returns>Byte sequence in XSig format for analog signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int startIndex, int offset, ushort[] values)
|
public static byte[] GetBytes(int startIndex, int offset, ushort[] values)
|
||||||
{
|
{
|
||||||
// Analog XSig data is 4 bytes per value
|
// Analog XSig data is 4 bytes per value
|
||||||
|
|
@ -186,6 +216,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="index">1-based serial index</param>
|
/// <param name="index">1-based serial index</param>
|
||||||
/// <param name="value">Serial data to be encoded</param>
|
/// <param name="value">Serial data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int index, string value)
|
public static byte[] GetBytes(int index, string value)
|
||||||
{
|
{
|
||||||
return GetBytes(index, 0, value);
|
return GetBytes(index, 0, value);
|
||||||
|
|
@ -198,6 +231,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="value">Serial data to be encoded</param>
|
/// <param name="value">Serial data to be encoded</param>
|
||||||
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
/// <returns>Bytes in XSig format for serial signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int index, int offset, string value)
|
public static byte[] GetBytes(int index, int offset, string value)
|
||||||
{
|
{
|
||||||
return new XSigSerialToken(index + offset, value).GetBytes();
|
return new XSigSerialToken(index + offset, value).GetBytes();
|
||||||
|
|
@ -209,6 +245,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="startIndex">Starting index of the sequence.</param>
|
/// <param name="startIndex">Starting index of the sequence.</param>
|
||||||
/// <param name="values">Serial signal value array.</param>
|
/// <param name="values">Serial signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int startIndex, string[] values)
|
public static byte[] GetBytes(int startIndex, string[] values)
|
||||||
{
|
{
|
||||||
return GetBytes(startIndex, 0, values);
|
return GetBytes(startIndex, 0, values);
|
||||||
|
|
@ -221,6 +260,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="offset">Index offset.</param>
|
/// <param name="offset">Index offset.</param>
|
||||||
/// <param name="values">Serial signal value array.</param>
|
/// <param name="values">Serial signal value array.</param>
|
||||||
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
/// <returns>Byte sequence in XSig format for serial signal information.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// GetBytes method
|
||||||
|
/// </summary>
|
||||||
public static byte[] GetBytes(int startIndex, int offset, string[] values)
|
public static byte[] GetBytes(int startIndex, int offset, string[] values)
|
||||||
{
|
{
|
||||||
// Serial XSig data is not fixed-length like the other formats
|
// Serial XSig data is not fixed-length like the other formats
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <param name="stream">Input stream</param>
|
/// <param name="stream">Input stream</param>
|
||||||
/// <param name="value">Result</param>
|
/// <param name="value">Result</param>
|
||||||
/// <returns>True if successful, otherwise false.</returns>
|
/// <returns>True if successful, otherwise false.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// TryReadUInt16BE method
|
||||||
|
/// </summary>
|
||||||
public static bool TryReadUInt16BE(Stream stream, out ushort value)
|
public static bool TryReadUInt16BE(Stream stream, out ushort value)
|
||||||
{
|
{
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
@ -65,6 +68,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>XSigToken</returns>
|
/// <returns>XSigToken</returns>
|
||||||
/// <exception cref="ArgumentOutOfRangeException">Offset is less than 0.</exception>
|
/// <exception cref="ArgumentOutOfRangeException">Offset is less than 0.</exception>
|
||||||
|
/// <summary>
|
||||||
|
/// ReadXSigToken method
|
||||||
|
/// </summary>
|
||||||
public XSigToken ReadXSigToken()
|
public XSigToken ReadXSigToken()
|
||||||
{
|
{
|
||||||
ushort prefix;
|
ushort prefix;
|
||||||
|
|
@ -114,6 +120,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// Reads all available XSig tokens from the stream.
|
/// Reads all available XSig tokens from the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>XSigToken collection.</returns>
|
/// <returns>XSigToken collection.</returns>
|
||||||
|
/// <summary>
|
||||||
|
/// ReadAllXSigTokens method
|
||||||
|
/// </summary>
|
||||||
public IEnumerable<XSigToken> ReadAllXSigTokens()
|
public IEnumerable<XSigToken> ReadAllXSigTokens()
|
||||||
{
|
{
|
||||||
var tokens = new List<XSigToken>();
|
var tokens = new List<XSigToken>();
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
/// Write XSig data gathered from an IXSigStateResolver to the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
||||||
|
/// <summary>
|
||||||
|
/// WriteXSigData method
|
||||||
|
/// </summary>
|
||||||
public void WriteXSigData(IXSigSerialization xSigSerialization)
|
public void WriteXSigData(IXSigSerialization xSigSerialization)
|
||||||
{
|
{
|
||||||
WriteXSigData(xSigSerialization, 0);
|
WriteXSigData(xSigSerialization, 0);
|
||||||
|
|
@ -57,6 +60,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
/// <param name="xSigSerialization">IXSigStateResolver object.</param>
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
|
/// <summary>
|
||||||
|
/// WriteXSigData method
|
||||||
|
/// </summary>
|
||||||
public void WriteXSigData(IXSigSerialization xSigSerialization, int offset)
|
public void WriteXSigData(IXSigSerialization xSigSerialization, int offset)
|
||||||
{
|
{
|
||||||
if (xSigSerialization == null)
|
if (xSigSerialization == null)
|
||||||
|
|
@ -70,6 +76,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// Write XSigToken to the stream.
|
/// Write XSigToken to the stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="token">XSigToken object.</param>
|
/// <param name="token">XSigToken object.</param>
|
||||||
|
/// <summary>
|
||||||
|
/// WriteXSigData method
|
||||||
|
/// </summary>
|
||||||
public void WriteXSigData(XSigToken token)
|
public void WriteXSigData(XSigToken token)
|
||||||
{
|
{
|
||||||
WriteXSigData(token, 0);
|
WriteXSigData(token, 0);
|
||||||
|
|
@ -80,6 +89,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="token">XSigToken object.</param>
|
/// <param name="token">XSigToken object.</param>
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
|
/// <summary>
|
||||||
|
/// WriteXSigData method
|
||||||
|
/// </summary>
|
||||||
public void WriteXSigData(XSigToken token, int offset)
|
public void WriteXSigData(XSigToken token, int offset)
|
||||||
{
|
{
|
||||||
WriteXSigData(new[] { token }, offset);
|
WriteXSigData(new[] { token }, offset);
|
||||||
|
|
@ -108,6 +120,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tokens">XSigToken objects.</param>
|
/// <param name="tokens">XSigToken objects.</param>
|
||||||
/// <param name="offset">Index offset for each XSigToken.</param>
|
/// <param name="offset">Index offset for each XSigToken.</param>
|
||||||
|
/// <summary>
|
||||||
|
/// WriteXSigData method
|
||||||
|
/// </summary>
|
||||||
public void WriteXSigData(IEnumerable<XSigToken> tokens, int offset)
|
public void WriteXSigData(IEnumerable<XSigToken> tokens, int offset)
|
||||||
{
|
{
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
|
|
@ -127,6 +142,9 @@ namespace PepperDash.Core.Intersystem
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disposes of the internal stream if specified to not leave open.
|
/// Disposes of the internal stream if specified to not leave open.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <summary>
|
||||||
|
/// Dispose method
|
||||||
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (!_leaveOpen)
|
if (!_leaveOpen)
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,29 @@ using System.Linq;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper class for device factory information
|
||||||
|
/// </summary>
|
||||||
public class DeviceFactoryWrapper
|
public class DeviceFactoryWrapper
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the device type
|
||||||
|
/// </summary>
|
||||||
public Type Type { get; set; }
|
public Type Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the description of the device factory
|
||||||
|
/// </summary>
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the factory method for creating devices
|
||||||
|
/// </summary>
|
||||||
public Func<DeviceConfig, IKeyed> FactoryMethod { get; set; }
|
public Func<DeviceConfig, IKeyed> FactoryMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the DeviceFactoryWrapper class
|
||||||
|
/// </summary>
|
||||||
public DeviceFactoryWrapper()
|
public DeviceFactoryWrapper()
|
||||||
{
|
{
|
||||||
Type = null;
|
Type = null;
|
||||||
|
|
@ -25,8 +42,14 @@ namespace PepperDash.Essentials.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Factory class for loading and managing device types
|
||||||
|
/// </summary>
|
||||||
public class DeviceFactory
|
public class DeviceFactory
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the DeviceFactory class and loads all device type factories
|
||||||
|
/// </summary>
|
||||||
public DeviceFactory()
|
public DeviceFactory()
|
||||||
{
|
{
|
||||||
var assy = Assembly.GetExecutingAssembly();
|
var assy = Assembly.GetExecutingAssembly();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue