fix: remove references to Crestron.SimplSharp.CrestronIO

Replaced with System.IO. Also modified calls as necessary due to differences in API
This commit is contained in:
Andrew Welker
2025-08-13 22:11:37 -05:00
parent 9c81546a07
commit 083c270cf3
32 changed files with 3504 additions and 3509 deletions

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
@@ -12,8 +12,8 @@ namespace PepperDash.Core.Config;
/// <summary> /// <summary>
/// Reads a Portal formatted config file /// Reads a Portal formatted config file
/// </summary> /// </summary>
public class PortalConfigReader public class PortalConfigReader
{ {
/// <summary> /// <summary>
/// Reads the config file, checks if it needs a merge, merges and saves, then returns the merged Object. /// Reads the config file, checks if it needs a merge, merges and saves, then returns the merged Object.
/// </summary> /// </summary>
@@ -31,7 +31,7 @@ namespace PepperDash.Core.Config;
using (StreamReader fs = new StreamReader(filePath)) using (StreamReader fs = new StreamReader(filePath))
{ {
var jsonObj = JObject.Parse(fs.ReadToEnd()); var jsonObj = JObject.Parse(fs.ReadToEnd());
if(jsonObj["template"] != null && jsonObj["system"] != null) if (jsonObj["template"] != null && jsonObj["system"] != null)
{ {
// it's a double-config, merge it. // it's a double-config, merge it.
var merged = MergeConfigs(jsonObj); var merged = MergeConfigs(jsonObj);
@@ -231,4 +231,4 @@ namespace PepperDash.Core.Config;
} }
return o1; return o1;
} }
} }

View File

@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using static Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Http;
using static Crestron.SimplSharp.Net.Https; using Crestron.SimplSharp.Net.Https;
namespace PepperDash.Core.GenericRESTfulCommunications; namespace PepperDash.Core.GenericRESTfulCommunications;

View File

@@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
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 Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace PepperDash.Core.JsonToSimpl; namespace PepperDash.Core.JsonToSimpl;
@@ -92,7 +92,7 @@ public class JsonToSimplFileMaster : JsonToSimplMaster
OnStringChange(roomName, 0, JsonToSimplConstants.RoomNameChange); OnStringChange(roomName, 0, JsonToSimplConstants.RoomNameChange);
} }
var rootDirectory = Directory.GetApplicationRootDirectory(); var rootDirectory = Directory.GetCurrentDirectory();
OnStringChange(rootDirectory, 0, JsonToSimplConstants.RootDirectoryChange); OnStringChange(rootDirectory, 0, JsonToSimplConstants.RootDirectoryChange);
var splusPath = string.Empty; var splusPath = string.Empty;
@@ -161,7 +161,7 @@ public class JsonToSimplFileMaster : JsonToSimplMaster
OnStringChange(string.Format(@"JSON File Path is {0}", actualFile.DirectoryName), 0, JsonToSimplConstants.StringValueChange); OnStringChange(string.Format(@"JSON File Path is {0}", actualFile.DirectoryName), 0, JsonToSimplConstants.StringValueChange);
Debug.Console(1, "JSON File Path is {0}", FilePathName); Debug.Console(1, "JSON File Path is {0}", FilePathName);
var json = File.ReadToEnd(ActualFilePath, System.Text.Encoding.ASCII); var json = File.ReadAllText(ActualFilePath, System.Text.Encoding.ASCII);
JsonObject = JObject.Parse(json); JsonObject = JObject.Parse(json);
foreach (var child in Children) foreach (var child in Children)

View File

@@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core.Config; using PepperDash.Core.Config;
@@ -92,7 +92,7 @@ public class JsonToSimplPortalFileMaster : JsonToSimplMaster
// At this point we should have a local file. Do it. // At this point we should have a local file. Do it.
Debug.Console(1, "Reading local JSON file {0}", ActualFilePath); Debug.Console(1, "Reading local JSON file {0}", ActualFilePath);
string json = File.ReadToEnd(ActualFilePath, System.Text.Encoding.ASCII); string json = File.ReadAllText(ActualFilePath, System.Text.Encoding.ASCII);
try try
{ {
@@ -187,4 +187,4 @@ public class JsonToSimplPortalFileMaster : JsonToSimplMaster
} }
} }
} }
} }

View File

@@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronDataStore; using Crestron.SimplSharp.CrestronDataStore;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.CrestronLogger; using Crestron.SimplSharp.CrestronLogger;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core.Logging; using PepperDash.Core.Logging;
@@ -142,8 +142,8 @@ public static class Debug
_websocketSink = new DebugWebsocketSink(new JsonFormatter(renderMessage: true)); _websocketSink = new DebugWebsocketSink(new JsonFormatter(renderMessage: true));
var logFilePath = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? var logFilePath = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ?
$@"{Directory.GetApplicationRootDirectory()}{Path.DirectorySeparatorChar}user{Path.DirectorySeparatorChar}debug{Path.DirectorySeparatorChar}app{InitialParametersClass.ApplicationNumber}{Path.DirectorySeparatorChar}global-log.log" : $@"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}user{Path.DirectorySeparatorChar}debug{Path.DirectorySeparatorChar}app{InitialParametersClass.ApplicationNumber}{Path.DirectorySeparatorChar}global-log.log" :
$@"{Directory.GetApplicationRootDirectory()}{Path.DirectorySeparatorChar}user{Path.DirectorySeparatorChar}debug{Path.DirectorySeparatorChar}room{InitialParametersClass.RoomId}{Path.DirectorySeparatorChar}global-log.log"; $@"{Directory.GetCurrentDirectory()}{Path.DirectorySeparatorChar}user{Path.DirectorySeparatorChar}debug{Path.DirectorySeparatorChar}room{InitialParametersClass.RoomId}{Path.DirectorySeparatorChar}global-log.log";
CrestronConsole.PrintLine($"Saving log files to {logFilePath}"); CrestronConsole.PrintLine($"Saving log files to {logFilePath}");
@@ -1004,7 +1004,7 @@ public static class Debug
return string.Format(@"\user\debugSettings\program{0}", InitialParametersClass.ApplicationNumber); return string.Format(@"\user\debugSettings\program{0}", InitialParametersClass.ApplicationNumber);
} }
return string.Format("{0}{1}user{1}debugSettings{1}{2}.json", Directory.GetApplicationRootDirectory(), Path.DirectorySeparatorChar, InitialParametersClass.RoomId); return string.Format("{0}{1}user{1}debugSettings{1}{2}.json", Directory.GetCurrentDirectory(), Path.DirectorySeparatorChar, InitialParametersClass.RoomId);
} }
/// <summary> /// <summary>

View File

@@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Newtonsoft.Json;

View File

@@ -2,15 +2,15 @@
namespace PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Core.Web.RequestHandlers;
/// <summary> /// <summary>
/// Web API default request handler /// Web API default request handler
/// </summary> /// </summary>
public class DefaultRequestHandler : WebApiBaseRequestHandler public class DefaultRequestHandler : WebApiBaseRequestHandler
{ {
/// <summary> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
public DefaultRequestHandler() public DefaultRequestHandler()
: base(true) : base(true)
{ } { }
} }

View File

@@ -1,11 +1,11 @@
using Crestron.SimplSharp.WebScripting; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Crestron.SimplSharp.WebScripting;
namespace PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Core.Web.RequestHandlers;
public abstract class WebApiBaseRequestAsyncHandler:IHttpCwsHandler public abstract class WebApiBaseRequestAsyncHandler : IHttpCwsHandler
{ {
private readonly Dictionary<string, Func<HttpCwsContext, Task>> _handlers; private readonly Dictionary<string, Func<HttpCwsContext, Task>> _handlers;
protected readonly bool EnableCors; protected readonly bool EnableCors;

View File

@@ -4,11 +4,11 @@ using Crestron.SimplSharp.WebScripting;
namespace PepperDash.Core.Web.RequestHandlers; namespace PepperDash.Core.Web.RequestHandlers;
/// <summary> /// <summary>
/// CWS Base Handler, implements IHttpCwsHandler /// CWS Base Handler, implements IHttpCwsHandler
/// </summary> /// </summary>
public abstract class WebApiBaseRequestHandler : IHttpCwsHandler public abstract class WebApiBaseRequestHandler : IHttpCwsHandler
{ {
private readonly Dictionary<string, Action<HttpCwsContext>> _handlers; private readonly Dictionary<string, Action<HttpCwsContext>> _handlers;
protected readonly bool EnableCors; protected readonly bool EnableCors;
@@ -161,4 +161,4 @@ namespace PepperDash.Core.Web.RequestHandlers;
handler(context); handler(context);
} }
} }

View File

@@ -9,11 +9,11 @@ using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Core.Web; namespace PepperDash.Core.Web;
/// <summary> /// <summary>
/// Web API server /// Web API server
/// </summary> /// </summary>
public class WebApiServer : IKeyName public class WebApiServer : IKeyName
{ {
private const string SplusKey = "Uninitialized Web API Server"; private const string SplusKey = "Uninitialized Web API Server";
private const string DefaultName = "Web API Server"; private const string DefaultName = "Web API Server";
private const string DefaultBasePath = "/api"; private const string DefaultBasePath = "/api";
@@ -280,4 +280,4 @@ namespace PepperDash.Core.Web;
Debug.Console(DebugVerbose, this, "ReceivedRequestEventHandler Exception InnerException: {0}", ex.InnerException); Debug.Console(DebugVerbose, this, "ReceivedRequestEventHandler Exception InnerException: {0}", ex.InnerException);
} }
} }
} }

View File

@@ -1,11 +1,11 @@
using System; using System;
using System.IO;
using Crestron.SimplSharp; // For Basic SIMPL# Classes 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;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core.JsonToSimpl; using PepperDash.Core.JsonToSimpl;
using static Crestron.SimplSharp.Net.Http;
using static Crestron.SimplSharp.Net.Https;
namespace PepperDash.Core.WebApi.Presets; namespace PepperDash.Core.WebApi.Presets;

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using Crestron.SimplSharp.CrestronIO;
using PepperDash.Core.Intersystem.Serialization; using PepperDash.Core.Intersystem.Serialization;
using PepperDash.Core.Intersystem.Tokens; using PepperDash.Core.Intersystem.Tokens;

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Crestron.SimplSharp.CrestronIO; using System.IO;
using PepperDash.Core.Intersystem.Serialization; using PepperDash.Core.Intersystem.Serialization;
using PepperDash.Core.Intersystem.Tokens; using PepperDash.Core.Intersystem.Tokens;

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using Crestron.SimplSharp.CrestronIO; using System.IO;
using System.Linq;
using PepperDash.Core.Intersystem.Serialization; using PepperDash.Core.Intersystem.Serialization;
using PepperDash.Core.Intersystem.Tokens; using PepperDash.Core.Intersystem.Tokens;

View File

@@ -2,10 +2,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
@@ -14,11 +13,11 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public static class IRPortHelper public static class IRPortHelper
{ {
public static string IrDriverPathPrefix public static string IrDriverPathPrefix
{ {
get get
@@ -151,18 +150,18 @@ namespace PepperDash.Essentials.Core;
return null; return null;
} }
var postActivationFunc = new Func<DeviceConfig,IROutputPort> (GetIrOutputPort); var postActivationFunc = new Func<DeviceConfig, IROutputPort>(GetIrOutputPort);
var irDevice = new IrOutputPortController(config.Key + "-ir", postActivationFunc, config); var irDevice = new IrOutputPortController(config.Key + "-ir", postActivationFunc, config);
return irDevice; return irDevice;
} }
/* /*
/// <summary> /// <summary>
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object. /// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
/// </summary> /// </summary>
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf) public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
{ {
var irControllerKey = devConf.Key + "-ir"; var irControllerKey = devConf.Key + "-ir";
if (devConf.Properties == null) if (devConf.Properties == null)
{ {
@@ -219,14 +218,14 @@ namespace PepperDash.Essentials.Core;
portDevKey, portNum); portDevKey, portNum);
return c; return c;
} }
}*/ }*/
} }
/// <summary> /// <summary>
/// Wrapper to help in IR port creation /// Wrapper to help in IR port creation
/// </summary> /// </summary>
public class IrOutPortConfig public class IrOutPortConfig
{ {
[JsonProperty("port")] [JsonProperty("port")]
public IROutputPort Port { get; set; } public IROutputPort Port { get; set; }
@@ -240,4 +239,4 @@ namespace PepperDash.Essentials.Core;
{ {
FileName = ""; FileName = "";
} }
} }

View File

@@ -2,10 +2,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
@@ -47,7 +46,7 @@ public class DeviceConfig
//Properties = JToken.FromObject(dc.Properties); //Properties = JToken.FromObject(dc.Properties);
} }
public DeviceConfig() {} public DeviceConfig() { }
} }
/// <summary> /// <summary>

View File

@@ -1,10 +1,10 @@
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
@@ -13,11 +13,11 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.Config;
/// <summary> /// <summary>
/// Loads the ConfigObject from the file /// Loads the ConfigObject from the file
/// </summary> /// </summary>
public class ConfigReader public class ConfigReader
{ {
public const string LocalConfigPresent = public const string LocalConfigPresent =
@" @"
*************************************************** ***************************************************
@@ -50,7 +50,7 @@ namespace PepperDash.Essentials.Core.Config;
"****Error: Multiple Local Configuration files present. Please ensure only a single file exists and reset program.****"); "****Error: Multiple Local Configuration files present. Please ensure only a single file exists and reset program.****");
return false; return false;
} }
if(configFiles.Length == 1) if (configFiles.Length == 1)
{ {
localConfigFound = true; localConfigFound = true;
@@ -64,7 +64,7 @@ namespace PepperDash.Essentials.Core.Config;
} }
// Check for Portal Config // Check for Portal Config
if(!localConfigFound) if (!localConfigFound)
{ {
filePath = Global.FilePathPrefix + Global.ConfigFileName; filePath = Global.FilePathPrefix + Global.ConfigFileName;
@@ -253,4 +253,4 @@ namespace PepperDash.Essentials.Core.Config;
Debug.LogMessage(LogEventLevel.Information, newDebugString.ToString()); Debug.LogMessage(LogEventLevel.Information, newDebugString.ToString());
} }
} }

View File

@@ -2,15 +2,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharpPro.Diagnostics; using Crestron.SimplSharpPro.Diagnostics;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using Serilog.Events; using Serilog.Events;
@@ -71,7 +70,7 @@ public static class ConfigUpdater
{ {
var handler = ConfigStatusChanged; var handler = ConfigStatusChanged;
if(handler != null) if (handler != null)
{ {
handler(typeof(ConfigUpdater), new ConfigStatusEventArgs(status)); handler(typeof(ConfigUpdater), new ConfigStatusEventArgs(status));
} }
@@ -79,7 +78,7 @@ public static class ConfigUpdater
static void WriteConfigToFile(string configData) static void WriteConfigToFile(string configData)
{ {
var filePath = Global.FilePathPrefix+ "configurationFile-updated.json"; var filePath = Global.FilePathPrefix + "configurationFile-updated.json";
try try
{ {
@@ -132,18 +131,18 @@ public static class ConfigUpdater
if (!Directory.Exists(archiveDirectoryPath)) if (!Directory.Exists(archiveDirectoryPath))
{ {
// Directory does not exist, create it // Directory does not exist, create it
Directory.Create(archiveDirectoryPath); Directory.CreateDirectory(archiveDirectoryPath);
} }
else else
{ {
// Directory exists, first clear any contents // Directory exists, first clear any contents
var archivedConfigFiles = ConfigReader.GetConfigFiles(archiveDirectoryPath + Global.DirectorySeparator + Global.ConfigFileName + ".bak"); var archivedConfigFiles = ConfigReader.GetConfigFiles(archiveDirectoryPath + Global.DirectorySeparator + Global.ConfigFileName + ".bak");
if(archivedConfigFiles != null || archivedConfigFiles.Length > 0) if (archivedConfigFiles != null || archivedConfigFiles.Length > 0)
{ {
Debug.LogMessage(LogEventLevel.Information, "{0} Existing files found in archive folder. Deleting.", archivedConfigFiles.Length); Debug.LogMessage(LogEventLevel.Information, "{0} Existing files found in archive folder. Deleting.", archivedConfigFiles.Length);
for (int i = 0; i < archivedConfigFiles.Length; i++ ) for (int i = 0; i < archivedConfigFiles.Length; i++)
{ {
var file = archivedConfigFiles[i]; var file = archivedConfigFiles[i];
Debug.LogMessage(LogEventLevel.Information, "Deleting archived file: '{0}'", file.FullName); Debug.LogMessage(LogEventLevel.Information, "Deleting archived file: '{0}'", file.FullName);
@@ -160,7 +159,7 @@ public static class ConfigUpdater
// Moves the file and appends the .bak extension // Moves the file and appends the .bak extension
var fileDest = archiveDirectoryPath + "/" + file.Name + ".bak"; var fileDest = archiveDirectoryPath + "/" + file.Name + ".bak";
if(!File.Exists(fileDest)) if (!File.Exists(fileDest))
{ {
file.MoveTo(fileDest); file.MoveTo(fileDest);
} }
@@ -202,7 +201,7 @@ public static class ConfigUpdater
} }
public enum eUpdateStatus public enum eUpdateStatus
{ {
UpdateStarted, UpdateStarted,
ConfigFileReceived, ConfigFileReceived,

View File

@@ -2,10 +2,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;

View File

@@ -2,20 +2,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
namespace PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.Config;
/// <summary> /// <summary>
/// Loads the ConfigObject from the file /// Loads the ConfigObject from the file
/// </summary> /// </summary>
public class EssentialsConfig : BasicConfig public class EssentialsConfig : BasicConfig
{ {
[JsonProperty("system_url")] [JsonProperty("system_url")]
public string SystemUrl { get; set; } public string SystemUrl { get; set; }
@@ -36,7 +34,8 @@ namespace PepperDash.Essentials.Core.Config;
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*"); var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/#.*");
string uuid = result.Groups[1].Value; string uuid = result.Groups[1].Value;
return uuid; return uuid;
} else }
else
{ {
var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/.*"); var result = Regex.Match(SystemUrl, @"https?:\/\/.*\/systems\/(.*)\/.*");
string uuid = result.Groups[1].Value; string uuid = result.Groups[1].Value;
@@ -58,7 +57,8 @@ namespace PepperDash.Essentials.Core.Config;
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*"); var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/templates\/(.*)\/#.*");
string uuid = result.Groups[1].Value; string uuid = result.Groups[1].Value;
return uuid; return uuid;
} else }
else
{ {
var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/(.*)\/system-template-versions\/(.*)\/.*"); var result = Regex.Match(TemplateUrl, @"https?:\/\/.*\/system-templates\/(.*)\/system-template-versions\/(.*)\/.*");
string uuid = result.Groups[2].Value; string uuid = result.Groups[2].Value;
@@ -76,14 +76,14 @@ namespace PepperDash.Essentials.Core.Config;
{ {
Rooms = new List<DeviceConfig>(); Rooms = new List<DeviceConfig>();
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class SystemTemplateConfigs public class SystemTemplateConfigs
{ {
public EssentialsConfig System { get; set; } public EssentialsConfig System { get; set; }
public EssentialsConfig Template { get; set; } public EssentialsConfig Template { get; set; }
} }

View File

@@ -1,17 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using PepperDash.Core;
using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro.CrestronThread;
using PepperDash.Core;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core;
public static class FileIO public static class FileIO
{ {
static CCriticalSection fileLock = new CCriticalSection(); static CCriticalSection fileLock = new CCriticalSection();
public delegate void GotFileEventHandler(object sender, FileEventArgs e); public delegate void GotFileEventHandler(object sender, FileEventArgs e);
@@ -267,10 +267,10 @@ namespace PepperDash.Essentials.Core;
} }
} }
} }
public class FileEventArgs public class FileEventArgs
{ {
public FileEventArgs(string data) { Data = data; } public FileEventArgs(string data) { Data = data; }
public string Data { get; private set; } // readonly public string Data { get; private set; } // readonly
} }

View File

@@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.CrestronXml; using Crestron.SimplSharp.CrestronXml;
using Crestron.SimplSharp.CrestronXml.Serialization; using Crestron.SimplSharp.CrestronXml.Serialization;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
@@ -11,10 +15,6 @@ using PepperDash.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using Serilog.Events; using Serilog.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PepperDash.Essentials.Core.Fusion; namespace PepperDash.Essentials.Core.Fusion;
@@ -301,7 +301,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
if (File.Exists(filePath)) if (File.Exists(filePath))
{ {
var json = File.ReadToEnd(filePath, Encoding.ASCII); var json = File.ReadAllText(filePath, Encoding.ASCII);
_guiDs = JsonConvert.DeserializeObject<FusionRoomGuids>(json); _guiDs = JsonConvert.DeserializeObject<FusionRoomGuids>(json);
@@ -490,7 +490,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
{ {
var join = JoinMap.ProgramNameStart.JoinNumber + i; var join = JoinMap.ProgramNameStart.JoinNumber + i;
var progNum = i + 1; var progNum = i + 1;
_program[i] = FusionRoom.CreateOffsetStringSig((uint) join, _program[i] = FusionRoom.CreateOffsetStringSig((uint)join,
string.Format("{0} {1}", JoinMap.ProgramNameStart.AttributeName, progNum), eSigIoMask.InputSigOnly); string.Format("{0} {1}", JoinMap.ProgramNameStart.AttributeName, progNum), eSigIoMask.InputSigOnly);
} }
} }
@@ -519,7 +519,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
{ {
if (args.DeviceOnLine) if (args.DeviceOnLine)
{ {
CrestronInvoke.BeginInvoke( (o) => CrestronInvoke.BeginInvoke((o) =>
{ {
CrestronEnvironment.Sleep(200); CrestronEnvironment.Sleep(200);
@@ -658,7 +658,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
var extendTime = _currentMeeting.dtEnd - DateTime.Now; var extendTime = _currentMeeting.dtEnd - DateTime.Now;
var extendMinutesRaw = extendTime.TotalMinutes; var extendMinutesRaw = extendTime.TotalMinutes;
extendMinutes += (int) Math.Round(extendMinutesRaw); extendMinutes += (int)Math.Round(extendMinutesRaw);
} }
@@ -827,9 +827,9 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
Debug.LogMessage(LogEventLevel.Debug, this, "DateTime from Fusion Server: {0}", currentTime); Debug.LogMessage(LogEventLevel.Debug, this, "DateTime from Fusion Server: {0}", currentTime);
// Parse time and date from response and insert values // Parse time and date from response and insert values
CrestronEnvironment.SetTimeAndDate((ushort) currentTime.Hour, (ushort) currentTime.Minute, CrestronEnvironment.SetTimeAndDate((ushort)currentTime.Hour, (ushort)currentTime.Minute,
(ushort) currentTime.Second, (ushort) currentTime.Month, (ushort) currentTime.Day, (ushort)currentTime.Second, (ushort)currentTime.Month, (ushort)currentTime.Day,
(ushort) currentTime.Year); (ushort)currentTime.Year);
Debug.LogMessage(LogEventLevel.Debug, this, "Processor time set to {0}", CrestronEnvironment.GetLocalTime()); Debug.LogMessage(LogEventLevel.Debug, this, "Processor time set to {0}", CrestronEnvironment.GetLocalTime());
} }
@@ -1093,7 +1093,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
foreach (var usageDevice in dict.Select(kvp => kvp.Value.SourceDevice).OfType<IUsageTracking>()) foreach (var usageDevice in dict.Select(kvp => kvp.Value.SourceDevice).OfType<IUsageTracking>())
{ {
usageDevice.UsageTracker = new UsageTracking(usageDevice as Device) {UsageIsTracked = true}; usageDevice.UsageTracker = new UsageTracking(usageDevice as Device) { UsageIsTracked = true };
usageDevice.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded; usageDevice.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
} }
} }
@@ -1279,7 +1279,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
foreach (var display in displays.Cast<IDisplay>()) foreach (var display in displays.Cast<IDisplay>())
{ {
display.UsageTracker = new UsageTracking(display as Device) {UsageIsTracked = true}; display.UsageTracker = new UsageTracking(display as Device) { UsageIsTracked = true };
display.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded; display.UsageTracker.DeviceUsageEnded += UsageTracker_DeviceUsageEnded;
} }
@@ -1392,7 +1392,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
// Power on // Power on
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint) joinOffset, displayName + "Power On", var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On",
eSigIoMask.InputOutputSig); eSigIoMask.InputOutputSig);
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b =>
{ {
@@ -1403,7 +1403,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
}); });
// Power Off // Power Off
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint) joinOffset + 1, displayName + "Power Off", var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off",
eSigIoMask.InputOutputSig); eSigIoMask.InputOutputSig);
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b =>
{ {
@@ -1421,7 +1421,7 @@ public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupanc
} }
// Current Source // Current Source
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint) joinOffset + 8, var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8,
displayName + "Source None", eSigIoMask.InputOutputSig); displayName + "Source None", eSigIoMask.InputOutputSig);
defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b => defaultDisplaySourceNone.OutputSig.UserObject = new Action<bool>(b =>
{ {

View File

@@ -1,27 +1,25 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Globalization;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using System.Collections.Generic;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.CrestronDataStore; using Crestron.SimplSharp.CrestronDataStore;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.License;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema; using Newtonsoft.Json.Schema;
using PepperDash.Core;
using PepperDash.Essentials.License;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core;
public static class Global public static class Global
{ {
public static CrestronControlSystem ControlSystem { get; set; } public static CrestronControlSystem ControlSystem { get; set; }
public static eDevicePlatform Platform { get { return CrestronEnvironment.DevicePlatform; } } public static eDevicePlatform Platform { get { return CrestronEnvironment.DevicePlatform; } }
@@ -43,9 +41,9 @@ namespace PepperDash.Essentials.Core;
{ {
get get
{ {
if(ControlSystem.SystemControl != null) if (ControlSystem.SystemControl != null)
{ {
if(ControlSystem.SystemControl.SystemControlType > 0) if (ControlSystem.SystemControl.SystemControlType > 0)
{ {
return true; return true;
} }
@@ -61,9 +59,9 @@ namespace PepperDash.Essentials.Core;
{ {
get get
{ {
if(ControlSystem.SystemControl != null) if (ControlSystem.SystemControl != null)
{ {
if(ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K150CSystemControl || if (ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K150CSystemControl ||
ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K200CSystemControl || ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K200CSystemControl ||
ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl || ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl ||
ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K300CSystemControl || ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K300CSystemControl ||
@@ -83,9 +81,9 @@ namespace PepperDash.Essentials.Core;
{ {
get get
{ {
if(ControlSystem.SystemControl != null) if (ControlSystem.SystemControl != null)
{ {
if(ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K200CSystemControl || if (ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K200CSystemControl ||
ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl || ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl ||
ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K300CSystemControl || ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K300CSystemControl ||
ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K350CSystemControl) ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K350CSystemControl)
@@ -109,7 +107,7 @@ namespace PepperDash.Essentials.Core;
{ {
get get
{ {
return Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory(); return Directory.GetCurrentDirectory();
} }
} }
@@ -209,7 +207,7 @@ namespace PepperDash.Essentials.Core;
if (String.IsNullOrEmpty(minimumVersion)) if (String.IsNullOrEmpty(minimumVersion))
{ {
Debug.LogMessage(LogEventLevel.Information,"Plugin does not specify a minimum version. Loading plugin may not work as expected. Proceeding with loading plugin"); Debug.LogMessage(LogEventLevel.Information, "Plugin does not specify a minimum version. Loading plugin may not work as expected. Proceeding with loading plugin");
return true; return true;
} }
@@ -292,4 +290,4 @@ namespace PepperDash.Essentials.Core;
} }
} }
} }

View File

@@ -3,16 +3,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Reflection; using System.Reflection;
using Crestron.SimplSharp.CrestronIO; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using Newtonsoft.Json;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core;
@@ -101,7 +99,7 @@ public abstract class JoinMapBaseAdvanced
JoinOffset = joinStart - 1; JoinOffset = joinStart - 1;
} }
protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart) protected JoinMapBaseAdvanced(uint joinStart, Type type) : this(joinStart)
{ {
AddJoins(type); AddJoins(type);
} }
@@ -110,7 +108,7 @@ public abstract class JoinMapBaseAdvanced
{ {
var fields = var fields =
type.GetFields(BindingFlags.Public | BindingFlags.Instance) type.GetFields(BindingFlags.Public | BindingFlags.Instance)
.Where(f => f.IsDefined(typeof (JoinNameAttribute), true)).ToList(); .Where(f => f.IsDefined(typeof(JoinNameAttribute), true)).ToList();
Debug.LogMessage(LogEventLevel.Debug, "Got {fields} with JoinNameAttribute", fields.Count); Debug.LogMessage(LogEventLevel.Debug, "Got {fields} with JoinNameAttribute", fields.Count);
@@ -244,7 +242,7 @@ public abstract class JoinMapBaseAdvanced
const int joinSpanLen = 9; const int joinSpanLen = 9;
const int typeLen = 19; const int typeLen = 19;
const int capabilitiesLen = 12; const int capabilitiesLen = 12;
var descriptionLen = (from @join in joins select @join.Value into j select j.Metadata.Description.Length).Concat(new[] {11}).Max(); var descriptionLen = (from @join in joins select @join.Value into j select j.Metadata.Description.Length).Concat(new[] { 11 }).Max();
//build header //build header
sb.Append(string.Format(stringFormatter, sb.Append(string.Format(stringFormatter,
@@ -488,7 +486,7 @@ public class JoinDataComplete
/// </summary> /// </summary>
public uint JoinNumber public uint JoinNumber
{ {
get { return _data.JoinNumber+ _joinOffset; } get { return _data.JoinNumber + _joinOffset; }
set { _data.JoinNumber = value; } set { _data.JoinNumber = value; }
} }
@@ -529,7 +527,7 @@ public class JoinNameAttribute : Attribute
public JoinNameAttribute(string name) public JoinNameAttribute(string name)
{ {
Debug.LogMessage(LogEventLevel.Verbose, "Setting Attribute Name: {0}",null, name); Debug.LogMessage(LogEventLevel.Verbose, "Setting Attribute Name: {0}", null, name);
_Name = name; _Name = name;
} }

View File

@@ -2,12 +2,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
//using SSMono.IO; //using SSMono.IO;
using PepperDash.Core.WebApi.Presets; using PepperDash.Core.WebApi.Presets;
using Serilog.Events; using Serilog.Events;
@@ -127,7 +126,7 @@ public class DevicePresetsModel : Device
PresetsAreLoaded = false; PresetsAreLoaded = false;
try try
{ {
var pl = JsonConvert.DeserializeObject<PresetsList>(File.ReadToEnd(_filePath, Encoding.ASCII)); var pl = JsonConvert.DeserializeObject<PresetsList>(File.ReadAllText(_filePath, Encoding.ASCII));
Name = pl.Name; Name = pl.Name;
PresetsList = pl.Channels; PresetsList = pl.Channels;
@@ -271,12 +270,13 @@ public class DevicePresetsModel : Device
try try
{ {
_fileOps.Enter(); _fileOps.Enter();
var pl = new PresetsList {Channels = PresetsList, Name = Name}; var pl = new PresetsList { Channels = PresetsList, Name = Name };
var json = JsonConvert.SerializeObject(pl, Formatting.Indented); var json = JsonConvert.SerializeObject(pl, Formatting.Indented);
using (var file = File.Open(_filePath, FileMode.Truncate)) using (var file = File.Open(_filePath, FileMode.Truncate))
{ {
file.Write(json, Encoding.UTF8); var bytes = Encoding.UTF8.GetBytes(json);
file.Write(bytes, 0, bytes.Length);
} }
} }
finally finally

View File

@@ -1,9 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
@@ -13,11 +12,11 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.Config;
/// <summary> /// <summary>
/// Represents the configuration data for a single tie line between two routing ports. /// Represents the configuration data for a single tie line between two routing ports.
/// </summary> /// </summary>
public class TieLineConfig public class TieLineConfig
{ {
/// <summary> /// <summary>
/// The key of the source device. /// The key of the source device.
/// </summary> /// </summary>
@@ -62,7 +61,7 @@ namespace PepperDash.Essentials.Core.Config;
/// <returns>null if config data does not match ports, cards or devices</returns> /// <returns>null if config data does not match ports, cards or devices</returns>
public TieLine GetTieLine() public TieLine GetTieLine()
{ {
Debug.LogMessage(LogEventLevel.Information, "Build TieLine: {0}",null, this); Debug.LogMessage(LogEventLevel.Information, "Build TieLine: {0}", null, this);
// Get the source device // Get the source device
var sourceDev = DeviceManager.GetDeviceForKey(SourceKey) as IRoutingOutputs; var sourceDev = DeviceManager.GetDeviceForKey(SourceKey) as IRoutingOutputs;
if (sourceDev == null) if (sourceDev == null)
@@ -106,7 +105,7 @@ namespace PepperDash.Essentials.Core.Config;
/// <param name="msg">The specific error message.</param> /// <param name="msg">The specific error message.</param>
void LogError(string msg) void LogError(string msg)
{ {
Debug.LogMessage(LogEventLevel.Error, "WARNING: Cannot create tie line: {message}:\r {tieLineConfig}",null, msg, this); Debug.LogMessage(LogEventLevel.Error, "WARNING: Cannot create tie line: {message}:\r {tieLineConfig}", null, msg, this);
} }
/// <summary> /// <summary>
@@ -118,4 +117,4 @@ namespace PepperDash.Essentials.Core.Config;
return string.Format("{0}.{1}.{2} --> {3}.{4}.{5}", SourceKey, SourceCard, SourcePort, return string.Format("{0}.{1}.{2} --> {3}.{4}.{5}", SourceKey, SourceCard, SourcePort,
DestinationKey, DestinationCard, DestinationPort); DestinationKey, DestinationCard, DestinationPort);
} }
} }

View File

@@ -1,19 +1,19 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using Crestron.SimplSharpPro.UI;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using Serilog.Events; using Serilog.Events;
namespace PepperDash.Essentials.Core.UI; namespace PepperDash.Essentials.Core.UI;
public abstract class TouchpanelBase: EssentialsDevice, IHasBasicTriListWithSmartObject public abstract class TouchpanelBase : EssentialsDevice, IHasBasicTriListWithSmartObject
{ {
protected CrestronTouchpanelPropertiesConfig _config; protected CrestronTouchpanelPropertiesConfig _config;
public BasicTriListWithSmartObject Panel { get; private set; } public BasicTriListWithSmartObject Panel { get; private set; }
@@ -29,7 +29,7 @@ public abstract class TouchpanelBase: EssentialsDevice, IHasBasicTriListWithSmar
/// <param name="config">Touchpanel Configuration</param> /// <param name="config">Touchpanel Configuration</param>
/// <param name="id">IP-ID to use for touch panel</param> /// <param name="id">IP-ID to use for touch panel</param>
protected TouchpanelBase(string key, string name, BasicTriListWithSmartObject panel, CrestronTouchpanelPropertiesConfig config) protected TouchpanelBase(string key, string name, BasicTriListWithSmartObject panel, CrestronTouchpanelPropertiesConfig config)
:base(key, name) : base(key, name)
{ {
if (panel == null) if (panel == null)
@@ -54,7 +54,8 @@ public abstract class TouchpanelBase: EssentialsDevice, IHasBasicTriListWithSmar
_config = config; _config = config;
AddPreActivationAction(() => { AddPreActivationAction(() =>
{
if (Panel.Register() != eDeviceRegistrationUnRegistrationResponse.Success) if (Panel.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
Debug.LogMessage(LogEventLevel.Information, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", Panel.RegistrationFailureReason); Debug.LogMessage(LogEventLevel.Information, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", Panel.RegistrationFailureReason);
@@ -168,7 +169,7 @@ public abstract class TouchpanelBase: EssentialsDevice, IHasBasicTriListWithSmar
private void Tsw_ButtonStateChange(GenericBase device, ButtonEventArgs args) private void Tsw_ButtonStateChange(GenericBase device, ButtonEventArgs args)
{ {
var uo = args.Button.UserObject; var uo = args.Button.UserObject;
if(uo is Action<bool>) if (uo is Action<bool>)
(uo as Action<bool>)(args.Button.State == eButtonState.Pressed); (uo as Action<bool>)(args.Button.State == eButtonState.Pressed);
} }
} }

View File

@@ -1,32 +1,32 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using Crestron.SimplSharp.CrestronIO;
using System.Reflection; using System.Reflection;
using Crestron.SimplSharpPro.DeviceSupport; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Core.Intersystem; using PepperDash.Core.Intersystem;
using PepperDash.Core.Intersystem.Tokens; using PepperDash.Core.Intersystem.Tokens;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Bridges.JoinMaps;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices; using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Devices.Common.Cameras; using PepperDash.Essentials.Devices.Common.Cameras;
using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Essentials.Devices.Common.Codec;
using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces; using PepperDash.Essentials.Devices.Common.VideoCodec.Interfaces;
using PepperDash.Essentials.Core.Bridges.JoinMaps;
using Feedback = PepperDash.Essentials.Core.Feedback;
using Serilog.Events; using Serilog.Events;
using PepperDash.Essentials.Core.Routing; using Feedback = PepperDash.Essentials.Core.Feedback;
using System.Text;
namespace PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.Devices.Common.VideoCodec;
public abstract class VideoCodecBase : ReconfigurableDevice, IRoutingInputsOutputs, public abstract class VideoCodecBase : ReconfigurableDevice, IRoutingInputsOutputs,
IUsageTracking, IHasDialer, IHasContentSharing, ICodecAudio, iVideoCodecInfo, IBridgeAdvanced, IHasStandbyMode IUsageTracking, IHasDialer, IHasContentSharing, ICodecAudio, iVideoCodecInfo, IBridgeAdvanced, IHasStandbyMode
{ {
private const int XSigEncoding = 28591; private const int XSigEncoding = 28591;
protected const int MaxParticipants = 50; protected const int MaxParticipants = 50;
private readonly byte[] _clearBytes = XSigHelpers.ClearOutputs(); private readonly byte[] _clearBytes = XSigHelpers.ClearOutputs();
@@ -872,8 +872,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec;
protected int MeetingsToDisplay protected int MeetingsToDisplay
{ {
get { return _meetingsToDisplay; } get { return _meetingsToDisplay; }
set { set
_meetingsToDisplay = (ushort) (value == 0 ? 3 : value); {
_meetingsToDisplay = (ushort)(value == 0 ? 3 : value);
MeetingsToDisplayFeedback.FireUpdate(); MeetingsToDisplayFeedback.FireUpdate();
} }
} }
@@ -1384,7 +1385,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec;
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, call.Direction.ToString()); tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, call.Direction.ToString());
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, call.Type.ToString()); tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, call.Type.ToString());
tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, call.Status.ToString()); tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, call.Status.ToString());
if(call.Duration != null) if (call.Duration != null)
{ {
// May need to verify correct string format here // May need to verify correct string format here
var dur = string.Format("{0:c}", call.Duration); var dur = string.Format("{0:c}", call.Duration);
@@ -1871,14 +1872,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec;
} }
#endregion #endregion
} }
/// <summary> /// <summary>
/// Used to track the status of syncronizing the phonebook values when connecting to a codec or refreshing the phonebook info /// Used to track the status of syncronizing the phonebook values when connecting to a codec or refreshing the phonebook info
/// </summary> /// </summary>
public class CodecPhonebookSyncState : IKeyed public class CodecPhonebookSyncState : IKeyed
{ {
private bool _InitialSyncComplete; private bool _InitialSyncComplete;
public CodecPhonebookSyncState(string key) public CodecPhonebookSyncState(string key)
@@ -1970,7 +1971,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec;
InitialSyncComplete = false; InitialSyncComplete = false;
} }
} }
} }
/// <summary> /// <summary>
/// Represents a codec command that might need to have a friendly label applied for UI feedback purposes /// Represents a codec command that might need to have a friendly label applied for UI feedback purposes
/// </summary> /// </summary>

View File

@@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharp.WebScripting; using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -1829,7 +1829,7 @@ public class MobileControlSystemController : EssentialsDevice, IMobileControl
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void HandleError(object sender, ErrorEventArgs e) private void HandleError(object sender, WebSocketSharp.ErrorEventArgs e)
{ {
this.LogError("Websocket error {0}", e.Message); this.LogError("Websocket error {0}", e.Message);

View File

@@ -1,6 +1,9 @@
using Crestron.SimplSharp; using System;
using Crestron.SimplSharp.CrestronIO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.Diagnostics; using Crestron.SimplSharpPro.Diagnostics;
@@ -9,12 +12,9 @@ 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.DeviceTypeInterfaces; using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.Web;
using System;
using System.Linq;
using Serilog.Events;
using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Core.Routing;
using System.Threading; using PepperDash.Essentials.Core.Web;
using Serilog.Events;
using Timeout = Crestron.SimplSharp.Timeout; using Timeout = Crestron.SimplSharp.Timeout;
namespace PepperDash.Essentials; namespace PepperDash.Essentials;
@@ -185,7 +185,7 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig
string directoryPrefix; string directoryPrefix;
directoryPrefix = Directory.GetApplicationRootDirectory(); directoryPrefix = Directory.GetCurrentDirectory();
Global.SetAssemblyVersion(PluginLoader.GetAssemblyVersion(Assembly.GetExecutingAssembly())); Global.SetAssemblyVersion(PluginLoader.GetAssemblyVersion(Assembly.GetExecutingAssembly()));
@@ -312,23 +312,23 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig
Debug.LogMessage(LogEventLevel.Information, "FilePathPrefix: {filePathPrefix:l}", configDir); Debug.LogMessage(LogEventLevel.Information, "FilePathPrefix: {filePathPrefix:l}", configDir);
var configExists = Directory.Exists(configDir); var configExists = Directory.Exists(configDir);
if (!configExists) if (!configExists)
Directory.Create(configDir); Directory.CreateDirectory(configDir);
var irDir = Global.FilePathPrefix + "ir"; var irDir = Global.FilePathPrefix + "ir";
if (!Directory.Exists(irDir)) if (!Directory.Exists(irDir))
Directory.Create(irDir); Directory.CreateDirectory(irDir);
var sgdDir = Global.FilePathPrefix + "sgd"; var sgdDir = Global.FilePathPrefix + "sgd";
if (!Directory.Exists(sgdDir)) if (!Directory.Exists(sgdDir))
Directory.Create(sgdDir); Directory.CreateDirectory(sgdDir);
var pluginDir = Global.FilePathPrefix + "plugins"; var pluginDir = Global.FilePathPrefix + "plugins";
if (!Directory.Exists(pluginDir)) if (!Directory.Exists(pluginDir))
Directory.Create(pluginDir); Directory.CreateDirectory(pluginDir);
var joinmapDir = Global.FilePathPrefix + "joinmaps"; var joinmapDir = Global.FilePathPrefix + "joinmaps";
if(!Directory.Exists(joinmapDir)) if (!Directory.Exists(joinmapDir))
Directory.Create(joinmapDir); Directory.CreateDirectory(joinmapDir);
return configExists; return configExists;
} }
@@ -424,7 +424,7 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogMessage(e, "ERROR: Creating device {deviceKey:l}. Skipping device.",args: new[] { devConf.Key }); Debug.LogMessage(e, "ERROR: Creating device {deviceKey:l}. Skipping device.", args: new[] { devConf.Key });
} }
} }
Debug.LogMessage(LogEventLevel.Information, "All Devices Loaded."); Debug.LogMessage(LogEventLevel.Information, "All Devices Loaded.");
@@ -475,14 +475,15 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig
{ {
var room = Core.DeviceFactory.GetDevice(roomConfig); var room = Core.DeviceFactory.GetDevice(roomConfig);
if(room == null) if (room == null)
{ {
Debug.LogWarning("ERROR: Cannot load unknown room type '{roomType:l}', key '{roomKey:l}'.", roomConfig.Type, roomConfig.Key); Debug.LogWarning("ERROR: Cannot load unknown room type '{roomType:l}', key '{roomKey:l}'.", roomConfig.Type, roomConfig.Key);
continue; continue;
} }
DeviceManager.AddDevice(room); DeviceManager.AddDevice(room);
} catch (Exception ex) }
catch (Exception ex)
{ {
Debug.LogMessage(ex, "Exception loading room {roomKey}:{roomType}", null, roomConfig.Key, roomConfig.Type); Debug.LogMessage(ex, "Exception loading room {roomKey}:{roomType}", null, roomConfig.Key, roomConfig.Type);
continue; continue;

View File

@@ -2,12 +2,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using System.Reflection; using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;

View File

@@ -1,9 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharp.Net.Http;
using PepperDash.Core; using PepperDash.Core;
using Serilog.Events; using Serilog.Events;
@@ -48,7 +47,7 @@ public class HttpLogoServer
//{ ".txt", "text/plain" }, //{ ".txt", "text/plain" },
}; };
_server = new HttpServer {Port = port}; _server = new HttpServer { Port = port };
_fileDirectory = directory; _fileDirectory = directory;
_server.OnHttpRequest += Server_OnHttpRequest; _server.OnHttpRequest += Server_OnHttpRequest;
_server.Open(); _server.Open();
@@ -75,7 +74,9 @@ public class HttpLogoServer
if (File.Exists(localPath)) if (File.Exists(localPath))
{ {
args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension); args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension);
args.Response.ContentStream = new FileStream(localPath, FileMode.Open, FileAccess.Read); // For .NET 8 migration, read file content as bytes since ContentStream expects Crestron.SimplSharp.CrestronIO.Stream
var fileBytes = File.ReadAllBytes(localPath);
args.Response.ContentBytes = fileBytes;
} }
else else
{ {