mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
wip: update XML comments
This commit is contained in:
@@ -8,24 +8,48 @@ using PepperDash.Essentials.Core;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Ethernet
|
namespace PepperDash.Essentials.Core.Ethernet
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ethernet settings feedbacks
|
||||||
|
/// </summary>
|
||||||
public static class EthernetSettings
|
public static class EthernetSettings
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Link active feedback
|
||||||
|
/// </summary>
|
||||||
public static readonly BoolFeedback LinkActive = new BoolFeedback("LinkActive",
|
public static readonly BoolFeedback LinkActive = new BoolFeedback("LinkActive",
|
||||||
() => true);
|
() => true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DHCP active feedback
|
||||||
|
/// </summary>
|
||||||
public static readonly BoolFeedback DhcpActive = new BoolFeedback("DhcpActive",
|
public static readonly BoolFeedback DhcpActive = new BoolFeedback("DhcpActive",
|
||||||
() => CrestronEthernetHelper.GetEthernetParameter(
|
() => CrestronEthernetHelper.GetEthernetParameter(
|
||||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_DHCP_STATE, 0) == "ON");
|
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_DHCP_STATE, 0) == "ON");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hostname feedback
|
||||||
|
/// </summary>
|
||||||
public static readonly StringFeedback Hostname = new StringFeedback("Hostname",
|
public static readonly StringFeedback Hostname = new StringFeedback("Hostname",
|
||||||
() => CrestronEthernetHelper.GetEthernetParameter(
|
() => CrestronEthernetHelper.GetEthernetParameter(
|
||||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0));
|
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IP Address feedback
|
||||||
|
/// </summary>
|
||||||
public static readonly StringFeedback IpAddress0 = new StringFeedback("IpAddress0",
|
public static readonly StringFeedback IpAddress0 = new StringFeedback("IpAddress0",
|
||||||
() => CrestronEthernetHelper.GetEthernetParameter(
|
() => CrestronEthernetHelper.GetEthernetParameter(
|
||||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
|
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Subnet Mask feedback
|
||||||
|
/// </summary>
|
||||||
public static readonly StringFeedback SubnetMask0 = new StringFeedback("SubnetMask0",
|
public static readonly StringFeedback SubnetMask0 = new StringFeedback("SubnetMask0",
|
||||||
() => CrestronEthernetHelper.GetEthernetParameter(
|
() => CrestronEthernetHelper.GetEthernetParameter(
|
||||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, 0));
|
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, 0));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default Gateway feedback
|
||||||
|
/// </summary>
|
||||||
public static readonly StringFeedback DefaultGateway0 = new StringFeedback("DefaultGateway0",
|
public static readonly StringFeedback DefaultGateway0 = new StringFeedback("DefaultGateway0",
|
||||||
() => CrestronEthernetHelper.GetEthernetParameter(
|
() => CrestronEthernetHelper.GetEthernetParameter(
|
||||||
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0));
|
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0));
|
||||||
|
|||||||
@@ -10,11 +10,17 @@ using Newtonsoft.Json.Linq;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// JsonExtensions class
|
||||||
|
/// </summary>
|
||||||
public static class JsonExtensions
|
public static class JsonExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FindTokens method
|
/// FindTokens method
|
||||||
/// </summary>
|
/// </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)
|
public static List<JToken> FindTokens(this JToken containerToken, string name)
|
||||||
{
|
{
|
||||||
List<JToken> matches = new List<JToken>();
|
List<JToken> matches = new List<JToken>();
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ using Crestron.SimplSharp;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// StringExtensions class
|
||||||
|
/// </summary>
|
||||||
public static class StringExtensions
|
public static class StringExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -14,9 +17,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="s">string input</param>
|
/// <param name="s">string input</param>
|
||||||
/// <returns>null if the string is emtpy, otherwise returns the string</returns>
|
/// <returns>null if the string is emtpy, otherwise returns the string</returns>
|
||||||
/// <summary>
|
|
||||||
/// NullIfEmpty method
|
|
||||||
/// </summary>
|
|
||||||
public static string NullIfEmpty(this string s)
|
public static string NullIfEmpty(this string s)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(s) ? null : s;
|
return string.IsNullOrEmpty(s) ? null : s;
|
||||||
@@ -27,9 +27,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="s">string input</param>
|
/// <param name="s">string input</param>
|
||||||
/// <returns>null if the string is wempty or made of only whitespace characters, otherwise returns the string</returns>
|
/// <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)
|
public static string NullIfWhiteSpace(this string s)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(s.Trim()) ? null : s;
|
return string.IsNullOrEmpty(s.Trim()) ? null : s;
|
||||||
@@ -41,9 +38,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <param name="s">input string</param>
|
/// <param name="s">input string</param>
|
||||||
/// <param name="newString">string to replace with if input string is empty or whitespace</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>
|
/// <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)
|
public static string ReplaceIfNullOrEmpty(this string s, string newString)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(s) ? newString : s;
|
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="toCheck">String to check in Source String</param>
|
||||||
/// <param name="comp">Comparison parameters</param>
|
/// <param name="comp">Comparison parameters</param>
|
||||||
/// <returns>true of string contains "toCheck"</returns>
|
/// <returns>true of string contains "toCheck"</returns>
|
||||||
/// <summary>
|
|
||||||
/// Contains method
|
|
||||||
/// </summary>
|
|
||||||
public static bool Contains(this string source, string toCheck, StringComparison comp)
|
public static bool Contains(this string source, string toCheck, StringComparison comp)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(source)) return false;
|
if (string.IsNullOrEmpty(source)) return false;
|
||||||
@@ -70,9 +61,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="source">String to Trim</param>
|
/// <param name="source">String to Trim</param>
|
||||||
/// <returns>Trimmed String</returns>
|
/// <returns>Trimmed String</returns>
|
||||||
/// <summary>
|
|
||||||
/// TrimAll method
|
|
||||||
/// </summary>
|
|
||||||
public static string TrimAll(this string source)
|
public static string TrimAll(this string source)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(source) ? string.Empty : source.TrimStart().TrimEnd();
|
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="source">String to Trim</param>
|
||||||
/// <param name="chars">Char Array to trim from string</param>
|
/// <param name="chars">Char Array to trim from string</param>
|
||||||
/// <returns>Trimmed String</returns>
|
/// <returns>Trimmed String</returns>
|
||||||
/// <summary>
|
|
||||||
/// TrimAll method
|
|
||||||
/// </summary>
|
|
||||||
public static string TrimAll(this string source, char[] chars)
|
public static string TrimAll(this string source, char[] chars)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(source) ? string.Empty : source.TrimStart(chars).TrimEnd(chars);
|
return string.IsNullOrEmpty(source) ? string.Empty : source.TrimStart(chars).TrimEnd(chars);
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProcessorExtensionDeviceFactory
|
public class ProcessorExtensionDeviceFactory
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
public ProcessorExtensionDeviceFactory() {
|
public ProcessorExtensionDeviceFactory() {
|
||||||
var assy = Assembly.GetExecutingAssembly();
|
var assy = Assembly.GetExecutingAssembly();
|
||||||
PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy);
|
PluginLoader.SetEssentialsAssembly(assy.GetName().Name, assy);
|
||||||
@@ -50,7 +53,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a plugin factory method
|
/// Adds a plugin factory method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dc"></param>
|
/// <param name="extensionName">name fo extension to add</param>
|
||||||
|
/// <param name="method">method to add</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static void AddFactoryForType(string extensionName, Func<DeviceConfig, IKeyed> method)
|
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 });
|
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)
|
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);
|
//Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName);
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsReady { get; set; }
|
public bool IsReady { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">indicates if the object is ready</param>
|
||||||
public IsReadyEventArgs(bool data)
|
public IsReadyEventArgs(bool data)
|
||||||
{
|
{
|
||||||
IsReady = data;
|
IsReady = data;
|
||||||
@@ -28,7 +32,14 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IHasReady
|
public interface IHasReady
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Fires when the IsReady property changes
|
||||||
|
/// </summary>
|
||||||
event EventHandler<IsReadyEventArgs> IsReadyEvent;
|
event EventHandler<IsReadyEventArgs> IsReadyEvent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// indicates whether the object is ready
|
||||||
|
/// </summary>
|
||||||
bool IsReady { get; }
|
bool IsReady { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
ValueFunc = valueFunc;
|
ValueFunc = valueFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the ValueFunc
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newFunc">New function to set as the ValueFunc</param>
|
||||||
public void SetValueFunc(Func<bool> newFunc)
|
public void SetValueFunc(Func<bool> newFunc)
|
||||||
{
|
{
|
||||||
ValueFunc = newFunc;
|
ValueFunc = newFunc;
|
||||||
@@ -153,6 +157,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
LinkedCrestronFeedbacks.Remove(feedback);
|
LinkedCrestronFeedbacks.Remove(feedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ToString override
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return (InTestMode ? "TEST -- " : "") + BoolValue.ToString();
|
return (InTestMode ? "TEST -- " : "") + BoolValue.ToString();
|
||||||
|
|||||||
@@ -47,10 +47,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
Feedback = new BoolFeedback(() => _BoolValue);
|
Feedback = new BoolFeedback(() => _BoolValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Starts the
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="timeout"></param>
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start method
|
/// Start method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -12,7 +12,14 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BoolFeedbackPulseExtender
|
public class BoolFeedbackPulseExtender
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the TimeoutMs
|
||||||
|
/// </summary>
|
||||||
public uint TimeoutMs { get; set; }
|
public uint TimeoutMs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Feedback
|
||||||
|
/// </summary>
|
||||||
public BoolFeedback Feedback { get; private set; }
|
public BoolFeedback Feedback { get; private set; }
|
||||||
CTimer Timer;
|
CTimer Timer;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ using Crestron.SimplSharpPro;
|
|||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Abstract base class for BoolOutputLogicals
|
||||||
|
/// </summary>
|
||||||
public abstract class BoolFeedbackLogic
|
public abstract class BoolFeedbackLogic
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -21,13 +23,23 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected List<BoolFeedback> OutputsIn = new List<BoolFeedback>();
|
protected List<BoolFeedback> OutputsIn = new List<BoolFeedback>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ComputedValue
|
||||||
|
/// </summary>
|
||||||
protected bool ComputedValue;
|
protected bool ComputedValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
protected BoolFeedbackLogic()
|
protected BoolFeedbackLogic()
|
||||||
{
|
{
|
||||||
Output = new BoolFeedback(() => ComputedValue);
|
Output = new BoolFeedback(() => ComputedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AddOutputIn method
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="output">feedback to add</param>
|
||||||
public void AddOutputIn(BoolFeedback output)
|
public void AddOutputIn(BoolFeedback output)
|
||||||
{
|
{
|
||||||
// Don't double up outputs
|
// Don't double up outputs
|
||||||
@@ -41,6 +53,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// AddOutputsIn method
|
/// AddOutputsIn method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="outputs">feedbacks to add</param>
|
||||||
public void AddOutputsIn(List<BoolFeedback> outputs)
|
public void AddOutputsIn(List<BoolFeedback> outputs)
|
||||||
{
|
{
|
||||||
foreach (var o in outputs.Where(o => !OutputsIn.Contains(o)))
|
foreach (var o in outputs.Where(o => !OutputsIn.Contains(o)))
|
||||||
@@ -54,6 +67,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// RemoveOutputIn method
|
/// RemoveOutputIn method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="output">feedback to remove</param>
|
||||||
public void RemoveOutputIn(BoolFeedback output)
|
public void RemoveOutputIn(BoolFeedback output)
|
||||||
{
|
{
|
||||||
// Don't double up outputs
|
// Don't double up outputs
|
||||||
@@ -67,6 +81,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// RemoveOutputsIn method
|
/// RemoveOutputsIn method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="outputs">feedbacks to remove</param>
|
||||||
public void RemoveOutputsIn(List<BoolFeedback> outputs)
|
public void RemoveOutputsIn(List<BoolFeedback> outputs)
|
||||||
{
|
{
|
||||||
foreach (var o in outputs)
|
foreach (var o in outputs)
|
||||||
@@ -86,11 +101,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
Evaluate();
|
Evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AnyInput_OutputChange event handler
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
void AnyInput_OutputChange(object sender, EventArgs e)
|
void AnyInput_OutputChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Evaluate();
|
Evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Evaluate method
|
||||||
|
/// </summary>
|
||||||
protected abstract void Evaluate();
|
protected abstract void Evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +122,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BoolFeedbackAnd : BoolFeedbackLogic
|
public class BoolFeedbackAnd : BoolFeedbackLogic
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Evaluate method
|
||||||
|
/// </summary>
|
||||||
protected override void Evaluate()
|
protected override void Evaluate()
|
||||||
{
|
{
|
||||||
var prevValue = ComputedValue;
|
var prevValue = ComputedValue;
|
||||||
@@ -117,6 +143,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BoolFeedbackOr : BoolFeedbackLogic
|
public class BoolFeedbackOr : BoolFeedbackLogic
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Evaluate method
|
||||||
|
/// </summary>
|
||||||
protected override void Evaluate()
|
protected override void Evaluate()
|
||||||
{
|
{
|
||||||
var prevValue = ComputedValue;
|
var prevValue = ComputedValue;
|
||||||
@@ -137,12 +166,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
readonly Func<IEnumerable<BoolFeedback>, bool> _predicate;
|
readonly Func<IEnumerable<BoolFeedback>, bool> _predicate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
public BoolFeedbackLinq(Func<IEnumerable<BoolFeedback>, bool> predicate)
|
public BoolFeedbackLinq(Func<IEnumerable<BoolFeedback>, bool> predicate)
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
_predicate = predicate;
|
_predicate = predicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Evaluate method
|
||||||
|
/// </summary>
|
||||||
protected override void Evaluate()
|
protected override void Evaluate()
|
||||||
{
|
{
|
||||||
var prevValue = ComputedValue;
|
var prevValue = ComputedValue;
|
||||||
|
|||||||
@@ -102,12 +102,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(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(int value)
|
protected void OnOutputChange(int value)
|
||||||
{
|
{
|
||||||
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(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)
|
protected void OnOutputChange(string value)
|
||||||
{
|
{
|
||||||
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
|
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
|
||||||
|
|||||||
@@ -15,10 +15,15 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// Gets or sets the BoolValue
|
/// Gets or sets the BoolValue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool BoolValue { get; private set; }
|
public bool BoolValue { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the IntValue
|
/// Gets or sets the IntValue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int IntValue { get; private set; }
|
public int IntValue { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the UShortValue
|
||||||
|
/// </summary>
|
||||||
public ushort UShortValue
|
public ushort UShortValue
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -26,27 +31,41 @@ namespace PepperDash.Essentials.Core
|
|||||||
return (ushort)IntValue;
|
return (ushort)IntValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the StringValue
|
/// Gets or sets the StringValue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string StringValue { get; private set; }
|
public string StringValue { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Type
|
/// Gets or sets the Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public eFeedbackEventType Type { get; private set; }
|
public eFeedbackEventType Type { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for BoolValue
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">value to set</param>
|
||||||
public FeedbackEventArgs(bool value)
|
public FeedbackEventArgs(bool value)
|
||||||
{
|
{
|
||||||
BoolValue = value;
|
BoolValue = value;
|
||||||
Type = eFeedbackEventType.TypeBool;
|
Type = eFeedbackEventType.TypeBool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for IntValue
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">value to set</param>
|
||||||
public FeedbackEventArgs(int value)
|
public FeedbackEventArgs(int value)
|
||||||
{
|
{
|
||||||
IntValue = value;
|
IntValue = value;
|
||||||
Type = eFeedbackEventType.TypeInt;
|
Type = eFeedbackEventType.TypeInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for StringValue
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">value to set</param>
|
||||||
public FeedbackEventArgs(string value)
|
public FeedbackEventArgs(string value)
|
||||||
{
|
{
|
||||||
StringValue = value;
|
StringValue = value;
|
||||||
@@ -59,8 +78,19 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum eFeedbackEventType
|
public enum eFeedbackEventType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Boolean type feedback event
|
||||||
|
/// </summary>
|
||||||
TypeBool,
|
TypeBool,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Integer type feedback event
|
||||||
|
/// </summary>
|
||||||
TypeInt,
|
TypeInt,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// String type feedback event
|
||||||
|
/// </summary>
|
||||||
TypeString
|
TypeString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,6 +64,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
ValueFunc = valueFunc;
|
ValueFunc = valueFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the ValueFunc
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newFunc">function to set</param>
|
||||||
public void SetValueFunc(Func<int> newFunc)
|
public void SetValueFunc(Func<int> newFunc)
|
||||||
{
|
{
|
||||||
ValueFunc = newFunc;
|
ValueFunc = newFunc;
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SerialFeedback : Feedback
|
public class SerialFeedback : Feedback
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the SerialValue
|
||||||
|
/// </summary>
|
||||||
public override string SerialValue { get { return _SerialValue; } }
|
public override string SerialValue { get { return _SerialValue; } }
|
||||||
string _SerialValue;
|
string _SerialValue;
|
||||||
|
|
||||||
@@ -25,11 +28,18 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
List<StringInputSig> LinkedInputSigs = new List<StringInputSig>();
|
List<StringInputSig> LinkedInputSigs = new List<StringInputSig>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
[Obsolete("use constructor with Key parameter. This constructor will be removed in a future version")]
|
[Obsolete("use constructor with Key parameter. This constructor will be removed in a future version")]
|
||||||
public SerialFeedback()
|
public SerialFeedback()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor with Key parameter
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">Key to find this Feedback</param>
|
||||||
public SerialFeedback(string key)
|
public SerialFeedback(string key)
|
||||||
: base(key)
|
: base(key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
ValueFunc = valueFunc;
|
ValueFunc = valueFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the ValueFunc
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newFunc">function to set</param>
|
||||||
public void SetValueFunc(Func<string> newFunc)
|
public void SetValueFunc(Func<string> newFunc)
|
||||||
{
|
{
|
||||||
ValueFunc = newFunc;
|
ValueFunc = newFunc;
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ using Serilog.Events;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class for FileIO operations
|
||||||
|
/// </summary>
|
||||||
public static class FileIO
|
public static class FileIO
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -17,7 +20,13 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate for GotFileEventHandler
|
/// Delegate for GotFileEventHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
public delegate void GotFileEventHandler(object sender, FileEventArgs e);
|
public delegate void GotFileEventHandler(object sender, FileEventArgs e);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event for GotFileEvent
|
||||||
|
/// </summary>
|
||||||
public static event GotFileEventHandler GotFileEvent;
|
public static event GotFileEventHandler GotFileEvent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -297,6 +306,10 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class FileEventArgs
|
public class FileEventArgs
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
public FileEventArgs(string data) { Data = data; }
|
public FileEventArgs(string data) { Data = data; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Data
|
/// Gets or sets the Data
|
||||||
|
|||||||
Reference in New Issue
Block a user