mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-04-12 03:57:08 +00:00
feat: added roomName reporting to EvaluateFile, updated constants used by JSON wrapper modules, refactored programCompatibility checks
This commit is contained in:
parent
3fa94a92d2
commit
33c3aa9979
2 changed files with 43 additions and 22 deletions
|
|
@ -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 isServer = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server;
|
||||
var series = CrestronEnvironment.ProgramCompatibility;
|
||||
|
||||
OnUshrtChange((ushort)CrestronEnvironment.ProgramCompatibility, 0,
|
||||
JsonToSimplConstants.CrestronSeriesValueChange);
|
||||
|
||||
OnUshrtChange((ushort) CrestronEnvironment.DevicePlatform, 0,
|
||||
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;
|
||||
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);
|
||||
|
|
@ -114,14 +132,7 @@ namespace PepperDash.Core.JsonToSimpl
|
|||
if (Directory.Exists(fileDirectory))
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
var directoryInfo = new DirectoryInfo(fileDirectory);
|
||||
|
||||
// get the file to be read
|
||||
var actualFile = directoryInfo.GetFiles(fileName).FirstOrDefault();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue