mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-01-11 19:44:44 +00:00
feat: added roomName reporting to EvaluateFile, updated constants used by JSON wrapper modules, refactored programCompatibility checks
This commit is contained in:
@@ -21,19 +21,24 @@ namespace PepperDash.Core.JsonToSimpl
|
||||
public const ushort JsonIsValidBoolChange = 2;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Reports the if the device is 3-series compatible
|
||||
/// </summary>
|
||||
public const ushort UshortValueChange = 101;
|
||||
public const ushort ProgramCompatibility3SeriesChange = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Reports the Crestron Series enum value
|
||||
/// Reports the if the device is 4-series compatible
|
||||
/// </summary>
|
||||
public const ushort CrestronSeriesValueChange = 102;
|
||||
public const ushort ProgramCompatibility4SeriesChange = 4;
|
||||
|
||||
/// <summary>
|
||||
/// Reports the device platform enum value
|
||||
/// </summary>
|
||||
public const ushort DevicePlatformValueChange = 103;
|
||||
public const ushort DevicePlatformValueChange = 5;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public const ushort UshortValueChange = 101;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -58,14 +63,19 @@ namespace PepperDash.Core.JsonToSimpl
|
||||
public const ushort FilePathResolvedChange = 205;
|
||||
|
||||
/// <summary>
|
||||
/// Reports the root directory
|
||||
/// Reports the root directory change
|
||||
/// </summary>
|
||||
public const ushort RootDirectoryChange = 206;
|
||||
|
||||
/// <summary>
|
||||
/// Reports the room ID
|
||||
/// Reports the room ID change
|
||||
/// </summary>
|
||||
public const ushort RoomIdChange = 207;
|
||||
|
||||
/// <summary>
|
||||
/// Reports the room name change
|
||||
/// </summary>
|
||||
public const ushort RoomNameChange = 208;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -66,15 +66,33 @@ namespace PepperDash.Core.JsonToSimpl
|
||||
var dirSeparator = Path.DirectorySeparatorChar;
|
||||
var dirSeparatorAlt = Path.AltDirectorySeparatorChar;
|
||||
|
||||
var is4Series = CrestronEnvironment.ProgramCompatibility == eCrestronSeries.Series4;
|
||||
var series = CrestronEnvironment.ProgramCompatibility;
|
||||
|
||||
var is3Series = (eCrestronSeries.Series3 == (series & eCrestronSeries.Series3));
|
||||
OnBoolChange(is3Series, 0,
|
||||
JsonToSimplConstants.ProgramCompatibility3SeriesChange);
|
||||
|
||||
var is4Series = (eCrestronSeries.Series4 == (series & eCrestronSeries.Series4));
|
||||
OnBoolChange(is4Series, 0,
|
||||
JsonToSimplConstants.ProgramCompatibility4SeriesChange);
|
||||
|
||||
var isServer = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server;
|
||||
|
||||
OnUshrtChange((ushort)CrestronEnvironment.ProgramCompatibility, 0,
|
||||
JsonToSimplConstants.CrestronSeriesValueChange);
|
||||
|
||||
OnUshrtChange((ushort) CrestronEnvironment.DevicePlatform, 0,
|
||||
OnBoolChange(isServer, 0,
|
||||
JsonToSimplConstants.DevicePlatformValueChange);
|
||||
|
||||
// get the roomID
|
||||
var roomId = Crestron.SimplSharp.InitialParametersClass.RoomId;
|
||||
if (!string.IsNullOrEmpty(roomId))
|
||||
{
|
||||
OnStringChange(roomId, 0, JsonToSimplConstants.RoomIdChange);
|
||||
}
|
||||
|
||||
// get the roomName
|
||||
var roomName = Crestron.SimplSharp.InitialParametersClass.RoomName;
|
||||
if (!string.IsNullOrEmpty(roomName))
|
||||
{
|
||||
OnStringChange(roomName, 0, JsonToSimplConstants.RoomNameChange);
|
||||
}
|
||||
|
||||
var rootDirectory = Directory.GetApplicationRootDirectory();
|
||||
OnStringChange(rootDirectory, 0, JsonToSimplConstants.RootDirectoryChange);
|
||||
@@ -116,13 +134,6 @@ namespace PepperDash.Core.JsonToSimpl
|
||||
// get the directory info
|
||||
var directoryInfo = new DirectoryInfo(fileDirectory);
|
||||
|
||||
// get the roomID
|
||||
if (!string.IsNullOrEmpty(rootDirectory))
|
||||
{
|
||||
var roomId = directoryInfo.Name;
|
||||
OnStringChange(roomId, 0, JsonToSimplConstants.RoomIdChange);
|
||||
}
|
||||
|
||||
// get the file to be read
|
||||
var actualFile = directoryInfo.GetFiles(fileName).FirstOrDefault();
|
||||
if (actualFile == null)
|
||||
|
||||
Reference in New Issue
Block a user