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;
|
public const ushort JsonIsValidBoolChange = 2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Reports the if the device is 3-series compatible
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort UshortValueChange = 101;
|
public const ushort ProgramCompatibility3SeriesChange = 3;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the Crestron Series enum value
|
/// Reports the if the device is 4-series compatible
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort CrestronSeriesValueChange = 102;
|
public const ushort ProgramCompatibility4SeriesChange = 4;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the device platform enum value
|
/// Reports the device platform enum value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort DevicePlatformValueChange = 103;
|
public const ushort DevicePlatformValueChange = 5;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public const ushort UshortValueChange = 101;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
@ -58,14 +63,19 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
public const ushort FilePathResolvedChange = 205;
|
public const ushort FilePathResolvedChange = 205;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the root directory
|
/// Reports the root directory change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort RootDirectoryChange = 206;
|
public const ushort RootDirectoryChange = 206;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reports the room ID
|
/// Reports the room ID change
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ushort RoomIdChange = 207;
|
public const ushort RoomIdChange = 207;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reports the room name change
|
||||||
|
/// </summary>
|
||||||
|
public const ushort RoomNameChange = 208;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -66,15 +66,33 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
var dirSeparator = Path.DirectorySeparatorChar;
|
var dirSeparator = Path.DirectorySeparatorChar;
|
||||||
var dirSeparatorAlt = Path.AltDirectorySeparatorChar;
|
var dirSeparatorAlt = Path.AltDirectorySeparatorChar;
|
||||||
|
|
||||||
var is4Series = CrestronEnvironment.ProgramCompatibility == eCrestronSeries.Series4;
|
var series = CrestronEnvironment.ProgramCompatibility;
|
||||||
var isServer = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server;
|
|
||||||
|
|
||||||
OnUshrtChange((ushort)CrestronEnvironment.ProgramCompatibility, 0,
|
var is3Series = (eCrestronSeries.Series3 == (series & eCrestronSeries.Series3));
|
||||||
JsonToSimplConstants.CrestronSeriesValueChange);
|
OnBoolChange(is3Series, 0,
|
||||||
|
JsonToSimplConstants.ProgramCompatibility3SeriesChange);
|
||||||
OnUshrtChange((ushort) CrestronEnvironment.DevicePlatform, 0,
|
|
||||||
|
var is4Series = (eCrestronSeries.Series4 == (series & eCrestronSeries.Series4));
|
||||||
|
OnBoolChange(is4Series, 0,
|
||||||
|
JsonToSimplConstants.ProgramCompatibility4SeriesChange);
|
||||||
|
|
||||||
|
var isServer = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server;
|
||||||
|
OnBoolChange(isServer, 0,
|
||||||
JsonToSimplConstants.DevicePlatformValueChange);
|
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();
|
var rootDirectory = Directory.GetApplicationRootDirectory();
|
||||||
OnStringChange(rootDirectory, 0, JsonToSimplConstants.RootDirectoryChange);
|
OnStringChange(rootDirectory, 0, JsonToSimplConstants.RootDirectoryChange);
|
||||||
|
|
@ -114,14 +132,7 @@ namespace PepperDash.Core.JsonToSimpl
|
||||||
if (Directory.Exists(fileDirectory))
|
if (Directory.Exists(fileDirectory))
|
||||||
{
|
{
|
||||||
// get the directory info
|
// get the directory info
|
||||||
var directoryInfo = new DirectoryInfo(fileDirectory);
|
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
|
// get the file to be read
|
||||||
var actualFile = directoryInfo.GetFiles(fileName).FirstOrDefault();
|
var actualFile = directoryInfo.GetFiles(fileName).FirstOrDefault();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue