diff --git a/._Readme.md b/._Readme.md deleted file mode 100644 index 4a7c548..0000000 Binary files a/._Readme.md and /dev/null differ diff --git a/PepperDash Core.sln b/PepperDash Core.sln deleted file mode 100644 index 9ce1b5d..0000000 --- a/PepperDash Core.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.1.32228.430 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash_Core", "src\Pepperdash Core\PepperDash_Core.csproj", "{85BC97D4-5564-4268-8F7B-1532E2DE0456}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {85BC97D4-5564-4268-8F7B-1532E2DE0456}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {85BC97D4-5564-4268-8F7B-1532E2DE0456}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85BC97D4-5564-4268-8F7B-1532E2DE0456}.Release|Any CPU.ActiveCfg = Release|Any CPU - {85BC97D4-5564-4268-8F7B-1532E2DE0456}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {E4615FA3-8C8C-4DC0-897B-E85408B4E341} - EndGlobalSection -EndGlobal diff --git a/PepperDash.Core.sln b/PepperDash.Core.sln new file mode 100644 index 0000000..b1e8ad8 --- /dev/null +++ b/PepperDash.Core.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash.Core", "src\PepperDash.Core\PepperDash.Core.csproj", "{F3320F28-9D47-4393-8A06-747317E87C3E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3320F28-9D47-4393-8A06-747317E87C3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3320F28-9D47-4393-8A06-747317E87C3E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3320F28-9D47-4393-8A06-747317E87C3E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3320F28-9D47-4393-8A06-747317E87C3E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/PepperDash Core.sln b/src/PepperDash Core.sln deleted file mode 100644 index f38b242..0000000 --- a/src/PepperDash Core.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.1.32228.430 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash_Core", "Pepperdash Core\PepperDash_Core.csproj", "{66EB9188-E7AC-410D-AD59-931131DA7C2E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {66EB9188-E7AC-410D-AD59-931131DA7C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66EB9188-E7AC-410D-AD59-931131DA7C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66EB9188-E7AC-410D-AD59-931131DA7C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66EB9188-E7AC-410D-AD59-931131DA7C2E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {E4615FA3-8C8C-4DC0-897B-E85408B4E341} - EndGlobalSection -EndGlobal diff --git a/src/Pepperdash Core/JsonToSimpl/JsonToSimplMaster.cs b/src/Pepperdash Core/JsonToSimpl/JsonToSimplMaster.cs deleted file mode 100644 index d531d18..0000000 --- a/src/Pepperdash Core/JsonToSimpl/JsonToSimplMaster.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronIO; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace PepperDash.Core.JsonToSimpl -{ - /// - /// Abstract base class for JsonToSimpl interactions - /// - public abstract class JsonToSimplMaster : IKeyed - { - /// - /// Notifies of bool change - /// - public event EventHandler BoolChange; - /// - /// Notifies of ushort change - /// - public event EventHandler UshrtChange; - /// - /// Notifies of string change - /// - public event EventHandler StringChange; - - /// - /// A collection of associated child modules - /// - protected List Children = new List(); - - /*****************************************************************************************/ - - /// - /// Mirrors the Unique ID for now. - /// - public string Key { get { return UniqueID; } } - - /// - /// A unique ID - /// - public string UniqueID { get; protected set; } - - /// - /// Merely for use in debug messages - /// - public string DebugName - { - get { return _DebugName; } - set { if (DebugName == null) _DebugName = ""; else _DebugName = value; } - } - string _DebugName = ""; - - /// - /// This will be prepended to all paths to allow path swapping or for more organized - /// sub-paths - /// - public string PathPrefix { get; set; } - - /// - /// This is added to the end of all paths - /// - public string PathSuffix { get; set; } - - /// - /// Enables debugging output to the console. Certain error messages will be logged to the - /// system's error log regardless of this setting - /// - public bool DebugOn { get; set; } - - /// - /// Ushort helper for Debug property - /// - public ushort UDebug - { - get { return (ushort)(DebugOn ? 1 : 0); } - set - { - DebugOn = (value == 1); - CrestronConsole.PrintLine("JsonToSimpl debug={0}", DebugOn); - } - } - - /// - /// - /// - public JObject JsonObject { get; protected set; } - - /*****************************************************************************************/ - /** Privates **/ - - - // The JSON file in JObject form - // For gathering the incoming data - protected Dictionary UnsavedValues = new Dictionary(); - - /*****************************************************************************************/ - - /// - /// SIMPL+ default constructor. - /// - public JsonToSimplMaster() - { - } - - - /// - /// Sets up class - overriding methods should always call this. - /// - /// - public virtual void Initialize(string uniqueId) - { - UniqueID = uniqueId; - J2SGlobal.AddMaster(this); // Should not re-add - } - - /// - /// Adds a child "module" to this master - /// - /// - public void AddChild(JsonToSimplChildObjectBase child) - { - if (!Children.Contains(child)) - { - Children.Add(child); - } - } - - /// - /// Called from the child to add changed or new values for saving - /// - public void AddUnsavedValue(string path, JValue value) - { - if (UnsavedValues.ContainsKey(path)) - { - Debug.Console(0, "Master[{0}] WARNING - Attempt to add duplicate value for path '{1}'.\r Ingoring. Please ensure that path does not exist on multiple modules.", UniqueID, path); - } - else - UnsavedValues.Add(path, value); - //Debug.Console(0, "Master[{0}] Unsaved size={1}", UniqueID, UnsavedValues.Count); - } - - /// - /// Saves the file - /// - public abstract void Save(); - - - /// - /// - /// - public static class JsonFixes - { - /// - /// Deserializes a string into a JObject - /// - /// - /// - public static JObject ParseObject(string json) - { - using (var reader = new JsonTextReader(new StringReader(json))) - { - var startDepth = reader.Depth; - var obj = JObject.Load(reader); - if (startDepth != reader.Depth) - throw new JsonSerializationException("Unenclosed json found"); - return obj; - } - } - - /// - /// Deserializes a string into a JArray - /// - /// - /// - public static JArray ParseArray(string json) - { - using (var reader = new JsonTextReader(new StringReader(json))) - { - var startDepth = reader.Depth; - var obj = JArray.Load(reader); - if (startDepth != reader.Depth) - throw new JsonSerializationException("Unenclosed json found"); - return obj; - } - } - } - - /// - /// Helper event - /// - /// - /// - /// - protected void OnBoolChange(bool state, ushort index, ushort type) - { - if (BoolChange != null) - { - var args = new BoolChangeEventArgs(state, type); - args.Index = index; - BoolChange(this, args); - } - } - - /// - /// Helper event - /// - /// - /// - /// - protected void OnUshrtChange(ushort state, ushort index, ushort type) - { - if (UshrtChange != null) - { - var args = new UshrtChangeEventArgs(state, type); - args.Index = index; - UshrtChange(this, args); - } - } - - /// - /// Helper event - /// - /// - /// - /// - protected void OnStringChange(string value, ushort index, ushort type) - { - if (StringChange != null) - { - var args = new StringChangeEventArgs(value, type); - args.Index = index; - StringChange(this, args); - } - } - } -} diff --git a/src/Pepperdash Core/PepperDash_Core.csproj b/src/Pepperdash Core/PepperDash_Core.csproj deleted file mode 100644 index 933fa1d..0000000 --- a/src/Pepperdash Core/PepperDash_Core.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - PepperDash.Core - PepperDashCore - net472;net6 - true - en - bin\$(Configuration)\ - False - True - PepperDash Core - PepperDash Technologies - git - https://github.com/PepperDash/PepperDashCore - crestron;4series; - 2.0.0-local - $(Version) - ../../package - true - - - full - TRACE;DEBUG;SERIES4 - - - pdbonly - bin\4Series\$(Configuration)\PepperDashCore.xml - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Pepperdash Core/PepperDash_Core.projectinfo b/src/Pepperdash Core/PepperDash_Core.projectinfo deleted file mode 100644 index ded18d3..0000000 Binary files a/src/Pepperdash Core/PepperDash_Core.projectinfo and /dev/null differ diff --git a/src/Pepperdash Core/lib/net35/PepperDash_Core.clz b/src/Pepperdash Core/lib/net35/PepperDash_Core.clz deleted file mode 100644 index 93e2b02..0000000 Binary files a/src/Pepperdash Core/lib/net35/PepperDash_Core.clz and /dev/null differ diff --git a/src/Pepperdash Core/lib/net35/PepperDash_Core.dll b/src/Pepperdash Core/lib/net35/PepperDash_Core.dll deleted file mode 100644 index 1b3d097..0000000 Binary files a/src/Pepperdash Core/lib/net35/PepperDash_Core.dll and /dev/null differ diff --git a/src/Pepperdash Core/Comm/._GenericSshClient.cs b/src/Pepperdash.Core/Comm/._GenericSshClient.cs similarity index 100% rename from src/Pepperdash Core/Comm/._GenericSshClient.cs rename to src/Pepperdash.Core/Comm/._GenericSshClient.cs diff --git a/src/Pepperdash Core/Comm/._GenericTcpIpClient.cs b/src/Pepperdash.Core/Comm/._GenericTcpIpClient.cs similarity index 100% rename from src/Pepperdash Core/Comm/._GenericTcpIpClient.cs rename to src/Pepperdash.Core/Comm/._GenericTcpIpClient.cs diff --git a/src/Pepperdash Core/Comm/CommunicationGather.cs b/src/Pepperdash.Core/Comm/CommunicationGather.cs similarity index 100% rename from src/Pepperdash Core/Comm/CommunicationGather.cs rename to src/Pepperdash.Core/Comm/CommunicationGather.cs diff --git a/src/Pepperdash Core/Comm/CommunicationStreamDebugging.cs b/src/Pepperdash.Core/Comm/CommunicationStreamDebugging.cs similarity index 100% rename from src/Pepperdash Core/Comm/CommunicationStreamDebugging.cs rename to src/Pepperdash.Core/Comm/CommunicationStreamDebugging.cs diff --git a/src/Pepperdash Core/Comm/ControlPropertiesConfig.cs b/src/Pepperdash.Core/Comm/ControlPropertiesConfig.cs similarity index 100% rename from src/Pepperdash Core/Comm/ControlPropertiesConfig.cs rename to src/Pepperdash.Core/Comm/ControlPropertiesConfig.cs diff --git a/src/Pepperdash Core/Comm/DynamicTCPServer.cs b/src/Pepperdash.Core/Comm/DynamicTCPServer.cs similarity index 100% rename from src/Pepperdash Core/Comm/DynamicTCPServer.cs rename to src/Pepperdash.Core/Comm/DynamicTCPServer.cs diff --git a/src/Pepperdash Core/Comm/EventArgs.cs b/src/Pepperdash.Core/Comm/EventArgs.cs similarity index 100% rename from src/Pepperdash Core/Comm/EventArgs.cs rename to src/Pepperdash.Core/Comm/EventArgs.cs diff --git a/src/Pepperdash Core/Comm/FINISH CommStatic.cs b/src/Pepperdash.Core/Comm/FINISH CommStatic.cs similarity index 100% rename from src/Pepperdash Core/Comm/FINISH CommStatic.cs rename to src/Pepperdash.Core/Comm/FINISH CommStatic.cs diff --git a/src/Pepperdash Core/Comm/GenericHttpSseClient.cs b/src/Pepperdash.Core/Comm/GenericHttpSseClient.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericHttpSseClient.cs rename to src/Pepperdash.Core/Comm/GenericHttpSseClient.cs diff --git a/src/Pepperdash Core/Comm/GenericSecureTcpIpClient.cs b/src/Pepperdash.Core/Comm/GenericSecureTcpIpClient.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericSecureTcpIpClient.cs rename to src/Pepperdash.Core/Comm/GenericSecureTcpIpClient.cs diff --git a/src/Pepperdash Core/Comm/GenericSecureTcpIpClient_ForServer.cs b/src/Pepperdash.Core/Comm/GenericSecureTcpIpClient_ForServer.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericSecureTcpIpClient_ForServer.cs rename to src/Pepperdash.Core/Comm/GenericSecureTcpIpClient_ForServer.cs diff --git a/src/Pepperdash Core/Comm/GenericSecureTcpIpServer.cs b/src/Pepperdash.Core/Comm/GenericSecureTcpIpServer.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericSecureTcpIpServer.cs rename to src/Pepperdash.Core/Comm/GenericSecureTcpIpServer.cs diff --git a/src/Pepperdash Core/Comm/GenericSshClient.cs b/src/Pepperdash.Core/Comm/GenericSshClient.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericSshClient.cs rename to src/Pepperdash.Core/Comm/GenericSshClient.cs diff --git a/src/Pepperdash Core/Comm/GenericTcpIpClient.cs b/src/Pepperdash.Core/Comm/GenericTcpIpClient.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericTcpIpClient.cs rename to src/Pepperdash.Core/Comm/GenericTcpIpClient.cs diff --git a/src/Pepperdash Core/Comm/GenericTcpIpClient_ForServer.cs b/src/Pepperdash.Core/Comm/GenericTcpIpClient_ForServer.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericTcpIpClient_ForServer.cs rename to src/Pepperdash.Core/Comm/GenericTcpIpClient_ForServer.cs diff --git a/src/Pepperdash Core/Comm/GenericTcpIpServer.cs b/src/Pepperdash.Core/Comm/GenericTcpIpServer.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericTcpIpServer.cs rename to src/Pepperdash.Core/Comm/GenericTcpIpServer.cs diff --git a/src/Pepperdash Core/Comm/GenericUdpServer.cs b/src/Pepperdash.Core/Comm/GenericUdpServer.cs similarity index 100% rename from src/Pepperdash Core/Comm/GenericUdpServer.cs rename to src/Pepperdash.Core/Comm/GenericUdpServer.cs diff --git a/src/Pepperdash Core/Comm/QscCoreDoubleTcpIpClient.cs b/src/Pepperdash.Core/Comm/QscCoreDoubleTcpIpClient.cs similarity index 100% rename from src/Pepperdash Core/Comm/QscCoreDoubleTcpIpClient.cs rename to src/Pepperdash.Core/Comm/QscCoreDoubleTcpIpClient.cs diff --git a/src/Pepperdash Core/Comm/TcpClientConfigObject.cs b/src/Pepperdash.Core/Comm/TcpClientConfigObject.cs similarity index 100% rename from src/Pepperdash Core/Comm/TcpClientConfigObject.cs rename to src/Pepperdash.Core/Comm/TcpClientConfigObject.cs diff --git a/src/Pepperdash Core/Comm/TcpServerConfigObject.cs b/src/Pepperdash.Core/Comm/TcpServerConfigObject.cs similarity index 100% rename from src/Pepperdash Core/Comm/TcpServerConfigObject.cs rename to src/Pepperdash.Core/Comm/TcpServerConfigObject.cs diff --git a/src/Pepperdash Core/Comm/eControlMethods.cs b/src/Pepperdash.Core/Comm/eControlMethods.cs similarity index 100% rename from src/Pepperdash Core/Comm/eControlMethods.cs rename to src/Pepperdash.Core/Comm/eControlMethods.cs diff --git a/src/Pepperdash Core/CommunicationExtras.cs b/src/Pepperdash.Core/CommunicationExtras.cs similarity index 99% rename from src/Pepperdash Core/CommunicationExtras.cs rename to src/Pepperdash.Core/CommunicationExtras.cs index e780efd..23ceba9 100644 --- a/src/Pepperdash Core/CommunicationExtras.cs +++ b/src/Pepperdash.Core/CommunicationExtras.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Text; -using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronSockets; using System.Text.RegularExpressions; diff --git a/src/Pepperdash Core/Config/PortalConfigReader.cs b/src/Pepperdash.Core/Config/PortalConfigReader.cs similarity index 100% rename from src/Pepperdash Core/Config/PortalConfigReader.cs rename to src/Pepperdash.Core/Config/PortalConfigReader.cs diff --git a/src/Pepperdash Core/Conversion/Convert.cs b/src/Pepperdash.Core/Conversion/Convert.cs similarity index 100% rename from src/Pepperdash Core/Conversion/Convert.cs rename to src/Pepperdash.Core/Conversion/Convert.cs diff --git a/src/Pepperdash Core/CoreInterfaces.cs b/src/Pepperdash.Core/CoreInterfaces.cs similarity index 100% rename from src/Pepperdash Core/CoreInterfaces.cs rename to src/Pepperdash.Core/CoreInterfaces.cs diff --git a/src/Pepperdash Core/Device.cs b/src/Pepperdash.Core/Device.cs similarity index 100% rename from src/Pepperdash Core/Device.cs rename to src/Pepperdash.Core/Device.cs diff --git a/src/Pepperdash Core/EthernetHelper.cs b/src/Pepperdash.Core/EthernetHelper.cs similarity index 100% rename from src/Pepperdash Core/EthernetHelper.cs rename to src/Pepperdash.Core/EthernetHelper.cs diff --git a/src/Pepperdash Core/EventArgs.cs b/src/Pepperdash.Core/EventArgs.cs similarity index 100% rename from src/Pepperdash Core/EventArgs.cs rename to src/Pepperdash.Core/EventArgs.cs diff --git a/src/Pepperdash Core/GenericRESTfulCommunications/Constants.cs b/src/Pepperdash.Core/GenericRESTfulCommunications/Constants.cs similarity index 100% rename from src/Pepperdash Core/GenericRESTfulCommunications/Constants.cs rename to src/Pepperdash.Core/GenericRESTfulCommunications/Constants.cs diff --git a/src/Pepperdash Core/GenericRESTfulCommunications/GenericRESTfulClient.cs b/src/Pepperdash.Core/GenericRESTfulCommunications/GenericRESTfulClient.cs similarity index 100% rename from src/Pepperdash Core/GenericRESTfulCommunications/GenericRESTfulClient.cs rename to src/Pepperdash.Core/GenericRESTfulCommunications/GenericRESTfulClient.cs diff --git a/src/Pepperdash Core/JsonStandardObjects/EventArgs and Constants.cs b/src/Pepperdash.Core/JsonStandardObjects/EventArgs and Constants.cs similarity index 100% rename from src/Pepperdash Core/JsonStandardObjects/EventArgs and Constants.cs rename to src/Pepperdash.Core/JsonStandardObjects/EventArgs and Constants.cs diff --git a/src/Pepperdash Core/JsonStandardObjects/JsonToSimplDevice.cs b/src/Pepperdash.Core/JsonStandardObjects/JsonToSimplDevice.cs similarity index 100% rename from src/Pepperdash Core/JsonStandardObjects/JsonToSimplDevice.cs rename to src/Pepperdash.Core/JsonStandardObjects/JsonToSimplDevice.cs diff --git a/src/Pepperdash Core/JsonStandardObjects/JsonToSimplDeviceConfig.cs b/src/Pepperdash.Core/JsonStandardObjects/JsonToSimplDeviceConfig.cs similarity index 100% rename from src/Pepperdash Core/JsonStandardObjects/JsonToSimplDeviceConfig.cs rename to src/Pepperdash.Core/JsonStandardObjects/JsonToSimplDeviceConfig.cs diff --git a/src/Pepperdash Core/JsonToSimpl/Constants.cs b/src/Pepperdash.Core/JsonToSimpl/Constants.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/Constants.cs rename to src/Pepperdash.Core/JsonToSimpl/Constants.cs diff --git a/src/Pepperdash Core/JsonToSimpl/Global.cs b/src/Pepperdash.Core/JsonToSimpl/Global.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/Global.cs rename to src/Pepperdash.Core/JsonToSimpl/Global.cs diff --git a/src/Pepperdash Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs rename to src/Pepperdash.Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs diff --git a/src/Pepperdash Core/JsonToSimpl/JsonToSimplChildObjectBase.cs b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplChildObjectBase.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/JsonToSimplChildObjectBase.cs rename to src/Pepperdash.Core/JsonToSimpl/JsonToSimplChildObjectBase.cs diff --git a/src/Pepperdash Core/JsonToSimpl/JsonToSimplFileMaster.cs b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplFileMaster.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/JsonToSimplFileMaster.cs rename to src/Pepperdash.Core/JsonToSimpl/JsonToSimplFileMaster.cs diff --git a/src/Pepperdash Core/JsonToSimpl/JsonToSimplFixedPathObject.cs b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplFixedPathObject.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/JsonToSimplFixedPathObject.cs rename to src/Pepperdash.Core/JsonToSimpl/JsonToSimplFixedPathObject.cs diff --git a/src/Pepperdash Core/JsonToSimpl/JsonToSimplGenericMaster.cs b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplGenericMaster.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/JsonToSimplGenericMaster.cs rename to src/Pepperdash.Core/JsonToSimpl/JsonToSimplGenericMaster.cs diff --git a/src/Pepperdash.Core/JsonToSimpl/JsonToSimplMaster.cs b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplMaster.cs new file mode 100644 index 0000000..a74ba7c --- /dev/null +++ b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplMaster.cs @@ -0,0 +1,264 @@ +using System; +using System.Collections.Generic; +using Crestron.SimplSharp; +using Crestron.SimplSharp.CrestronIO; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace PepperDash.Core.JsonToSimpl +{ + /// + /// Abstract base class for JsonToSimpl interactions + /// + public abstract class JsonToSimplMaster : IKeyed + { + /// + /// Notifies of bool change + /// + public event EventHandler BoolChange; + /// + /// Notifies of ushort change + /// + public event EventHandler UshrtChange; + /// + /// Notifies of string change + /// + public event EventHandler StringChange; + + /// + /// A collection of associated child modules + /// + protected List Children = new List(); + + /*****************************************************************************************/ + + /// + /// Mirrors the Unique ID for now. + /// + public string Key { get { return UniqueID; } } + + /// + /// A unique ID + /// + public string UniqueID { get; protected set; } + + /// + /// Merely for use in debug messages + /// + public string DebugName + { + get { return _DebugName; } + set { if (DebugName == null) _DebugName = ""; else _DebugName = value; } + } + string _DebugName = ""; + + /// + /// This will be prepended to all paths to allow path swapping or for more organized + /// sub-paths + /// + public string PathPrefix { get; set; } + + /// + /// This is added to the end of all paths + /// + public string PathSuffix { get; set; } + + /// + /// Enables debugging output to the console. Certain error messages will be logged to the + /// system's error log regardless of this setting + /// + public bool DebugOn { get; set; } + + /// + /// Ushort helper for Debug property + /// + public ushort UDebug + { + get { return (ushort)(DebugOn ? 1 : 0); } + set + { + DebugOn = (value == 1); + CrestronConsole.PrintLine("JsonToSimpl debug={0}", DebugOn); + } + } + + /// + /// + /// + public JObject JsonObject { get; protected set; } + + /*****************************************************************************************/ + /** Privates **/ + + + // The JSON file in JObject form + // For gathering the incoming data + protected Dictionary UnsavedValues = new Dictionary(); + + /*****************************************************************************************/ + + /// + /// SIMPL+ default constructor. + /// + public JsonToSimplMaster() + { + } + + + /// + /// Sets up class - overriding methods should always call this. + /// + /// + public virtual void Initialize(string uniqueId) + { + UniqueID = uniqueId; + J2SGlobal.AddMaster(this); // Should not re-add + } + + /// + /// Adds a child "module" to this master + /// + /// + public void AddChild(JsonToSimplChildObjectBase child) + { + if (!Children.Contains(child)) + { + Children.Add(child); + } + } + + /// + /// Called from the child to add changed or new values for saving + /// + public void AddUnsavedValue(string path, JValue value) + { + if (UnsavedValues.ContainsKey(path)) + { + Debug.Console(0, "Master[{0}] WARNING - Attempt to add duplicate value for path '{1}'.\r Ingoring. Please ensure that path does not exist on multiple modules.", UniqueID, path); + } + else + UnsavedValues.Add(path, value); + //Debug.Console(0, "Master[{0}] Unsaved size={1}", UniqueID, UnsavedValues.Count); + } + + /// + /// Saves the file + /// + public abstract void Save(); + + + /// + /// + /// + public static class JsonFixes + { + /// + /// Deserializes a string into a JObject + /// + /// + /// + public static JObject ParseObject(string json) + { +#if NET472 + using (var sr = new StringReader(json)) + using (var reader = new JsonTextReader(sr)) + { + var startDepth = reader.Depth; + var obj = JObject.Load(reader); + if (startDepth != reader.Depth) + throw new JsonSerializationException("Unenclosed json found"); + return obj; + } +#else + + using var sr = new System.IO.StringReader(json); + using var reader = new JsonTextReader(sr); + + var startDepth = reader.Depth; + var obj = JObject.Load(reader); + if (startDepth != reader.Depth) + throw new JsonSerializationException("Unenclosed json found"); + return obj; +#endif + } + + /// + /// Deserializes a string into a JArray + /// + /// + /// + public static JArray ParseArray(string json) + { +#if NET472 + using (var sr = new StringReader(json)) + using (var reader = new JsonTextReader(sr)) + { + var startDepth = reader.Depth; + var obj = JArray.Load(reader); + if (startDepth != reader.Depth) + throw new JsonSerializationException("Unenclosed json found"); + return obj; + } +#else + + using var sr = new System.IO.StringReader(json); + using var reader = new JsonTextReader(sr); + + var startDepth = reader.Depth; + var obj = JArray.Load(reader); + if (startDepth != reader.Depth) + throw new JsonSerializationException("Unenclosed json found"); + return obj; +#endif + } + } + + /// + /// Helper event + /// + /// + /// + /// + protected void OnBoolChange(bool state, ushort index, ushort type) + { + if (BoolChange != null) + { + var args = new BoolChangeEventArgs(state, type); + args.Index = index; + BoolChange(this, args); + } + } + + /// + /// Helper event + /// + /// + /// + /// + protected void OnUshrtChange(ushort state, ushort index, ushort type) + { + if (UshrtChange != null) + { + var args = new UshrtChangeEventArgs(state, type); + args.Index = index; + UshrtChange(this, args); + } + } + + /// + /// Helper event + /// + /// + /// + /// + protected void OnStringChange(string value, ushort index, ushort type) + { + if (StringChange != null) + { + var args = new StringChangeEventArgs(value, type); + args.Index = index; + StringChange(this, args); + } + } + } +} diff --git a/src/Pepperdash Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs b/src/Pepperdash.Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs similarity index 100% rename from src/Pepperdash Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs rename to src/Pepperdash.Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs diff --git a/src/Pepperdash Core/Logging/CrestronEnricher.cs b/src/Pepperdash.Core/Logging/CrestronEnricher.cs similarity index 100% rename from src/Pepperdash Core/Logging/CrestronEnricher.cs rename to src/Pepperdash.Core/Logging/CrestronEnricher.cs diff --git a/src/Pepperdash Core/Logging/Debug.cs b/src/Pepperdash.Core/Logging/Debug.cs similarity index 100% rename from src/Pepperdash Core/Logging/Debug.cs rename to src/Pepperdash.Core/Logging/Debug.cs diff --git a/src/Pepperdash Core/Logging/DebugConsoleSink.cs b/src/Pepperdash.Core/Logging/DebugConsoleSink.cs similarity index 100% rename from src/Pepperdash Core/Logging/DebugConsoleSink.cs rename to src/Pepperdash.Core/Logging/DebugConsoleSink.cs diff --git a/src/Pepperdash Core/Logging/DebugContext.cs b/src/Pepperdash.Core/Logging/DebugContext.cs similarity index 100% rename from src/Pepperdash Core/Logging/DebugContext.cs rename to src/Pepperdash.Core/Logging/DebugContext.cs diff --git a/src/Pepperdash Core/Logging/DebugCrestronLoggerSink.cs b/src/Pepperdash.Core/Logging/DebugCrestronLoggerSink.cs similarity index 100% rename from src/Pepperdash Core/Logging/DebugCrestronLoggerSink.cs rename to src/Pepperdash.Core/Logging/DebugCrestronLoggerSink.cs diff --git a/src/Pepperdash Core/Logging/DebugErrorLogSink.cs b/src/Pepperdash.Core/Logging/DebugErrorLogSink.cs similarity index 100% rename from src/Pepperdash Core/Logging/DebugErrorLogSink.cs rename to src/Pepperdash.Core/Logging/DebugErrorLogSink.cs diff --git a/src/Pepperdash Core/Logging/DebugExtensions.cs b/src/Pepperdash.Core/Logging/DebugExtensions.cs similarity index 100% rename from src/Pepperdash Core/Logging/DebugExtensions.cs rename to src/Pepperdash.Core/Logging/DebugExtensions.cs diff --git a/src/Pepperdash Core/Logging/DebugMemory.cs b/src/Pepperdash.Core/Logging/DebugMemory.cs similarity index 100% rename from src/Pepperdash Core/Logging/DebugMemory.cs rename to src/Pepperdash.Core/Logging/DebugMemory.cs diff --git a/src/Pepperdash Core/Logging/DebugWebsocketSink.cs b/src/Pepperdash.Core/Logging/DebugWebsocketSink.cs similarity index 100% rename from src/Pepperdash Core/Logging/DebugWebsocketSink.cs rename to src/Pepperdash.Core/Logging/DebugWebsocketSink.cs diff --git a/src/Pepperdash Core/Network/DiscoveryThings.cs b/src/Pepperdash.Core/Network/DiscoveryThings.cs similarity index 100% rename from src/Pepperdash Core/Network/DiscoveryThings.cs rename to src/Pepperdash.Core/Network/DiscoveryThings.cs diff --git a/src/Pepperdash Core/PasswordManagement/Config.cs b/src/Pepperdash.Core/PasswordManagement/Config.cs similarity index 100% rename from src/Pepperdash Core/PasswordManagement/Config.cs rename to src/Pepperdash.Core/PasswordManagement/Config.cs diff --git a/src/Pepperdash Core/PasswordManagement/Constants.cs b/src/Pepperdash.Core/PasswordManagement/Constants.cs similarity index 100% rename from src/Pepperdash Core/PasswordManagement/Constants.cs rename to src/Pepperdash.Core/PasswordManagement/Constants.cs diff --git a/src/Pepperdash Core/PasswordManagement/OLD-ARRAY-Config.cs b/src/Pepperdash.Core/PasswordManagement/OLD-ARRAY-Config.cs similarity index 100% rename from src/Pepperdash Core/PasswordManagement/OLD-ARRAY-Config.cs rename to src/Pepperdash.Core/PasswordManagement/OLD-ARRAY-Config.cs diff --git a/src/Pepperdash Core/PasswordManagement/OLD-ARRAY-PasswordClient.cs b/src/Pepperdash.Core/PasswordManagement/OLD-ARRAY-PasswordClient.cs similarity index 100% rename from src/Pepperdash Core/PasswordManagement/OLD-ARRAY-PasswordClient.cs rename to src/Pepperdash.Core/PasswordManagement/OLD-ARRAY-PasswordClient.cs diff --git a/src/Pepperdash Core/PasswordManagement/OLD-ARRAY-PasswordManager.cs b/src/Pepperdash.Core/PasswordManagement/OLD-ARRAY-PasswordManager.cs similarity index 100% rename from src/Pepperdash Core/PasswordManagement/OLD-ARRAY-PasswordManager.cs rename to src/Pepperdash.Core/PasswordManagement/OLD-ARRAY-PasswordManager.cs diff --git a/src/Pepperdash Core/PasswordManagement/PasswordClient.cs b/src/Pepperdash.Core/PasswordManagement/PasswordClient.cs similarity index 100% rename from src/Pepperdash Core/PasswordManagement/PasswordClient.cs rename to src/Pepperdash.Core/PasswordManagement/PasswordClient.cs diff --git a/src/Pepperdash Core/PasswordManagement/PasswordManager.cs b/src/Pepperdash.Core/PasswordManagement/PasswordManager.cs similarity index 100% rename from src/Pepperdash Core/PasswordManagement/PasswordManager.cs rename to src/Pepperdash.Core/PasswordManagement/PasswordManager.cs diff --git a/src/Pepperdash.Core/PepperDash.Core.csproj b/src/Pepperdash.Core/PepperDash.Core.csproj new file mode 100644 index 0000000..0dfc22c --- /dev/null +++ b/src/Pepperdash.Core/PepperDash.Core.csproj @@ -0,0 +1,60 @@ + + + PepperDash.Core + PepperDashCore + net472;net6.0;net8.0 + true + en + bin\$(Configuration)\ + False + True + PepperDash Core + PepperDash Technologies + git + https://github.com/PepperDash/PepperDashCore + crestron;4series; + 2.0.0-local + $(Version) + ../../package + true + + + full + TRACE;DEBUG;SERIES4 + + + pdbonly + bin\4Series\$(Configuration)\PepperDashCore.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Pepperdash Core/Properties/ControlSystem.cfg b/src/Pepperdash.Core/Properties/ControlSystem.cfg similarity index 100% rename from src/Pepperdash Core/Properties/ControlSystem.cfg rename to src/Pepperdash.Core/Properties/ControlSystem.cfg diff --git a/src/Pepperdash Core/SystemInfo/EventArgs and Constants.cs b/src/Pepperdash.Core/SystemInfo/EventArgs and Constants.cs similarity index 100% rename from src/Pepperdash Core/SystemInfo/EventArgs and Constants.cs rename to src/Pepperdash.Core/SystemInfo/EventArgs and Constants.cs diff --git a/src/Pepperdash Core/SystemInfo/SystemInfoConfig.cs b/src/Pepperdash.Core/SystemInfo/SystemInfoConfig.cs similarity index 100% rename from src/Pepperdash Core/SystemInfo/SystemInfoConfig.cs rename to src/Pepperdash.Core/SystemInfo/SystemInfoConfig.cs diff --git a/src/Pepperdash Core/SystemInfo/SystemInfoToSimpl.cs b/src/Pepperdash.Core/SystemInfo/SystemInfoToSimpl.cs similarity index 100% rename from src/Pepperdash Core/SystemInfo/SystemInfoToSimpl.cs rename to src/Pepperdash.Core/SystemInfo/SystemInfoToSimpl.cs diff --git a/src/Pepperdash Core/Web/BouncyCertificate.cs b/src/Pepperdash.Core/Web/BouncyCertificate.cs similarity index 100% rename from src/Pepperdash Core/Web/BouncyCertificate.cs rename to src/Pepperdash.Core/Web/BouncyCertificate.cs diff --git a/src/Pepperdash Core/Web/RequestHandlers/DefaultRequestHandler.cs b/src/Pepperdash.Core/Web/RequestHandlers/DefaultRequestHandler.cs similarity index 100% rename from src/Pepperdash Core/Web/RequestHandlers/DefaultRequestHandler.cs rename to src/Pepperdash.Core/Web/RequestHandlers/DefaultRequestHandler.cs diff --git a/src/Pepperdash Core/Web/RequestHandlers/WebApiBaseRequestAsyncHandler.cs b/src/Pepperdash.Core/Web/RequestHandlers/WebApiBaseRequestAsyncHandler.cs similarity index 100% rename from src/Pepperdash Core/Web/RequestHandlers/WebApiBaseRequestAsyncHandler.cs rename to src/Pepperdash.Core/Web/RequestHandlers/WebApiBaseRequestAsyncHandler.cs diff --git a/src/Pepperdash Core/Web/RequestHandlers/WebApiBaseRequestHandler.cs b/src/Pepperdash.Core/Web/RequestHandlers/WebApiBaseRequestHandler.cs similarity index 100% rename from src/Pepperdash Core/Web/RequestHandlers/WebApiBaseRequestHandler.cs rename to src/Pepperdash.Core/Web/RequestHandlers/WebApiBaseRequestHandler.cs diff --git a/src/Pepperdash Core/Web/WebApiServer.cs b/src/Pepperdash.Core/Web/WebApiServer.cs similarity index 100% rename from src/Pepperdash Core/Web/WebApiServer.cs rename to src/Pepperdash.Core/Web/WebApiServer.cs diff --git a/src/Pepperdash Core/WebApi/Presets/Preset.cs b/src/Pepperdash.Core/WebApi/Presets/Preset.cs similarity index 100% rename from src/Pepperdash Core/WebApi/Presets/Preset.cs rename to src/Pepperdash.Core/WebApi/Presets/Preset.cs diff --git a/src/Pepperdash Core/WebApi/Presets/User.cs b/src/Pepperdash.Core/WebApi/Presets/User.cs similarity index 100% rename from src/Pepperdash Core/WebApi/Presets/User.cs rename to src/Pepperdash.Core/WebApi/Presets/User.cs diff --git a/src/Pepperdash Core/WebApi/Presets/WebApiPasscodeClient.cs b/src/Pepperdash.Core/WebApi/Presets/WebApiPasscodeClient.cs similarity index 100% rename from src/Pepperdash Core/WebApi/Presets/WebApiPasscodeClient.cs rename to src/Pepperdash.Core/WebApi/Presets/WebApiPasscodeClient.cs diff --git a/src/Pepperdash Core/XSigUtility/Serialization/IXSigSerialization.cs b/src/Pepperdash.Core/XSigUtility/Serialization/IXSigSerialization.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/Serialization/IXSigSerialization.cs rename to src/Pepperdash.Core/XSigUtility/Serialization/IXSigSerialization.cs diff --git a/src/Pepperdash Core/XSigUtility/Serialization/XSigSerializationException.cs b/src/Pepperdash.Core/XSigUtility/Serialization/XSigSerializationException.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/Serialization/XSigSerializationException.cs rename to src/Pepperdash.Core/XSigUtility/Serialization/XSigSerializationException.cs diff --git a/src/Pepperdash Core/XSigUtility/Tokens/XSigAnalogToken.cs b/src/Pepperdash.Core/XSigUtility/Tokens/XSigAnalogToken.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/Tokens/XSigAnalogToken.cs rename to src/Pepperdash.Core/XSigUtility/Tokens/XSigAnalogToken.cs diff --git a/src/Pepperdash Core/XSigUtility/Tokens/XSigDigitalToken.cs b/src/Pepperdash.Core/XSigUtility/Tokens/XSigDigitalToken.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/Tokens/XSigDigitalToken.cs rename to src/Pepperdash.Core/XSigUtility/Tokens/XSigDigitalToken.cs diff --git a/src/Pepperdash Core/XSigUtility/Tokens/XSigSerialToken.cs b/src/Pepperdash.Core/XSigUtility/Tokens/XSigSerialToken.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/Tokens/XSigSerialToken.cs rename to src/Pepperdash.Core/XSigUtility/Tokens/XSigSerialToken.cs diff --git a/src/Pepperdash Core/XSigUtility/Tokens/XSigToken.cs b/src/Pepperdash.Core/XSigUtility/Tokens/XSigToken.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/Tokens/XSigToken.cs rename to src/Pepperdash.Core/XSigUtility/Tokens/XSigToken.cs diff --git a/src/Pepperdash Core/XSigUtility/Tokens/XSigTokenType.cs b/src/Pepperdash.Core/XSigUtility/Tokens/XSigTokenType.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/Tokens/XSigTokenType.cs rename to src/Pepperdash.Core/XSigUtility/Tokens/XSigTokenType.cs diff --git a/src/Pepperdash Core/XSigUtility/XSigHelpers.cs b/src/Pepperdash.Core/XSigUtility/XSigHelpers.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/XSigHelpers.cs rename to src/Pepperdash.Core/XSigUtility/XSigHelpers.cs diff --git a/src/Pepperdash Core/XSigUtility/XSigTokenStreamReader.cs b/src/Pepperdash.Core/XSigUtility/XSigTokenStreamReader.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/XSigTokenStreamReader.cs rename to src/Pepperdash.Core/XSigUtility/XSigTokenStreamReader.cs diff --git a/src/Pepperdash Core/XSigUtility/XSigTokenStreamWriter.cs b/src/Pepperdash.Core/XSigUtility/XSigTokenStreamWriter.cs similarity index 100% rename from src/Pepperdash Core/XSigUtility/XSigTokenStreamWriter.cs rename to src/Pepperdash.Core/XSigUtility/XSigTokenStreamWriter.cs