mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-01-11 19:44:44 +00:00
fix: sln names and package versions
- adjusted the sln and csproj name - bumped the crestron sdk - added in newtonsoft 13.0 conditionally for net6/8 - fixed a few issues where we were using crestron newtonsoft specific methods
This commit is contained in:
BIN
._Readme.md
BIN
._Readme.md
Binary file not shown.
@@ -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
|
||||
22
PepperDash.Core.sln
Normal file
22
PepperDash.Core.sln
Normal file
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for JsonToSimpl interactions
|
||||
/// </summary>
|
||||
public abstract class JsonToSimplMaster : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Notifies of bool change
|
||||
/// </summary>
|
||||
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
||||
/// <summary>
|
||||
/// Notifies of ushort change
|
||||
/// </summary>
|
||||
public event EventHandler<UshrtChangeEventArgs> UshrtChange;
|
||||
/// <summary>
|
||||
/// Notifies of string change
|
||||
/// </summary>
|
||||
public event EventHandler<StringChangeEventArgs> StringChange;
|
||||
|
||||
/// <summary>
|
||||
/// A collection of associated child modules
|
||||
/// </summary>
|
||||
protected List<JsonToSimplChildObjectBase> Children = new List<JsonToSimplChildObjectBase>();
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors the Unique ID for now.
|
||||
/// </summary>
|
||||
public string Key { get { return UniqueID; } }
|
||||
|
||||
/// <summary>
|
||||
/// A unique ID
|
||||
/// </summary>
|
||||
public string UniqueID { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Merely for use in debug messages
|
||||
/// </summary>
|
||||
public string DebugName
|
||||
{
|
||||
get { return _DebugName; }
|
||||
set { if (DebugName == null) _DebugName = ""; else _DebugName = value; }
|
||||
}
|
||||
string _DebugName = "";
|
||||
|
||||
/// <summary>
|
||||
/// This will be prepended to all paths to allow path swapping or for more organized
|
||||
/// sub-paths
|
||||
/// </summary>
|
||||
public string PathPrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is added to the end of all paths
|
||||
/// </summary>
|
||||
public string PathSuffix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables debugging output to the console. Certain error messages will be logged to the
|
||||
/// system's error log regardless of this setting
|
||||
/// </summary>
|
||||
public bool DebugOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ushort helper for Debug property
|
||||
/// </summary>
|
||||
public ushort UDebug
|
||||
{
|
||||
get { return (ushort)(DebugOn ? 1 : 0); }
|
||||
set
|
||||
{
|
||||
DebugOn = (value == 1);
|
||||
CrestronConsole.PrintLine("JsonToSimpl debug={0}", DebugOn);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public JObject JsonObject { get; protected set; }
|
||||
|
||||
/*****************************************************************************************/
|
||||
/** Privates **/
|
||||
|
||||
|
||||
// The JSON file in JObject form
|
||||
// For gathering the incoming data
|
||||
protected Dictionary<string, JValue> UnsavedValues = new Dictionary<string, JValue>();
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// SIMPL+ default constructor.
|
||||
/// </summary>
|
||||
public JsonToSimplMaster()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets up class - overriding methods should always call this.
|
||||
/// </summary>
|
||||
/// <param name="uniqueId"></param>
|
||||
public virtual void Initialize(string uniqueId)
|
||||
{
|
||||
UniqueID = uniqueId;
|
||||
J2SGlobal.AddMaster(this); // Should not re-add
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a child "module" to this master
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
public void AddChild(JsonToSimplChildObjectBase child)
|
||||
{
|
||||
if (!Children.Contains(child))
|
||||
{
|
||||
Children.Add(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called from the child to add changed or new values for saving
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the file
|
||||
/// </summary>
|
||||
public abstract void Save();
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class JsonFixes
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserializes a string into a JObject
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a string into a JArray
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper event
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="type"></param>
|
||||
protected void OnBoolChange(bool state, ushort index, ushort type)
|
||||
{
|
||||
if (BoolChange != null)
|
||||
{
|
||||
var args = new BoolChangeEventArgs(state, type);
|
||||
args.Index = index;
|
||||
BoolChange(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper event
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="type"></param>
|
||||
protected void OnUshrtChange(ushort state, ushort index, ushort type)
|
||||
{
|
||||
if (UshrtChange != null)
|
||||
{
|
||||
var args = new UshrtChangeEventArgs(state, type);
|
||||
args.Index = index;
|
||||
UshrtChange(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper event
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="type"></param>
|
||||
protected void OnStringChange(string value, ushort index, ushort type)
|
||||
{
|
||||
if (StringChange != null)
|
||||
{
|
||||
var args = new StringChangeEventArgs(value, type);
|
||||
args.Index = index;
|
||||
StringChange(this, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<RootNamespace>PepperDash.Core</RootNamespace>
|
||||
<AssemblyName>PepperDashCore</AssemblyName>
|
||||
<TargetFrameworks>net472;net6</TargetFrameworks>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NeutralLanguage>en</NeutralLanguage>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<SignAssembly>False</SignAssembly>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Title>PepperDash Core</Title>
|
||||
<Company>PepperDash Technologies</Company>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/PepperDash/PepperDashCore</RepositoryUrl>
|
||||
<PackageTags>crestron;4series;</PackageTags>
|
||||
<Version>2.0.0-local</Version>
|
||||
<InformationalVersion>$(Version)</InformationalVersion>
|
||||
<PackageOutputPath>../../package</PackageOutputPath>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<DefineConstants>TRACE;DEBUG;SERIES4</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DocumentationFile>bin\4Series\$(Configuration)\PepperDashCore.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BouncyCastle" Version="1.8.9" />
|
||||
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.20.66" />
|
||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
||||
<PackageReference Include="Serilog.Expressions" Version="4.0.0" />
|
||||
<PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Comm\._GenericSshClient.cs" />
|
||||
<Compile Remove="Comm\._GenericTcpIpClient.cs" />
|
||||
<Compile Remove="Comm\DynamicTCPServer.cs" />
|
||||
<Compile Remove="PasswordManagement\OLD-ARRAY-Config.cs" />
|
||||
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordClient.cs" />
|
||||
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordManager.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
264
src/Pepperdash.Core/JsonToSimpl/JsonToSimplMaster.cs
Normal file
264
src/Pepperdash.Core/JsonToSimpl/JsonToSimplMaster.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for JsonToSimpl interactions
|
||||
/// </summary>
|
||||
public abstract class JsonToSimplMaster : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Notifies of bool change
|
||||
/// </summary>
|
||||
public event EventHandler<BoolChangeEventArgs> BoolChange;
|
||||
/// <summary>
|
||||
/// Notifies of ushort change
|
||||
/// </summary>
|
||||
public event EventHandler<UshrtChangeEventArgs> UshrtChange;
|
||||
/// <summary>
|
||||
/// Notifies of string change
|
||||
/// </summary>
|
||||
public event EventHandler<StringChangeEventArgs> StringChange;
|
||||
|
||||
/// <summary>
|
||||
/// A collection of associated child modules
|
||||
/// </summary>
|
||||
protected List<JsonToSimplChildObjectBase> Children = new List<JsonToSimplChildObjectBase>();
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors the Unique ID for now.
|
||||
/// </summary>
|
||||
public string Key { get { return UniqueID; } }
|
||||
|
||||
/// <summary>
|
||||
/// A unique ID
|
||||
/// </summary>
|
||||
public string UniqueID { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Merely for use in debug messages
|
||||
/// </summary>
|
||||
public string DebugName
|
||||
{
|
||||
get { return _DebugName; }
|
||||
set { if (DebugName == null) _DebugName = ""; else _DebugName = value; }
|
||||
}
|
||||
string _DebugName = "";
|
||||
|
||||
/// <summary>
|
||||
/// This will be prepended to all paths to allow path swapping or for more organized
|
||||
/// sub-paths
|
||||
/// </summary>
|
||||
public string PathPrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is added to the end of all paths
|
||||
/// </summary>
|
||||
public string PathSuffix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables debugging output to the console. Certain error messages will be logged to the
|
||||
/// system's error log regardless of this setting
|
||||
/// </summary>
|
||||
public bool DebugOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ushort helper for Debug property
|
||||
/// </summary>
|
||||
public ushort UDebug
|
||||
{
|
||||
get { return (ushort)(DebugOn ? 1 : 0); }
|
||||
set
|
||||
{
|
||||
DebugOn = (value == 1);
|
||||
CrestronConsole.PrintLine("JsonToSimpl debug={0}", DebugOn);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public JObject JsonObject { get; protected set; }
|
||||
|
||||
/*****************************************************************************************/
|
||||
/** Privates **/
|
||||
|
||||
|
||||
// The JSON file in JObject form
|
||||
// For gathering the incoming data
|
||||
protected Dictionary<string, JValue> UnsavedValues = new Dictionary<string, JValue>();
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// SIMPL+ default constructor.
|
||||
/// </summary>
|
||||
public JsonToSimplMaster()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets up class - overriding methods should always call this.
|
||||
/// </summary>
|
||||
/// <param name="uniqueId"></param>
|
||||
public virtual void Initialize(string uniqueId)
|
||||
{
|
||||
UniqueID = uniqueId;
|
||||
J2SGlobal.AddMaster(this); // Should not re-add
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a child "module" to this master
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
public void AddChild(JsonToSimplChildObjectBase child)
|
||||
{
|
||||
if (!Children.Contains(child))
|
||||
{
|
||||
Children.Add(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called from the child to add changed or new values for saving
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the file
|
||||
/// </summary>
|
||||
public abstract void Save();
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class JsonFixes
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserializes a string into a JObject
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a string into a JArray
|
||||
/// </summary>
|
||||
/// <param name="json"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper event
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="type"></param>
|
||||
protected void OnBoolChange(bool state, ushort index, ushort type)
|
||||
{
|
||||
if (BoolChange != null)
|
||||
{
|
||||
var args = new BoolChangeEventArgs(state, type);
|
||||
args.Index = index;
|
||||
BoolChange(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper event
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="type"></param>
|
||||
protected void OnUshrtChange(ushort state, ushort index, ushort type)
|
||||
{
|
||||
if (UshrtChange != null)
|
||||
{
|
||||
var args = new UshrtChangeEventArgs(state, type);
|
||||
args.Index = index;
|
||||
UshrtChange(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper event
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="type"></param>
|
||||
protected void OnStringChange(string value, ushort index, ushort type)
|
||||
{
|
||||
if (StringChange != null)
|
||||
{
|
||||
var args = new StringChangeEventArgs(value, type);
|
||||
args.Index = index;
|
||||
StringChange(this, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
src/Pepperdash.Core/PepperDash.Core.csproj
Normal file
60
src/Pepperdash.Core/PepperDash.Core.csproj
Normal file
@@ -0,0 +1,60 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<RootNamespace>PepperDash.Core</RootNamespace>
|
||||
<AssemblyName>PepperDashCore</AssemblyName>
|
||||
<TargetFrameworks>net472;net6.0;net8.0</TargetFrameworks>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NeutralLanguage>en</NeutralLanguage>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<SignAssembly>False</SignAssembly>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Title>PepperDash Core</Title>
|
||||
<Company>PepperDash Technologies</Company>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/PepperDash/PepperDashCore</RepositoryUrl>
|
||||
<PackageTags>crestron;4series;</PackageTags>
|
||||
<Version>2.0.0-local</Version>
|
||||
<InformationalVersion>$(Version)</InformationalVersion>
|
||||
<PackageOutputPath>../../package</PackageOutputPath>
|
||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<DefineConstants>TRACE;DEBUG;SERIES4</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DocumentationFile>bin\4Series\$(Configuration)\PepperDashCore.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BouncyCastle" Version="1.8.9" />
|
||||
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.65" />
|
||||
<PackageReference Include="Serilog" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Expressions" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Comm\._GenericSshClient.cs" />
|
||||
<Compile Remove="Comm\._GenericTcpIpClient.cs" />
|
||||
<Compile Remove="Comm\DynamicTCPServer.cs" />
|
||||
<Compile Remove="PasswordManagement\OLD-ARRAY-Config.cs" />
|
||||
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordClient.cs" />
|
||||
<Compile Remove="PasswordManagement\OLD-ARRAY-PasswordManager.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user