From 8be5481ac969b0036c8647f8554849bed8c6a0c8 Mon Sep 17 00:00:00 2001 From: jtalborough Date: Tue, 25 Feb 2025 19:17:34 -0500 Subject: [PATCH] fix: update target frameworks and package references; change culture to InvariantCulture --- src/Directory.Build.targets | 6 ++-- .../Comm/ControlPropertiesConfig.cs | 11 ++++-- .../Comm/GenericTcpIpClient.cs | 7 ++-- src/PepperDash.Core/Comm/GenericUdpServer.cs | 5 ++- .../Comm/TcpClientConfigObject.cs | 4 ++- src/PepperDash.Core/CommunicationExtras.cs | 10 ++++-- .../Config/PortalConfigReader.cs | 16 ++++++--- src/PepperDash.Core/CoreInterfaces.cs | 6 ++-- src/PepperDash.Core/EthernetHelper.cs | 6 ++-- .../JsonToSimplArrayLookupChild.cs | 8 +++-- .../JsonToSimpl/JsonToSimplChildObjectBase.cs | 8 +++-- .../JsonToSimpl/JsonToSimplFileMaster.cs | 8 +++-- .../JsonToSimpl/JsonToSimplGenericMaster.cs | 7 ++-- .../JsonToSimpl/JsonToSimplMaster.cs | 13 ++++--- .../JsonToSimplPortalFileMaster.cs | 7 ++-- src/PepperDash.Core/Logging/Debug.cs | 7 ++-- src/PepperDash.Core/Logging/DebugContext.cs | 7 ++-- src/PepperDash.Core/Logging/DebugMemory.cs | 6 ++-- .../Logging/DebugWebsocketSink.cs | 6 ++-- src/PepperDash.Core/PepperDash.Core.csproj | 7 +++- src/PepperDash.Core/Web/WebApiServer.cs | 9 +++-- .../WebApi/Presets/WebApiPasscodeClient.cs | 8 +++-- .../Global/Global.cs | 5 +-- .../PepperDash.Essentials.Core.csproj | 2 +- ...epperDash.Essentials.Devices.Common.csproj | 2 +- ...Essentials.MobileControl.Messengers.csproj | 2 +- ...PepperDash.Essentials.MobileControl.csproj | 2 +- src/PepperDash.Essentials/ControlSystem.cs | 35 +++++++++++++++++-- .../PepperDash.Essentials.csproj | 4 +-- 29 files changed, 160 insertions(+), 64 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index ce6c0eed..50816cf4 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,14 +1,14 @@ - + true build; - + true build; - + true build; diff --git a/src/PepperDash.Core/Comm/ControlPropertiesConfig.cs b/src/PepperDash.Core/Comm/ControlPropertiesConfig.cs index c665dad8..a7d2300a 100644 --- a/src/PepperDash.Core/Comm/ControlPropertiesConfig.cs +++ b/src/PepperDash.Core/Comm/ControlPropertiesConfig.cs @@ -1,7 +1,12 @@ -using System; +extern alias NewtonsoftJson; + +using System; using Crestron.SimplSharp; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using JsonConverter = NewtonsoftJson::Newtonsoft.Json.JsonConverterAttribute; +using JsonIgnore = NewtonsoftJson::Newtonsoft.Json.JsonIgnoreAttribute; +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; +using NullValueHandling = NewtonsoftJson::Newtonsoft.Json.NullValueHandling; +using StringEnumConverter = NewtonsoftJson::Newtonsoft.Json.Converters.StringEnumConverter; namespace PepperDash.Core { diff --git a/src/PepperDash.Core/Comm/GenericTcpIpClient.cs b/src/PepperDash.Core/Comm/GenericTcpIpClient.cs index d13eed3f..16963099 100644 --- a/src/PepperDash.Core/Comm/GenericTcpIpClient.cs +++ b/src/PepperDash.Core/Comm/GenericTcpIpClient.cs @@ -1,10 +1,13 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Linq; using System.Text; using System.Text.RegularExpressions; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronSockets; -using Newtonsoft.Json; +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; +using Required = NewtonsoftJson::Newtonsoft.Json.Required; namespace PepperDash.Core { diff --git a/src/PepperDash.Core/Comm/GenericUdpServer.cs b/src/PepperDash.Core/Comm/GenericUdpServer.cs index a713872a..34df1444 100644 --- a/src/PepperDash.Core/Comm/GenericUdpServer.cs +++ b/src/PepperDash.Core/Comm/GenericUdpServer.cs @@ -1,12 +1,15 @@  +extern alias NewtonsoftJson; + using System; using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronSockets; -using Newtonsoft.Json; +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; using PepperDash.Core.Logging; +using Required = NewtonsoftJson::Newtonsoft.Json.Required; namespace PepperDash.Core { diff --git a/src/PepperDash.Core/Comm/TcpClientConfigObject.cs b/src/PepperDash.Core/Comm/TcpClientConfigObject.cs index 226473bf..e2137d4a 100644 --- a/src/PepperDash.Core/Comm/TcpClientConfigObject.cs +++ b/src/PepperDash.Core/Comm/TcpClientConfigObject.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json; +extern alias NewtonsoftJson; + +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; namespace PepperDash.Core { diff --git a/src/PepperDash.Core/CommunicationExtras.cs b/src/PepperDash.Core/CommunicationExtras.cs index a8bc57d3..1fcce75b 100644 --- a/src/PepperDash.Core/CommunicationExtras.cs +++ b/src/PepperDash.Core/CommunicationExtras.cs @@ -1,8 +1,12 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronSockets; -using Newtonsoft.Json; +using JsonConverter = NewtonsoftJson::Newtonsoft.Json.JsonConverterAttribute; +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; +using StringEnumConverter = NewtonsoftJson::Newtonsoft.Json.Converters.StringEnumConverter; namespace PepperDash.Core { @@ -88,7 +92,7 @@ namespace PepperDash.Core /// The current socket status of the client /// [JsonProperty("clientStatus")] - [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + [JsonConverter(typeof(StringEnumConverter))] SocketStatus ClientStatus { get; } } diff --git a/src/PepperDash.Core/Config/PortalConfigReader.cs b/src/PepperDash.Core/Config/PortalConfigReader.cs index 41ca2cbd..b7c5c784 100644 --- a/src/PepperDash.Core/Config/PortalConfigReader.cs +++ b/src/PepperDash.Core/Config/PortalConfigReader.cs @@ -1,12 +1,18 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting; +using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; +using JToken = NewtonsoftJson::Newtonsoft.Json.Linq.JToken; using PepperDash.Core; using Serilog.Events; + + namespace PepperDash.Core.Config { @@ -56,12 +62,12 @@ namespace PepperDash.Core.Config var merged = MergeConfigs(jsonObj); if (jsonObj[systemUrl] != null) { - merged[systemUrl] = jsonObj[systemUrl].Value(); + merged[systemUrl] = (string)jsonObj[systemUrl]; } if (jsonObj[templateUrl] != null) { - merged[templateUrl] = jsonObj[templateUrl].Value(); + merged[templateUrl] = (string)jsonObj[templateUrl]; } jsonObj = merged; diff --git a/src/PepperDash.Core/CoreInterfaces.cs b/src/PepperDash.Core/CoreInterfaces.cs index 6e0b639e..c334cc00 100644 --- a/src/PepperDash.Core/CoreInterfaces.cs +++ b/src/PepperDash.Core/CoreInterfaces.cs @@ -1,9 +1,11 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Newtonsoft.Json; +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; using Serilog; namespace PepperDash.Core diff --git a/src/PepperDash.Core/EthernetHelper.cs b/src/PepperDash.Core/EthernetHelper.cs index 76a9405c..20709eb1 100644 --- a/src/PepperDash.Core/EthernetHelper.cs +++ b/src/PepperDash.Core/EthernetHelper.cs @@ -1,5 +1,7 @@ -using Crestron.SimplSharp; -using Newtonsoft.Json; +extern alias NewtonsoftJson; + +using Crestron.SimplSharp; +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; using Serilog.Events; namespace PepperDash.Core diff --git a/src/PepperDash.Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs b/src/PepperDash.Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs index 268f6207..559fc87d 100644 --- a/src/PepperDash.Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs +++ b/src/PepperDash.Core/JsonToSimpl/JsonToSimplArrayLookupChild.cs @@ -1,6 +1,8 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Linq; -using Newtonsoft.Json.Linq; +using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray; using Serilog.Events; namespace PepperDash.Core.JsonToSimpl @@ -129,7 +131,7 @@ namespace PepperDash.Core.JsonToSimpl var item = array.FirstOrDefault(o => { var prop = o[SearchPropertyName]; - return prop != null && prop.Value() + return prop != null && ((string)prop) .Equals(SearchPropertyValue, StringComparison.OrdinalIgnoreCase); }); if (item == null) diff --git a/src/PepperDash.Core/JsonToSimpl/JsonToSimplChildObjectBase.cs b/src/PepperDash.Core/JsonToSimpl/JsonToSimplChildObjectBase.cs index 68e4bf91..e7da9c9c 100644 --- a/src/PepperDash.Core/JsonToSimpl/JsonToSimplChildObjectBase.cs +++ b/src/PepperDash.Core/JsonToSimpl/JsonToSimplChildObjectBase.cs @@ -1,7 +1,9 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Linq; -using Newtonsoft.Json.Linq; +using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue; namespace PepperDash.Core.JsonToSimpl { @@ -233,7 +235,7 @@ namespace PepperDash.Core.JsonToSimpl if (isCount) response = (t.HasValues ? t.Children().Count() : 0).ToString(); else - response = t.Value(); + response = (string)t; Debug.Console(1, " ='{0}'", response); return true; } diff --git a/src/PepperDash.Core/JsonToSimpl/JsonToSimplFileMaster.cs b/src/PepperDash.Core/JsonToSimpl/JsonToSimplFileMaster.cs index 13354fdd..bf44e2b2 100644 --- a/src/PepperDash.Core/JsonToSimpl/JsonToSimplFileMaster.cs +++ b/src/PepperDash.Core/JsonToSimpl/JsonToSimplFileMaster.cs @@ -1,11 +1,15 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Newtonsoft.Json.Linq; +using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; +using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue; namespace PepperDash.Core.JsonToSimpl { diff --git a/src/PepperDash.Core/JsonToSimpl/JsonToSimplGenericMaster.cs b/src/PepperDash.Core/JsonToSimpl/JsonToSimplGenericMaster.cs index 14f7eaa8..c065f577 100644 --- a/src/PepperDash.Core/JsonToSimpl/JsonToSimplGenericMaster.cs +++ b/src/PepperDash.Core/JsonToSimpl/JsonToSimplGenericMaster.cs @@ -1,7 +1,10 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using Crestron.SimplSharp; -using Newtonsoft.Json.Linq; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; +using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue; namespace PepperDash.Core.JsonToSimpl { diff --git a/src/PepperDash.Core/JsonToSimpl/JsonToSimplMaster.cs b/src/PepperDash.Core/JsonToSimpl/JsonToSimplMaster.cs index b3fa92a3..bc965e92 100644 --- a/src/PepperDash.Core/JsonToSimpl/JsonToSimplMaster.cs +++ b/src/PepperDash.Core/JsonToSimpl/JsonToSimplMaster.cs @@ -1,10 +1,15 @@ +extern alias NewtonsoftJson; + using System; using System.Collections.Generic; using System.IO; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; +using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue; +using JsonSerializationException = NewtonsoftJson::Newtonsoft.Json.JsonSerializationException; +using JsonTextReader = NewtonsoftJson::Newtonsoft.Json.JsonTextReader; namespace PepperDash.Core.JsonToSimpl { @@ -165,7 +170,7 @@ namespace PepperDash.Core.JsonToSimpl #if NET6_0 using (var reader = new JsonTextReader(new System.IO.StringReader(json))) #else - using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json))) + using (var reader = new JsonTextReader(new System.IO.StringReader(json))) #endif { var startDepth = reader.Depth; @@ -189,7 +194,7 @@ namespace PepperDash.Core.JsonToSimpl #if NET6_0 using (var reader = new JsonTextReader(new System.IO.StringReader(json))) #else - using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json))) + using (var reader = new JsonTextReader(new System.IO.StringReader(json))) #endif { var startDepth = reader.Depth; diff --git a/src/PepperDash.Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs b/src/PepperDash.Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs index e142d1bc..acadc99a 100644 --- a/src/PepperDash.Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs +++ b/src/PepperDash.Core/JsonToSimpl/JsonToSimplPortalFileMaster.cs @@ -1,9 +1,12 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Newtonsoft.Json.Linq; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; +using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue; using PepperDash.Core.Config; namespace PepperDash.Core.JsonToSimpl diff --git a/src/PepperDash.Core/Logging/Debug.cs b/src/PepperDash.Core/Logging/Debug.cs index 877d8997..49d55eb4 100644 --- a/src/PepperDash.Core/Logging/Debug.cs +++ b/src/PepperDash.Core/Logging/Debug.cs @@ -1,4 +1,6 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Net; using System.Reflection; @@ -7,7 +9,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronDataStore; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronLogger; -using Newtonsoft.Json; +using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting; +using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert; using PepperDash.Core.Logging; using Serilog; using Serilog.Context; diff --git a/src/PepperDash.Core/Logging/DebugContext.cs b/src/PepperDash.Core/Logging/DebugContext.cs index e90ec86a..cdea6837 100644 --- a/src/PepperDash.Core/Logging/DebugContext.cs +++ b/src/PepperDash.Core/Logging/DebugContext.cs @@ -1,9 +1,12 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Newtonsoft.Json; +using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting; +using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert; namespace PepperDash.Core diff --git a/src/PepperDash.Core/Logging/DebugMemory.cs b/src/PepperDash.Core/Logging/DebugMemory.cs index 286707b8..327d04b4 100644 --- a/src/PepperDash.Core/Logging/DebugMemory.cs +++ b/src/PepperDash.Core/Logging/DebugMemory.cs @@ -1,6 +1,8 @@ -using System.Collections.Generic; +extern alias NewtonsoftJson; + +using System.Collections.Generic; using Crestron.SimplSharp; -using Newtonsoft.Json; +using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute; namespace PepperDash.Core.Logging { diff --git a/src/PepperDash.Core/Logging/DebugWebsocketSink.cs b/src/PepperDash.Core/Logging/DebugWebsocketSink.cs index 9c3df14e..856abbdb 100644 --- a/src/PepperDash.Core/Logging/DebugWebsocketSink.cs +++ b/src/PepperDash.Core/Logging/DebugWebsocketSink.cs @@ -1,4 +1,6 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -16,7 +18,7 @@ using X509Certificate2 = System.Security.Cryptography.X509Certificates.X509Certi using System.IO; using Org.BouncyCastle.Asn1.X509; using Serilog.Formatting; -using Newtonsoft.Json.Linq; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; using Serilog.Formatting.Json; namespace PepperDash.Core diff --git a/src/PepperDash.Core/PepperDash.Core.csproj b/src/PepperDash.Core/PepperDash.Core.csproj index daa5c6da..875e6275 100644 --- a/src/PepperDash.Core/PepperDash.Core.csproj +++ b/src/PepperDash.Core/PepperDash.Core.csproj @@ -44,6 +44,9 @@ + + global,NewtonsoftJson + @@ -53,7 +56,9 @@ - + + global,NewtonsoftJson + diff --git a/src/PepperDash.Core/Web/WebApiServer.cs b/src/PepperDash.Core/Web/WebApiServer.cs index 11ec4e2f..42bc555b 100644 --- a/src/PepperDash.Core/Web/WebApiServer.cs +++ b/src/PepperDash.Core/Web/WebApiServer.cs @@ -1,10 +1,13 @@ -using System; +extern alias NewtonsoftJson; + +using System; using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharp.WebScripting; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting; +using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; using PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Core.Web diff --git a/src/PepperDash.Core/WebApi/Presets/WebApiPasscodeClient.cs b/src/PepperDash.Core/WebApi/Presets/WebApiPasscodeClient.cs index f8c815fd..831d2d02 100644 --- a/src/PepperDash.Core/WebApi/Presets/WebApiPasscodeClient.cs +++ b/src/PepperDash.Core/WebApi/Presets/WebApiPasscodeClient.cs @@ -1,10 +1,12 @@ -using System; +extern alias NewtonsoftJson; + +using System; using Crestron.SimplSharp; // For Basic SIMPL# Classes using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Https; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert; +using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject; using PepperDash.Core.JsonToSimpl; diff --git a/src/PepperDash.Essentials.Core/Global/Global.cs b/src/PepperDash.Essentials.Core/Global/Global.cs index 37d4472d..571f5017 100644 --- a/src/PepperDash.Essentials.Core/Global/Global.cs +++ b/src/PepperDash.Essentials.Core/Global/Global.cs @@ -54,9 +54,10 @@ namespace PepperDash.Essentials.Core // TODO: consider making this configurable later /// - /// The CultureInfo for formatting + /// Gets or sets the CultureInfo for the running system. Default is InvariantCulture. This is used for all parsing and formatting in Essentials to ensure consistent behavior regardless of the culture settings of the processor. /// - public static IFormatProvider Culture = CultureInfo.CreateSpecificCulture("en-US"); + public static IFormatProvider Culture = CultureInfo.InvariantCulture; + /// /// True when the processor type is a DMPS variant diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index 251ba316..5087ac20 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -3,7 +3,7 @@ Debug;Release;Debug 4.7.2 - net472 + net6;net8 true true bin\$(Configuration)\ diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index 7be4372d..ec3a1d70 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -3,7 +3,7 @@ Debug;Release;Debug 4.7.2 - net472 + net6;net8 true bin\$(Configuration)\ Essentials Devices Common diff --git a/src/PepperDash.Essentials.MobileControl.Messengers/PepperDash.Essentials.MobileControl.Messengers.csproj b/src/PepperDash.Essentials.MobileControl.Messengers/PepperDash.Essentials.MobileControl.Messengers.csproj index d13d1a09..1a5a5c0d 100644 --- a/src/PepperDash.Essentials.MobileControl.Messengers/PepperDash.Essentials.MobileControl.Messengers.csproj +++ b/src/PepperDash.Essentials.MobileControl.Messengers/PepperDash.Essentials.MobileControl.Messengers.csproj @@ -1,7 +1,7 @@  PepperDash.Essentials.AppServer - net472 + net6;net8 mobile-control-messengers mobile-control-messengers mobile-control-messengers diff --git a/src/PepperDash.Essentials.MobileControl/PepperDash.Essentials.MobileControl.csproj b/src/PepperDash.Essentials.MobileControl/PepperDash.Essentials.MobileControl.csproj index 235e0899..f7a7b016 100644 --- a/src/PepperDash.Essentials.MobileControl/PepperDash.Essentials.MobileControl.csproj +++ b/src/PepperDash.Essentials.MobileControl/PepperDash.Essentials.MobileControl.csproj @@ -1,7 +1,7 @@  PepperDash.Essentials - net472 + net6;net8 true false epi-essentials-mobile-control diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index 6fbcf06c..608c362f 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO.Compression; using System.Linq; using System.Reflection; @@ -12,7 +12,6 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; -using PepperDash.Essentials.Core.Web; using Serilog.Events; namespace PepperDash.Essentials @@ -33,12 +32,39 @@ namespace PepperDash.Essentials /// public ControlSystem() : base() + { + Thread.MaxNumberOfUserThreads = 400; Global.ControlSystem = this; DeviceManager.Initialize(this); SecretsManager.Initialize(); SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true; + + Debug.SetErrorLogMinimumDebugLevel(CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? LogEventLevel.Warning : LogEventLevel.Verbose); + + // AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve; + } + + private System.Reflection.Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args) + { + var assemblyName = new System.Reflection.AssemblyName(args.Name).Name; + if (assemblyName == "PepperDash_Core") + { + return System.Reflection.Assembly.LoadFrom("PepperDashCore.dll"); + } + + if (assemblyName == "PepperDash_Essentials_Core") + { + return System.Reflection.Assembly.LoadFrom("PepperDash.Essentials.Core.dll"); + } + + if (assemblyName == "Essentials Devices Common") + { + return System.Reflection.Assembly.LoadFrom("PepperDash.Essentials.Devices.Common.dll"); + } + + return null; } /// @@ -75,6 +101,9 @@ namespace PepperDash.Essentials { DeterminePlatform(); + // Print .NET runtime version + Debug.LogMessage(LogEventLevel.Information, "Running on .NET runtime version: {0}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription); + if (Debug.DoNotLoadConfigOnNextBoot) { CrestronConsole.AddNewConsoleCommand(s => CrestronInvoke.BeginInvoke((o) => GoWithLoad()), "go", "Loads configuration file", @@ -123,7 +152,7 @@ namespace PepperDash.Essentials CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts, "getroutingports", "Reports all routing ports, if any. Requires a device key", ConsoleAccessLevelEnum.AccessOperator); - DeviceManager.AddDevice(new EssentialsWebApi("essentialsWebApi", "Essentials Web API")); + //DeviceManager.AddDevice(new EssentialsWebApi("essentialsWebApi", "Essentials Web API")); if (!Debug.DoNotLoadConfigOnNextBoot) { diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index 20a42ffd..9150191d 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -6,9 +6,9 @@ PepperDash.Essentials PepperDashEssentials - net472 + net6;net8 true - bin\$(Configuration)\ + $(ProjectDir)bin\$(Configuration)\ PepperDash Essentials PepperDashEssentials $(Version)