wip: update XML comments

This commit is contained in:
Erik Meyer
2026-01-28 13:25:27 -05:00
parent 2b0c98444b
commit 88feeaa5be
15 changed files with 200 additions and 48 deletions

View File

@@ -8,24 +8,48 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Ethernet
{
/// <summary>
/// Ethernet settings feedbacks
/// </summary>
public static class EthernetSettings
{
/// <summary>
/// Link active feedback
/// </summary>
public static readonly BoolFeedback LinkActive = new BoolFeedback("LinkActive",
() => true);
/// <summary>
/// DHCP active feedback
/// </summary>
public static readonly BoolFeedback DhcpActive = new BoolFeedback("DhcpActive",
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_DHCP_STATE, 0) == "ON");
/// <summary>
/// Hostname feedback
/// </summary>
public static readonly StringFeedback Hostname = new StringFeedback("Hostname",
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0));
/// <summary>
/// IP Address feedback
/// </summary>
public static readonly StringFeedback IpAddress0 = new StringFeedback("IpAddress0",
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
/// <summary>
/// Subnet Mask feedback
/// </summary>
public static readonly StringFeedback SubnetMask0 = new StringFeedback("SubnetMask0",
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, 0));
/// <summary>
/// Default Gateway feedback
/// </summary>
public static readonly StringFeedback DefaultGateway0 = new StringFeedback("DefaultGateway0",
() => CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0));

View File

@@ -10,11 +10,17 @@ using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// JsonExtensions class
/// </summary>
public static class JsonExtensions
{
/// <summary>
/// FindTokens method
/// </summary>
/// <param name="containerToken">token for the container</param>
/// <param name="name">name of the token to find</param>
/// <returns>list of matching tokens</returns>
public static List<JToken> FindTokens(this JToken containerToken, string name)
{
List<JToken> matches = new List<JToken>();

View File

@@ -7,6 +7,9 @@ using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// StringExtensions class
/// </summary>
public static class StringExtensions
{
/// <summary>
@@ -14,9 +17,6 @@ namespace PepperDash.Essentials.Core
/// </summary>
/// <param name="s">string input</param>
/// <returns>null if the string is emtpy, otherwise returns the string</returns>
/// <summary>
/// NullIfEmpty method
/// </summary>
public static string NullIfEmpty(this string s)
{
return string.IsNullOrEmpty(s) ? null : s;
@@ -27,9 +27,6 @@ namespace PepperDash.Essentials.Core
/// </summary>
/// <param name="s">string input</param>
/// <returns>null if the string is wempty or made of only whitespace characters, otherwise returns the string</returns>
/// <summary>
/// NullIfWhiteSpace method
/// </summary>
public static string NullIfWhiteSpace(this string s)
{
return string.IsNullOrEmpty(s.Trim()) ? null : s;
@@ -41,9 +38,6 @@ namespace PepperDash.Essentials.Core
/// <param name="s">input string</param>
/// <param name="newString">string to replace with if input string is empty or whitespace</param>
/// <returns>returns newString if s is null, emtpy, or made of whitespace characters, otherwise returns s</returns>
/// <summary>
/// ReplaceIfNullOrEmpty method
/// </summary>
public static string ReplaceIfNullOrEmpty(this string s, string newString)
{
return string.IsNullOrEmpty(s) ? newString : s;
@@ -56,9 +50,6 @@ namespace PepperDash.Essentials.Core
/// <param name="toCheck">String to check in Source String</param>
/// <param name="comp">Comparison parameters</param>
/// <returns>true of string contains "toCheck"</returns>
/// <summary>
/// Contains method
/// </summary>
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
if (string.IsNullOrEmpty(source)) return false;
@@ -70,9 +61,6 @@ namespace PepperDash.Essentials.Core
/// </summary>
/// <param name="source">String to Trim</param>
/// <returns>Trimmed String</returns>
/// <summary>
/// TrimAll method
/// </summary>
public static string TrimAll(this string source)
{
return string.IsNullOrEmpty(source) ? string.Empty : source.TrimStart().TrimEnd();
@@ -84,9 +72,6 @@ namespace PepperDash.Essentials.Core
/// <param name="source">String to Trim</param>
/// <param name="chars">Char Array to trim from string</param>
/// <returns>Trimmed String</returns>
/// <summary>
/// TrimAll method
/// </summary>
public static string TrimAll(this string source, char[] chars)
{
return string.IsNullOrEmpty(source) ? string.Empty : source.TrimStart(chars).TrimEnd(chars);

View File

@@ -15,6 +15,9 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class ProcessorExtensionDeviceFactory
{
/// <summary>
/// Constructor
/// </summary>
public ProcessorExtensionDeviceFactory() {
var assy = Assembly.GetExecutingAssembly();
PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy);
@@ -50,7 +53,8 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// Adds a plugin factory method
/// </summary>
/// <param name="dc"></param>
/// <param name="extensionName">name fo extension to add</param>
/// <param name="method">method to add</param>
/// <returns></returns>
public static void AddFactoryForType(string extensionName, Func<DeviceConfig, IKeyed> method)
{
@@ -58,6 +62,13 @@ namespace PepperDash.Essentials.Core
ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, new DeviceFactoryWrapper() { FactoryMethod = method });
}
/// <summary>
/// Adds a plugin factory method with type and description
/// </summary>
/// <param name="extensionName">name of extension to add</param>
/// <param name="description">description of extension to add</param>
/// <param name="Type">type of extension to add</param>
/// <param name="method">method to add</param>
public static void AddFactoryForType(string extensionName, string description, Type Type, Func<DeviceConfig, IKeyed> method)
{
//Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName);

View File

@@ -17,6 +17,10 @@ namespace PepperDash.Essentials.Core
/// </summary>
public bool IsReady { get; set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">indicates if the object is ready</param>
public IsReadyEventArgs(bool data)
{
IsReady = data;
@@ -28,7 +32,14 @@ namespace PepperDash.Essentials.Core
/// </summary>
public interface IHasReady
{
/// <summary>
/// Fires when the IsReady property changes
/// </summary>
event EventHandler<IsReadyEventArgs> IsReadyEvent;
/// <summary>
/// indicates whether the object is ready
/// </summary>
bool IsReady { get; }
}
}

View File

@@ -63,6 +63,10 @@ namespace PepperDash.Essentials.Core
ValueFunc = valueFunc;
}
/// <summary>
/// Sets the ValueFunc
/// </summary>
/// <param name="newFunc">New function to set as the ValueFunc</param>
public void SetValueFunc(Func<bool> newFunc)
{
ValueFunc = newFunc;
@@ -153,6 +157,10 @@ namespace PepperDash.Essentials.Core
LinkedCrestronFeedbacks.Remove(feedback);
}
/// <summary>
/// ToString override
/// </summary>
/// <returns></returns>
public override string ToString()
{
return (InTestMode ? "TEST -- " : "") + BoolValue.ToString();

View File

@@ -48,12 +48,8 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
/// Starts the
/// Start method
/// </summary>
/// <param name="timeout"></param>
/// <summary>
/// Start method
/// </summary>
public void Start()
{
if (Timer == null)

View File

@@ -12,7 +12,14 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class BoolFeedbackPulseExtender
{
/// <summary>
/// Gets or sets the TimeoutMs
/// </summary>
public uint TimeoutMs { get; set; }
/// <summary>
/// Gets the Feedback
/// </summary>
public BoolFeedback Feedback { get; private set; }
CTimer Timer;

View File

@@ -8,7 +8,9 @@ using Crestron.SimplSharpPro;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Abstract base class for BoolOutputLogicals
/// </summary>
public abstract class BoolFeedbackLogic
{
/// <summary>
@@ -21,13 +23,23 @@ namespace PepperDash.Essentials.Core
/// </summary>
protected List<BoolFeedback> OutputsIn = new List<BoolFeedback>();
/// <summary>
/// Gets or sets the ComputedValue
/// </summary>
protected bool ComputedValue;
/// <summary>
/// Constructor
/// </summary>
protected BoolFeedbackLogic()
{
Output = new BoolFeedback(() => ComputedValue);
}
/// <summary>
/// AddOutputIn method
/// </summary>
/// <param name="output">feedback to add</param>
public void AddOutputIn(BoolFeedback output)
{
// Don't double up outputs
@@ -38,9 +50,10 @@ namespace PepperDash.Essentials.Core
Evaluate();
}
/// <summary>
/// AddOutputsIn method
/// </summary>
/// <summary>
/// AddOutputsIn method
/// </summary>
/// <param name="outputs">feedbacks to add</param>
public void AddOutputsIn(List<BoolFeedback> outputs)
{
foreach (var o in outputs.Where(o => !OutputsIn.Contains(o)))
@@ -51,9 +64,10 @@ namespace PepperDash.Essentials.Core
Evaluate();
}
/// <summary>
/// RemoveOutputIn method
/// </summary>
/// <summary>
/// RemoveOutputIn method
/// </summary>
/// <param name="output">feedback to remove</param>
public void RemoveOutputIn(BoolFeedback output)
{
// Don't double up outputs
@@ -64,9 +78,10 @@ namespace PepperDash.Essentials.Core
Evaluate();
}
/// <summary>
/// RemoveOutputsIn method
/// </summary>
/// <summary>
/// RemoveOutputsIn method
/// </summary>
/// <param name="outputs">feedbacks to remove</param>
public void RemoveOutputsIn(List<BoolFeedback> outputs)
{
foreach (var o in outputs)
@@ -77,20 +92,28 @@ namespace PepperDash.Essentials.Core
Evaluate();
}
/// <summary>
/// ClearOutputs method
/// </summary>
/// <summary>
/// ClearOutputs method
/// </summary>
public void ClearOutputs()
{
OutputsIn.Clear();
Evaluate();
}
/// <summary>
/// AnyInput_OutputChange event handler
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void AnyInput_OutputChange(object sender, EventArgs e)
{
Evaluate();
}
/// <summary>
/// Evaluate method
/// </summary>
protected abstract void Evaluate();
}
@@ -99,6 +122,9 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class BoolFeedbackAnd : BoolFeedbackLogic
{
/// <summary>
/// Evaluate method
/// </summary>
protected override void Evaluate()
{
var prevValue = ComputedValue;
@@ -112,11 +138,14 @@ namespace PepperDash.Essentials.Core
}
}
/// <summary>
/// Represents a BoolFeedbackOr
/// </summary>
/// <summary>
/// Represents a BoolFeedbackOr
/// </summary>
public class BoolFeedbackOr : BoolFeedbackLogic
{
/// <summary>
/// Evaluate method
/// </summary>
protected override void Evaluate()
{
var prevValue = ComputedValue;
@@ -130,19 +159,26 @@ namespace PepperDash.Essentials.Core
}
}
/// <summary>
/// Represents a BoolFeedbackLinq
/// </summary>
/// <summary>
/// Represents a BoolFeedbackLinq
/// </summary>
public class BoolFeedbackLinq : BoolFeedbackLogic
{
readonly Func<IEnumerable<BoolFeedback>, bool> _predicate;
/// <summary>
/// Constructor
/// </summary>
/// <param name="predicate"></param>
public BoolFeedbackLinq(Func<IEnumerable<BoolFeedback>, bool> predicate)
: base()
{
_predicate = predicate;
}
/// <summary>
/// Evaluate method
/// </summary>
protected override void Evaluate()
{
var prevValue = ComputedValue;

View File

@@ -102,12 +102,19 @@ namespace PepperDash.Essentials.Core
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
}
/// <summary>
/// Helper method that fires event. Use this intstead of calling OutputChange
/// </summary>
/// <param name="value">value to seed eventArgs</param>
protected void OnOutputChange(int value)
{
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
}
/// <summary>
/// Helper method that fires event. Use this intstead of calling OutputChange
/// </summary>
/// <param name="value">value to seed eventArgs</param>
protected void OnOutputChange(string value)
{
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));

View File

@@ -15,10 +15,15 @@ namespace PepperDash.Essentials.Core
/// Gets or sets the BoolValue
/// </summary>
public bool BoolValue { get; private set; }
/// <summary>
/// Gets or sets the IntValue
/// </summary>
public int IntValue { get; private set; }
/// <summary>
/// Gets or sets the UShortValue
/// </summary>
public ushort UShortValue
{
get
@@ -26,27 +31,41 @@ namespace PepperDash.Essentials.Core
return (ushort)IntValue;
}
}
/// <summary>
/// Gets or sets the StringValue
/// </summary>
public string StringValue { get; private set; }
/// <summary>
/// Gets or sets the Type
/// </summary>
public eFeedbackEventType Type { get; private set; }
/// <summary>
/// Constructor for BoolValue
/// </summary>
/// <param name="value">value to set</param>
public FeedbackEventArgs(bool value)
{
BoolValue = value;
Type = eFeedbackEventType.TypeBool;
}
/// <summary>
/// Constructor for IntValue
/// </summary>
/// <param name="value">value to set</param>
public FeedbackEventArgs(int value)
{
IntValue = value;
Type = eFeedbackEventType.TypeInt;
}
/// <summary>
/// Constructor for StringValue
/// </summary>
/// <param name="value">value to set</param>
public FeedbackEventArgs(string value)
{
StringValue = value;
@@ -59,8 +78,19 @@ namespace PepperDash.Essentials.Core
/// </summary>
public enum eFeedbackEventType
{
/// <summary>
/// Boolean type feedback event
/// </summary>
TypeBool,
/// <summary>
/// Integer type feedback event
/// </summary>
TypeInt,
/// <summary>
/// String type feedback event
/// </summary>
TypeString
}
}

View File

@@ -64,6 +64,10 @@ namespace PepperDash.Essentials.Core
ValueFunc = valueFunc;
}
/// <summary>
/// Sets the ValueFunc
/// </summary>
/// <param name="newFunc">function to set</param>
public void SetValueFunc(Func<int> newFunc)
{
ValueFunc = newFunc;

View File

@@ -13,6 +13,9 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class SerialFeedback : Feedback
{
/// <summary>
/// Gets the SerialValue
/// </summary>
public override string SerialValue { get { return _SerialValue; } }
string _SerialValue;
@@ -25,11 +28,18 @@ namespace PepperDash.Essentials.Core
List<StringInputSig> LinkedInputSigs = new List<StringInputSig>();
/// <summary>
/// Constructor
/// </summary>
[Obsolete("use constructor with Key parameter. This constructor will be removed in a future version")]
public SerialFeedback()
{
}
/// <summary>
/// Constructor with Key parameter
/// </summary>
/// <param name="key">Key to find this Feedback</param>
public SerialFeedback(string key)
: base(key)
{

View File

@@ -59,6 +59,10 @@ namespace PepperDash.Essentials.Core
ValueFunc = valueFunc;
}
/// <summary>
/// Sets the ValueFunc
/// </summary>
/// <param name="newFunc">function to set</param>
public void SetValueFunc(Func<string> newFunc)
{
ValueFunc = newFunc;

View File

@@ -10,14 +10,23 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Static class for FileIO operations
/// </summary>
public static class FileIO
{
static CCriticalSection fileLock = new CCriticalSection();
/// <summary>
/// Delegate for GotFileEventHandler
/// </summary>
/// <summary>
/// Delegate for GotFileEventHandler
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public delegate void GotFileEventHandler(object sender, FileEventArgs e);
/// <summary>
/// Event for GotFileEvent
/// </summary>
public static event GotFileEventHandler GotFileEvent;
/// <summary>
@@ -297,6 +306,10 @@ namespace PepperDash.Essentials.Core
/// </summary>
public class FileEventArgs
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="data"></param>
public FileEventArgs(string data) { Data = data; }
/// <summary>
/// Gets or sets the Data