fix: update target frameworks and package references; change culture to InvariantCulture

This commit is contained in:
jtalborough 2025-02-25 19:17:34 -05:00 committed by Neil Dorin
parent dbab427d69
commit 8be5481ac9
29 changed files with 160 additions and 64 deletions

View file

@ -1,14 +1,14 @@
<Project> <Project>
<ItemGroup> <ItemGroup>
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz" Condition="$(ProjectType) == 'Library'"> <None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).clz" Condition="$(ProjectType) == 'Library' And '$(TargetFramework)' != '' And '$(TargetName)' != '' And '$(TargetDir)' != ''">
<Pack>true</Pack> <Pack>true</Pack>
<PackagePath>build;</PackagePath> <PackagePath>build;</PackagePath>
</None> </None>
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz" Condition="$(ProjectType) == 'Program'"> <None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cpz" Condition="$(ProjectType) == 'Program' And '$(TargetFramework)' != '' And '$(TargetName)' != '' And '$(TargetDir)' != '' And ( '$(TargetFramework)' != 'net6.0' ) And ( '$(TargetFramework)' != 'net8.0' )">
<Pack>true</Pack> <Pack>true</Pack>
<PackagePath>build;</PackagePath> <PackagePath>build;</PackagePath>
</None> </None>
<None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz" Condition="$(ProjectType) == 'ProgramLibrary'"> <None Include="$(TargetDir)$(TargetName).$(Version).$(TargetFramework).cplz" Condition="$(ProjectType) == 'ProgramLibrary' And '$(TargetFramework)' != '' And '$(TargetName)' != '' And '$(TargetDir)' != ''">
<Pack>true</Pack> <Pack>true</Pack>
<PackagePath>build;</PackagePath> <PackagePath>build;</PackagePath>
</None> </None>

View file

@ -1,7 +1,12 @@
using System; extern alias NewtonsoftJson;
using System;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Newtonsoft.Json; using JsonConverter = NewtonsoftJson::Newtonsoft.Json.JsonConverterAttribute;
using Newtonsoft.Json.Converters; 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 namespace PepperDash.Core
{ {

View file

@ -1,10 +1,13 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets; using Crestron.SimplSharp.CrestronSockets;
using Newtonsoft.Json; using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
using Required = NewtonsoftJson::Newtonsoft.Json.Required;
namespace PepperDash.Core namespace PepperDash.Core
{ {

View file

@ -1,12 +1,15 @@
 
extern alias NewtonsoftJson;
using System; using System;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets; using Crestron.SimplSharp.CrestronSockets;
using Newtonsoft.Json; using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
using PepperDash.Core.Logging; using PepperDash.Core.Logging;
using Required = NewtonsoftJson::Newtonsoft.Json.Required;
namespace PepperDash.Core namespace PepperDash.Core
{ {

View file

@ -1,4 +1,6 @@
using Newtonsoft.Json; extern alias NewtonsoftJson;
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
namespace PepperDash.Core namespace PepperDash.Core
{ {

View file

@ -1,8 +1,12 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets; 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 namespace PepperDash.Core
{ {
@ -88,7 +92,7 @@ namespace PepperDash.Core
/// The current socket status of the client /// The current socket status of the client
/// </summary> /// </summary>
[JsonProperty("clientStatus")] [JsonProperty("clientStatus")]
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
SocketStatus ClientStatus { get; } SocketStatus ClientStatus { get; }
} }

View file

@ -1,12 +1,18 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Linq; using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
using Newtonsoft.Json.Linq; 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 PepperDash.Core;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Core.Config namespace PepperDash.Core.Config
{ {
@ -56,12 +62,12 @@ namespace PepperDash.Core.Config
var merged = MergeConfigs(jsonObj); var merged = MergeConfigs(jsonObj);
if (jsonObj[systemUrl] != null) if (jsonObj[systemUrl] != null)
{ {
merged[systemUrl] = jsonObj[systemUrl].Value<string>(); merged[systemUrl] = (string)jsonObj[systemUrl];
} }
if (jsonObj[templateUrl] != null) if (jsonObj[templateUrl] != null)
{ {
merged[templateUrl] = jsonObj[templateUrl].Value<string>(); merged[templateUrl] = (string)jsonObj[templateUrl];
} }
jsonObj = merged; jsonObj = merged;

View file

@ -1,9 +1,11 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Newtonsoft.Json; using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
using Serilog; using Serilog;
namespace PepperDash.Core namespace PepperDash.Core

View file

@ -1,5 +1,7 @@
using Crestron.SimplSharp; extern alias NewtonsoftJson;
using Newtonsoft.Json;
using Crestron.SimplSharp;
using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Core namespace PepperDash.Core

View file

@ -1,6 +1,8 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Linq; using System.Linq;
using Newtonsoft.Json.Linq; using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Core.JsonToSimpl namespace PepperDash.Core.JsonToSimpl
@ -129,7 +131,7 @@ namespace PepperDash.Core.JsonToSimpl
var item = array.FirstOrDefault(o => var item = array.FirstOrDefault(o =>
{ {
var prop = o[SearchPropertyName]; var prop = o[SearchPropertyName];
return prop != null && prop.Value<string>() return prop != null && ((string)prop)
.Equals(SearchPropertyValue, StringComparison.OrdinalIgnoreCase); .Equals(SearchPropertyValue, StringComparison.OrdinalIgnoreCase);
}); });
if (item == null) if (item == null)

View file

@ -1,7 +1,9 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Newtonsoft.Json.Linq; using JValue = NewtonsoftJson::Newtonsoft.Json.Linq.JValue;
namespace PepperDash.Core.JsonToSimpl namespace PepperDash.Core.JsonToSimpl
{ {
@ -233,7 +235,7 @@ namespace PepperDash.Core.JsonToSimpl
if (isCount) if (isCount)
response = (t.HasValues ? t.Children().Count() : 0).ToString(); response = (t.HasValues ? t.Children().Count() : 0).ToString();
else else
response = t.Value<string>(); response = (string)t;
Debug.Console(1, " ='{0}'", response); Debug.Console(1, " ='{0}'", response);
return true; return true;
} }

View file

@ -1,11 +1,15 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO; 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 namespace PepperDash.Core.JsonToSimpl
{ {

View file

@ -1,7 +1,10 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Crestron.SimplSharp; 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 namespace PepperDash.Core.JsonToSimpl
{ {

View file

@ -1,10 +1,15 @@
extern alias NewtonsoftJson;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using JArray = NewtonsoftJson::Newtonsoft.Json.Linq.JArray;
using Newtonsoft.Json.Linq; 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 namespace PepperDash.Core.JsonToSimpl
{ {
@ -165,7 +170,7 @@ namespace PepperDash.Core.JsonToSimpl
#if NET6_0 #if NET6_0
using (var reader = new JsonTextReader(new System.IO.StringReader(json))) using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
#else #else
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json))) using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
#endif #endif
{ {
var startDepth = reader.Depth; var startDepth = reader.Depth;
@ -189,7 +194,7 @@ namespace PepperDash.Core.JsonToSimpl
#if NET6_0 #if NET6_0
using (var reader = new JsonTextReader(new System.IO.StringReader(json))) using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
#else #else
using (var reader = new JsonTextReader(new Crestron.SimplSharp.CrestronIO.StringReader(json))) using (var reader = new JsonTextReader(new System.IO.StringReader(json)))
#endif #endif
{ {
var startDepth = reader.Depth; var startDepth = reader.Depth;

View file

@ -1,9 +1,12 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO; 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; using PepperDash.Core.Config;
namespace PepperDash.Core.JsonToSimpl namespace PepperDash.Core.JsonToSimpl

View file

@ -1,4 +1,6 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
@ -7,7 +9,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronDataStore; using Crestron.SimplSharp.CrestronDataStore;
using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.CrestronLogger; using Crestron.SimplSharp.CrestronLogger;
using Newtonsoft.Json; using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert;
using PepperDash.Core.Logging; using PepperDash.Core.Logging;
using Serilog; using Serilog;
using Serilog.Context; using Serilog.Context;

View file

@ -1,9 +1,12 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert;
namespace PepperDash.Core namespace PepperDash.Core

View file

@ -1,6 +1,8 @@
using System.Collections.Generic; extern alias NewtonsoftJson;
using System.Collections.Generic;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Newtonsoft.Json; using JsonProperty = NewtonsoftJson::Newtonsoft.Json.JsonPropertyAttribute;
namespace PepperDash.Core.Logging namespace PepperDash.Core.Logging
{ {

View file

@ -1,4 +1,6 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -16,7 +18,7 @@ using X509Certificate2 = System.Security.Cryptography.X509Certificates.X509Certi
using System.IO; using System.IO;
using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Asn1.X509;
using Serilog.Formatting; using Serilog.Formatting;
using Newtonsoft.Json.Linq; using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
using Serilog.Formatting.Json; using Serilog.Formatting.Json;
namespace PepperDash.Core namespace PepperDash.Core

View file

@ -44,6 +44,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" /> <PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.90" /> <PackageReference Include="Crestron.SimplSharp.SDK.Library" Version="2.21.90" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4">
<Aliases>global,NewtonsoftJson</Aliases>
</PackageReference>
<PackageReference Include="Serilog" Version="3.1.1" /> <PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Expressions" Version="4.0.0" /> <PackageReference Include="Serilog.Expressions" Version="4.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" /> <PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" />
@ -53,7 +56,9 @@
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" /> <PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6'"> <ItemGroup Condition="'$(TargetFramework)' == 'net6'">
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3">
<Aliases>global,NewtonsoftJson</Aliases>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Comm\._GenericSshClient.cs" /> <Compile Remove="Comm\._GenericSshClient.cs" />

View file

@ -1,10 +1,13 @@
using System; extern alias NewtonsoftJson;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.WebScripting; using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json; using Formatting = NewtonsoftJson::Newtonsoft.Json.Formatting;
using Newtonsoft.Json.Linq; using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert;
using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
using PepperDash.Core.Web.RequestHandlers; using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Core.Web namespace PepperDash.Core.Web

View file

@ -1,10 +1,12 @@
using System; extern alias NewtonsoftJson;
using System;
using Crestron.SimplSharp; // For Basic SIMPL# Classes using Crestron.SimplSharp; // For Basic SIMPL# Classes
using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharp.Net.Https; using Crestron.SimplSharp.Net.Https;
using Newtonsoft.Json; using JsonConvert = NewtonsoftJson::Newtonsoft.Json.JsonConvert;
using Newtonsoft.Json.Linq; using JObject = NewtonsoftJson::Newtonsoft.Json.Linq.JObject;
using PepperDash.Core.JsonToSimpl; using PepperDash.Core.JsonToSimpl;

View file

@ -54,9 +54,10 @@ namespace PepperDash.Essentials.Core
// TODO: consider making this configurable later // TODO: consider making this configurable later
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
public static IFormatProvider Culture = CultureInfo.CreateSpecificCulture("en-US"); public static IFormatProvider Culture = CultureInfo.InvariantCulture;
/// <summary> /// <summary>
/// True when the processor type is a DMPS variant /// True when the processor type is a DMPS variant

View file

@ -3,7 +3,7 @@
<Configurations>Debug;Release;Debug 4.7.2</Configurations> <Configurations>Debug;Release;Debug 4.7.2</Configurations>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net472</TargetFramework> <TargetFrameworks>net6;net8</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<OutputPath>bin\$(Configuration)\</OutputPath> <OutputPath>bin\$(Configuration)\</OutputPath>

View file

@ -3,7 +3,7 @@
<Configurations>Debug;Release;Debug 4.7.2</Configurations> <Configurations>Debug;Release;Debug 4.7.2</Configurations>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net472</TargetFramework> <TargetFrameworks>net6;net8</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<OutputPath>bin\$(Configuration)\</OutputPath> <OutputPath>bin\$(Configuration)\</OutputPath>
<AssemblyName>Essentials Devices Common</AssemblyName> <AssemblyName>Essentials Devices Common</AssemblyName>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<RootNamespace>PepperDash.Essentials.AppServer</RootNamespace> <RootNamespace>PepperDash.Essentials.AppServer</RootNamespace>
<TargetFramework>net472</TargetFramework> <TargetFrameworks>net6;net8</TargetFrameworks>
<AssemblyTitle>mobile-control-messengers</AssemblyTitle> <AssemblyTitle>mobile-control-messengers</AssemblyTitle>
<AssemblyName>mobile-control-messengers</AssemblyName> <AssemblyName>mobile-control-messengers</AssemblyName>
<Product>mobile-control-messengers</Product> <Product>mobile-control-messengers</Product>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<RootNamespace>PepperDash.Essentials</RootNamespace> <RootNamespace>PepperDash.Essentials</RootNamespace>
<TargetFramework>net472</TargetFramework> <TargetFrameworks>net6;net8</TargetFrameworks>
<EnableDynamicLoading>true</EnableDynamicLoading> <EnableDynamicLoading>true</EnableDynamicLoading>
<Deterministic>false</Deterministic> <Deterministic>false</Deterministic>
<AssemblyTitle>epi-essentials-mobile-control</AssemblyTitle> <AssemblyTitle>epi-essentials-mobile-control</AssemblyTitle>

View file

@ -1,4 +1,4 @@
using System; using System;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -12,7 +12,6 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Core.Web;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Essentials namespace PepperDash.Essentials
@ -33,12 +32,39 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public ControlSystem() public ControlSystem()
: base() : base()
{ {
Thread.MaxNumberOfUserThreads = 400; Thread.MaxNumberOfUserThreads = 400;
Global.ControlSystem = this; Global.ControlSystem = this;
DeviceManager.Initialize(this); DeviceManager.Initialize(this);
SecretsManager.Initialize(); SecretsManager.Initialize();
SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true; 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;
} }
/// <summary> /// <summary>
@ -75,6 +101,9 @@ namespace PepperDash.Essentials
{ {
DeterminePlatform(); DeterminePlatform();
// Print .NET runtime version
Debug.LogMessage(LogEventLevel.Information, "Running on .NET runtime version: {0}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
if (Debug.DoNotLoadConfigOnNextBoot) if (Debug.DoNotLoadConfigOnNextBoot)
{ {
CrestronConsole.AddNewConsoleCommand(s => CrestronInvoke.BeginInvoke((o) => GoWithLoad()), "go", "Loads configuration file", CrestronConsole.AddNewConsoleCommand(s => CrestronInvoke.BeginInvoke((o) => GoWithLoad()), "go", "Loads configuration file",
@ -123,7 +152,7 @@ namespace PepperDash.Essentials
CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts, CrestronConsole.AddNewConsoleCommand(DeviceManager.GetRoutingPorts,
"getroutingports", "Reports all routing ports, if any. Requires a device key", ConsoleAccessLevelEnum.AccessOperator); "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) if (!Debug.DoNotLoadConfigOnNextBoot)
{ {

View file

@ -6,9 +6,9 @@
<PropertyGroup> <PropertyGroup>
<RootNamespace>PepperDash.Essentials</RootNamespace> <RootNamespace>PepperDash.Essentials</RootNamespace>
<AssemblyName>PepperDashEssentials</AssemblyName> <AssemblyName>PepperDashEssentials</AssemblyName>
<TargetFramework>net472</TargetFramework> <TargetFrameworks>net6;net8</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<OutputPath>bin\$(Configuration)\</OutputPath> <OutputPath>$(ProjectDir)bin\$(Configuration)\</OutputPath>
<Title>PepperDash Essentials</Title> <Title>PepperDash Essentials</Title>
<PackageId>PepperDashEssentials</PackageId> <PackageId>PepperDashEssentials</PackageId>
<InformationalVersion>$(Version)</InformationalVersion> <InformationalVersion>$(Version)</InformationalVersion>