Compare commits

..

32 Commits

Author SHA1 Message Date
Andrew Welker
5921b5dbb0 Merge pull request #1336 from PepperDash/hotfix/check-for-cs-lan-on-mctp
Hotfix/check for cs lan on mctp
2025-09-23 13:58:15 -04:00
Neil Dorin
ba0de5128f Update src/PepperDash.Essentials.MobileControl/Touchpanel/MobileControlTouchpanelController.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-23 11:56:57 -06:00
Neil Dorin
258699fbcd fix: Enhance AppUrl change logging
Updated logging to include the new AppUrl value when it changes. This provides better context in the logs, making it easier to track the specific URL that was set.
2025-09-18 18:23:12 -06:00
Neil Dorin
738504e9fc fix: Add error handling for network parameter retrieval
Introduced a try-catch block to handle exceptions when fetching the Crestron Ethernet adapter's ID, subnet mask, and IP address. Added logging for cases where the processor lacks a CS LAN. Also included a new using directive for Serilog.Events.
2025-09-18 14:48:21 -06:00
erikdred
cae1bbd6e6 Merge pull request #1332 from PepperDash/feature/add-hide-property-to-room-combine-scenario
feat: Add HideInUi property to room combiner classes
2025-09-17 18:38:21 -04:00
Neil Dorin
dea4407e3e Update src/PepperDash.Essentials.Core/Room/Combining/IEssentialsRoomCombiner.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-17 16:36:33 -06:00
Neil Dorin
ab08a546f7 feat: Add HideInUi property to room combiner classes
- Introduced `HideInUi` property in `EssentialsRoomCombinerPropertiesConfig` to control UI visibility.
- Added `HideInUi` interface property in `IEssentialsRoomCombiner`.
- Implemented `HideInUi` in `RoomCombinationScenario`, along with new `Key` and `Name` properties for improved data representation.
2025-09-17 15:25:23 -06:00
Neil Dorin
ef98d47792 Merge pull request #1331 from PepperDash/dev-list-fix 2025-09-17 08:36:04 -06:00
Andrew Welker
c05976ee60 fix: modify formatting and sorting for devfb response 2025-09-17 09:28:04 -05:00
Andrew Welker
4ca1031bef docs: fix CS1587 errors 2025-09-17 08:52:44 -05:00
Andrew Welker
6d61c4525e fix: use ConsoleCommandResponse for device feedbacks 2025-09-17 08:52:29 -05:00
Andrew Welker
3db274ace5 fix: add line endings for devlist console command 2025-09-17 08:51:45 -05:00
Neil Dorin
f0f708294c Merge pull request #1329 from PepperDash/devlist-fix
fix: print devlist output using ConsoleCommandResponse
2025-09-10 09:58:13 -06:00
Andrew Welker
a00d186c62 fix: print devlist output using ConsoleCommandResponse 2025-09-10 10:45:55 -05:00
Neil Dorin
51da668dfd Merge pull request #1327 from PepperDash/cs-lan-mc-panel
fix: add config property for devices on CS LAN
2025-09-05 16:20:42 -06:00
Andrew Welker
d2b7400039 fix: INvxNetworkPortInformation inherits from IKeyed 2025-09-05 15:55:31 -05:00
Andrew Welker
2424838b7f chore: remove unused using
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-02 12:56:14 -05:00
Andrew Welker
9556edc064 fix: add config property for devices on CS LAN 2025-09-02 12:54:51 -05:00
Sumanth Rayancha
f9088691fd Merge pull request #1322 from PepperDash/release
Release
2025-08-26 10:16:18 -04:00
Andrew Welker
e40b6a8b4c Merge pull request #1320 from PepperDash/feature/extract-html-assets
feat: add html assets extraction from zip files in ControlSystem
2025-08-26 09:58:02 -04:00
Erik Meyer
c3b39a87da fix: enhance zip extraction to prevent directory traversal attacks 2025-08-22 15:15:02 -04:00
erikdred
06dc0e947e fix: check for null when getting directory
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-22 09:12:20 -04:00
aknous
147997f460 Merge pull request #1321 from PepperDash/IBasicVideoMuteWithFeedbackMessenger
Adds IBasicVideoMuteWithFeedbackMessenger
2025-08-21 14:26:10 -04:00
aknous
49abec5eea Update src/PepperDash.Essentials.MobileControl.Messengers/Messengers/CameraBaseMessenger.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-21 13:23:43 -04:00
aknous
6830efe42a fix: fixes CameraBaseMessenger hold timer for PTZ controls, adds storePreset messenger 2025-08-19 18:34:16 -04:00
Neil Dorin
d013068a0c Update src/PepperDash.Essentials/ControlSystem.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-19 14:54:11 -06:00
Neil Dorin
52916d29f4 Update src/PepperDash.Essentials/ControlSystem.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-19 14:53:06 -06:00
Erik Meyer
19e8489166 feat: add html assets extraction from zip files in ControlSystem 2025-08-19 15:48:43 -04:00
Neil Dorin
fe33443b25 fix: Update IP handling in MobileControlTouchpanelController
Updates logic to handle setting the URL sent to the CH5 wrapper app to use the CS LAN IP based on the actual IpInformationChange event on the panel itself.

- Added `._PepperDash.Essentials.4Series.sln` to .gitignore.
- Introduced new using directives for Regex and Crestron libraries.
- Added `csIpAddress` and `csSubnetMask` fields to store device IP info.
- Modified constructor to retrieve and assign current IP and subnet mask.
- Updated `Panel.IpInformationChange` event handler for logging and URL setting.
- Created `GetUrlWithCorrectIp` method to determine the correct URL based on IP.
- Refactored `SetAppUrl` to utilize the new URL method.
- Commented out old IP determination logic in `MobileControlWebsocketServer.cs` as it was moved to the touchpanel controller.
2025-08-19 13:28:45 -06:00
aknous
8cf195b262 feat: adds IBasicVideoMuteWithFeedbackMessenger 2025-08-19 11:37:39 -04:00
Neil Dorin
40406b797d Merge pull request #1314 from PepperDash/streaming-device-properties 2025-08-15 11:52:20 -06:00
Andrew Welker
65bc408ebf fix: add StreamUrl to baseStreamingDeviceProperties 2025-08-15 12:41:21 -05:00
21 changed files with 847 additions and 452 deletions

1
.gitignore vendored
View File

@@ -395,3 +395,4 @@ essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/Pepp
_site/
api/
*.DS_Store
/._PepperDash.Essentials.4Series.sln

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.12.1-local</Version>
<Version>2.15.1-local</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<Authors>PepperDash Technology</Authors>
<Company>PepperDash Technology</Company>

View File

@@ -2,14 +2,12 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using System.Reflection;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
@@ -355,22 +353,22 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
public class EiscApiPropertiesConfig
{
[JsonProperty("control")]
/// <summary>
/// Gets or sets the Control
/// </summary>
[JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; }
[JsonProperty("devices")]
/// <summary>
/// Gets or sets the Devices
/// </summary>
[JsonProperty("devices")]
public List<ApiDevicePropertiesConfig> Devices { get; set; }
[JsonProperty("rooms")]
/// <summary>
/// Gets or sets the Rooms
/// </summary>
[JsonProperty("rooms")]
public List<ApiRoomPropertiesConfig> Rooms { get; set; }
@@ -379,22 +377,22 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
public class ApiDevicePropertiesConfig
{
[JsonProperty("deviceKey")]
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; }
[JsonProperty("joinStart")]
/// <summary>
/// Gets or sets the JoinStart
/// </summary>
[JsonProperty("joinStart")]
public uint JoinStart { get; set; }
[JsonProperty("joinMapKey")]
/// <summary>
/// Gets or sets the JoinMapKey
/// </summary>
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; }
}
@@ -403,22 +401,22 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
public class ApiRoomPropertiesConfig
{
[JsonProperty("roomKey")]
/// <summary>
/// Gets or sets the RoomKey
/// </summary>
[JsonProperty("roomKey")]
public string RoomKey { get; set; }
[JsonProperty("joinStart")]
/// <summary>
/// Gets or sets the JoinStart
/// </summary>
[JsonProperty("joinStart")]
public uint JoinStart { get; set; }
[JsonProperty("joinMapKey")]
/// <summary>
/// Gets or sets the JoinMapKey
/// </summary>
[JsonProperty("joinMapKey")]
public string JoinMapKey { get; set; }
}

View File

@@ -19,5 +19,11 @@ namespace PepperDash.Essentials.Core.Config
/// </summary>
[JsonProperty("multicastAudioAddress", NullValueHandling = NullValueHandling.Ignore)]
public string MulticastAudioAddress { get; set; }
/// <summary>
/// The URL for the streaming device's media stream.
/// </summary>
[JsonProperty("streamUrl", NullValueHandling = NullValueHandling.Ignore)]
public string StreamUrl { get; set; }
}
}

View File

@@ -18,41 +18,41 @@ namespace PepperDash.Essentials.Core.Config
/// </summary>
public class DeviceConfig
{
[JsonProperty("key")]
/// <summary>
/// Gets or sets the Key
/// </summary>
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("uid")]
/// <summary>
/// Gets or sets the Uid
/// </summary>
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("name")]
/// <summary>
/// Gets or sets the Name
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("group")]
/// <summary>
/// Gets or sets the Group
/// </summary>
[JsonProperty("group")]
public string Group { get; set; }
[JsonProperty("type")]
/// <summary>
/// Gets or sets the Type
/// </summary>
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("properties")]
[JsonConverter(typeof(DevicePropertiesConverter))]
/// <summary>
/// Gets or sets the Properties
/// </summary>
[JsonProperty("properties")]
[JsonConverter(typeof(DevicePropertiesConverter))]
public JToken Properties { get; set; }
public DeviceConfig(DeviceConfig dc)
@@ -68,7 +68,7 @@ namespace PepperDash.Essentials.Core.Config
//Properties = JToken.FromObject(dc.Properties);
}
public DeviceConfig() {}
public DeviceConfig() { }
}
/// <summary>

View File

@@ -1,6 +1,7 @@
using Crestron.SimplSharpPro.DM.Streaming;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.DM.Streaming;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
@@ -11,7 +12,7 @@ namespace PepperDash.Essentials.Core
/// subscribers when the port information is updated. Implementations of this interface should ensure that the <see
/// cref="PortInformationChanged"/> event is raised whenever the <see cref="NetworkPorts"/> collection
/// changes.</remarks>
public interface INvxNetworkPortInformation
public interface INvxNetworkPortInformation : IKeyed
{
/// <summary>
/// Occurs when the port information changes.

View File

@@ -202,14 +202,15 @@ namespace PepperDash.Essentials.Core
private static void ListDevices(string s)
{
Debug.LogMessage(LogEventLevel.Information, "{0} Devices registered with Device Manager:", Devices.Count);
CrestronConsole.ConsoleCommandResponse($"{Devices.Count} Devices registered with Device Manager:\r\n");
var sorted = Devices.Values.ToList();
sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
foreach (var d in sorted)
{
var name = d is IKeyName ? (d as IKeyName).Name : "---";
Debug.LogMessage(LogEventLevel.Information, " [{0}] {1}", d.Key, name);
CrestronConsole.ConsoleCommandResponse($" [{d.Key}] {name}\r\n");
}
}
@@ -218,28 +219,17 @@ namespace PepperDash.Essentials.Core
var dev = GetDeviceForKey(devKey);
if (dev == null)
{
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey);
CrestronConsole.ConsoleCommandResponse($"Device '{devKey}' not found\r\n");
return;
}
if (!(dev is IHasFeedback statusDev))
{
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' does not have visible feedbacks", devKey);
CrestronConsole.ConsoleCommandResponse($"Device '{devKey}' does not have visible feedbacks\r\n");
return;
}
statusDev.DumpFeedbacksToConsole(true);
}
//static void ListDeviceCommands(string devKey)
//{
// var dev = GetDeviceForKey(devKey);
// if (dev == null)
// {
// Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey);
// return;
// }
// Debug.LogMessage(LogEventLevel.Information, "This needs to be reworked. Stay tuned.", devKey);
//}
private static void ListDeviceCommStatuses(string input)
{
@@ -249,12 +239,6 @@ namespace PepperDash.Essentials.Core
}
}
//static void DoDeviceCommand(string command)
//{
// Debug.LogMessage(LogEventLevel.Information, "Not yet implemented. Stay tuned");
//}
/// <summary>
/// AddDevice method
/// </summary>

View File

@@ -1,14 +1,14 @@
using System;
using System.Linq;
using Crestron.SimplSharp;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Defines the contract for IHasFeedback
/// </summary>
/// <summary>
/// Defines the contract for IHasFeedback
/// </summary>
public interface IHasFeedback : IKeyed
{
/// <summary>
@@ -19,47 +19,72 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
/// Extension methods for IHasFeedback
/// </summary>
public static class IHasFeedbackExtensions
{
/// <summary>
/// Gets the feedback type name for sorting purposes
/// </summary>
/// <param name="feedback">The feedback to get the type name for</param>
/// <returns>A string representing the feedback type</returns>
private static string GetFeedbackTypeName(Feedback feedback)
{
if (feedback is BoolFeedback)
return "boolean";
else if (feedback is IntFeedback)
return "integer";
else if (feedback is StringFeedback)
return "string";
else
return feedback.GetType().Name;
}
/// <summary>
/// Dumps the feedbacks to the console
/// </summary>
/// <param name="source"></param>
/// <param name="getCurrentStates"></param>
public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
{
Type t = source.GetType();
// get the properties and set them into a new collection of NameType wrappers
var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
var feedbacks = source.Feedbacks;
if (feedbacks != null)
if (feedbacks == null || feedbacks.Count == 0)
{
Debug.LogMessage(LogEventLevel.Information, source, "\n\nAvailable feedbacks:");
foreach (var f in feedbacks)
{
string val = "";
string type = "";
if (getCurrentStates)
{
if (f is BoolFeedback)
{
val = f.BoolValue.ToString();
type = "boolean";
}
else if (f is IntFeedback)
{
val = f.IntValue.ToString();
type = "integer";
}
else if (f is StringFeedback)
{
val = f.StringValue;
type = "string";
}
}
Debug.LogMessage(LogEventLevel.Information, "{0,-12} {1, -25} {2}", type,
(string.IsNullOrEmpty(f.Key) ? "-no key-" : f.Key), val);
}
CrestronConsole.ConsoleCommandResponse("No available feedbacks\r\n");
return;
}
CrestronConsole.ConsoleCommandResponse("Available feedbacks:\r\n");
// Sort feedbacks by type first, then by key
var sortedFeedbacks = feedbacks.OrderBy(f => GetFeedbackTypeName(f)).ThenBy(f => string.IsNullOrEmpty(f.Key) ? "" : f.Key);
foreach (var feedback in sortedFeedbacks)
{
string value = "";
string type = "";
if (getCurrentStates)
{
if (feedback is BoolFeedback)
{
value = feedback.BoolValue.ToString();
type = "boolean";
}
else if (feedback is IntFeedback)
{
value = feedback.IntValue.ToString();
type = "integer";
}
else if (feedback is StringFeedback)
{
value = feedback.StringValue;
type = "string";
}
}
CrestronConsole.ConsoleCommandResponse($" {type,-12} {(string.IsNullOrEmpty(feedback.Key) ? "-no key-" : feedback.Key),-25} {value}\r\n");
}
else
Debug.LogMessage(LogEventLevel.Information, source, "No available outputs:");
}
}
}

View File

@@ -103,6 +103,12 @@ namespace PepperDash.Essentials.Core
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to hide this scenario in the UI.
/// </summary>
[JsonProperty("hideInUi", NullValueHandling = NullValueHandling.Ignore)]
public bool HideInUi { get; set; }
/// <summary>
/// Gets or sets the collection of partition states.
/// </summary>

View File

@@ -109,6 +109,12 @@ namespace PepperDash.Essentials.Core
[JsonProperty("isActive")]
bool IsActive { get; }
/// <summary>
/// Gets a value indicating whether this scenario should be hidden in the UI.
/// </summary>
[JsonProperty("hideInUi")]
bool HideInUi { get; }
/// <summary>
/// Activates this room combination scenario
/// </summary>

View File

@@ -14,18 +14,40 @@ namespace PepperDash.Essentials.Core
{
private RoomCombinationScenarioConfig _config;
/// <summary>
/// Gets or sets the key associated with the object.
/// </summary>
[JsonProperty("key")]
public string Key { get; set; }
/// <summary>
/// Gets or sets the name associated with the object.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("partitionStates")]
/// <summary>
/// Gets a value indicating whether to hide this scenario in the UI.
/// </summary>
///
[JsonProperty("hideInUi")]
public bool HideInUi
{
get { return _config.HideInUi; }
}
/// <summary>
/// Gets or sets the PartitionStates
/// </summary>
///
[JsonProperty("partitionStates")]
public List<PartitionState> PartitionStates { get; private set; }
/// <summary>
/// Determines which UI devices get mapped to which room in this scenario. The Key should be the key of the UI device and the Value should be the key of the room to map to
/// </summary>
[JsonProperty("uiMap")]
public Dictionary<string, string> UiMap { get; set; }

View File

@@ -9,11 +9,11 @@ using Serilog.Events;
namespace PepperDash.Essentials.Room.Config
{
/// <summary>
/// Represents a EssentialsRoomConfigHelper
/// </summary>
public class EssentialsRoomConfigHelper
{
/// <summary>
/// Represents a EssentialsRoomConfigHelper
/// </summary>
public class EssentialsRoomConfigHelper
{
/// <summary>
/// GetEmergency method
/// </summary>
@@ -31,100 +31,100 @@ namespace PepperDash.Essentials.Room.Config
return null;
}
/// <summary>
///
/// </summary>
/// <param name="props"></param>
/// <param name="room"></param>
/// <returns></returns>
/// <summary>
/// GetMicrophonePrivacy method
/// </summary>
public static MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, IPrivacy room)
{
var microphonePrivacy = props.MicrophonePrivacy;
if (microphonePrivacy == null)
{
Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties");
return null;
}
// Get the MicrophonePrivacy device from the device manager
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController);
// Set this room as the IPrivacy device
if (mP == null)
{
Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey);
return null;
}
mP.SetPrivacyDevice(room);
/// <summary>
///
/// </summary>
/// <param name="props"></param>
/// <param name="room"></param>
/// <returns></returns>
/// <summary>
/// GetMicrophonePrivacy method
/// </summary>
public static MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, IPrivacy room)
{
var microphonePrivacy = props.MicrophonePrivacy;
if (microphonePrivacy == null)
{
Debug.LogMessage(LogEventLevel.Information, "Cannot create microphone privacy with null properties");
return null;
}
// Get the MicrophonePrivacy device from the device manager
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as MicrophonePrivacyController);
// Set this room as the IPrivacy device
if (mP == null)
{
Debug.LogMessage(LogEventLevel.Information, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey);
return null;
}
mP.SetPrivacyDevice(room);
var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();
var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();
if (behaviour == null)
{
Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController");
return null;
}
if (behaviour == "trackroomstate")
{
// Tie LED enable to room power state
if (behaviour == null)
{
Debug.LogMessage(LogEventLevel.Information, "WARNING: No behaviour defined for MicrophonePrivacyController");
return null;
}
if (behaviour == "trackroomstate")
{
// Tie LED enable to room power state
var essRoom = room as IEssentialsRoom;
essRoom.OnFeedback.OutputChange += (o, a) =>
{
{
if (essRoom.OnFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = essRoom.OnFeedback.BoolValue;
}
else if (behaviour == "trackcallstate")
{
// Tie LED enable to room power state
}
else if (behaviour == "trackcallstate")
{
// Tie LED enable to room power state
var inCallRoom = room as IHasInCallFeedback;
inCallRoom.InCallFeedback.OutputChange += (o, a) =>
{
{
if (inCallRoom.InCallFeedback.BoolValue)
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = true;
else
mP.EnableLeds = false;
};
mP.EnableLeds = inCallRoom.InCallFeedback.BoolValue;
}
}
return mP;
}
}
return mP;
}
/// <summary>
/// Represents a EssentialsRoomPropertiesConfig
/// </summary>
public class EssentialsRoomPropertiesConfig
{
[JsonProperty("addresses")]
public EssentialsRoomAddressPropertiesConfig Addresses { get; set; }
}
[JsonProperty("description")]
public string Description { get; set; }
/// <summary>
/// Represents a EssentialsRoomPropertiesConfig
/// </summary>
public class EssentialsRoomPropertiesConfig
{
[JsonProperty("addresses")]
public EssentialsRoomAddressPropertiesConfig Addresses { get; set; }
[JsonProperty("emergency")]
public EssentialsRoomEmergencyConfig Emergency { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("help")]
/// <summary>
/// Gets or sets the Help
/// </summary>
public EssentialsHelpPropertiesConfig Help { get; set; }
[JsonProperty("emergency")]
public EssentialsRoomEmergencyConfig Emergency { get; set; }
[JsonProperty("helpMessage")]
/// <summary>
/// Gets or sets the HelpMessage
/// </summary>
public string HelpMessage { get; set; }
/// <summary>
/// Gets or sets the Help
/// </summary>
[JsonProperty("help")]
public EssentialsHelpPropertiesConfig Help { get; set; }
/// <summary>
/// Gets or sets the HelpMessage
/// </summary>
[JsonProperty("helpMessage")]
public string HelpMessage { get; set; }
/// <summary>
/// Read this value to get the help message. It checks for the old and new config format.
@@ -133,94 +133,94 @@ namespace PepperDash.Essentials.Room.Config
{
get
{
if(Help != null && !string.IsNullOrEmpty(Help.Message))
if (Help != null && !string.IsNullOrEmpty(Help.Message))
{
return Help.Message;
}
else
{
return HelpMessage;
return HelpMessage;
}
}
}
[JsonProperty("environment")]
/// <summary>
/// Gets or sets the Environment
/// </summary>
public EssentialsEnvironmentPropertiesConfig Environment { get; set; }
/// <summary>
/// Gets or sets the Environment
/// </summary>
[JsonProperty("environment")]
public EssentialsEnvironmentPropertiesConfig Environment { get; set; }
[JsonProperty("logo")]
/// <summary>
/// Gets or sets the LogoLight
/// </summary>
public EssentialsLogoPropertiesConfig LogoLight { get; set; }
/// <summary>
/// Gets or sets the LogoLight
/// </summary>
[JsonProperty("logo")]
public EssentialsLogoPropertiesConfig LogoLight { get; set; }
[JsonProperty("logoDark")]
/// <summary>
/// Gets or sets the LogoDark
/// </summary>
[JsonProperty("logoDark")]
public EssentialsLogoPropertiesConfig LogoDark { get; set; }
[JsonProperty("microphonePrivacy")]
/// <summary>
/// Gets or sets the MicrophonePrivacy
/// </summary>
public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; }
[JsonProperty("occupancy")]
/// <summary>
/// Gets or sets the Occupancy
/// </summary>
public EssentialsRoomOccSensorConfig Occupancy { get; set; }
/// <summary>
/// Gets or sets the MicrophonePrivacy
/// </summary>
[JsonProperty("microphonePrivacy")]
public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; }
[JsonProperty("oneButtonMeeting")]
/// <summary>
/// Gets or sets the OneButtonMeeting
/// </summary>
public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; }
/// <summary>
/// Gets or sets the Occupancy
/// </summary>
[JsonProperty("occupancy")]
public EssentialsRoomOccSensorConfig Occupancy { get; set; }
[JsonProperty("shutdownVacancySeconds")]
/// <summary>
/// Gets or sets the ShutdownVacancySeconds
/// </summary>
public int ShutdownVacancySeconds { get; set; }
/// <summary>
/// Gets or sets the OneButtonMeeting
/// </summary>
[JsonProperty("oneButtonMeeting")]
public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; }
[JsonProperty("shutdownPromptSeconds")]
/// <summary>
/// Gets or sets the ShutdownPromptSeconds
/// </summary>
public int ShutdownPromptSeconds { get; set; }
/// <summary>
/// Gets or sets the ShutdownVacancySeconds
/// </summary>
[JsonProperty("shutdownVacancySeconds")]
public int ShutdownVacancySeconds { get; set; }
[JsonProperty("tech")]
/// <summary>
/// Gets or sets the Tech
/// </summary>
public EssentialsRoomTechConfig Tech { get; set; }
/// <summary>
/// Gets or sets the ShutdownPromptSeconds
/// </summary>
[JsonProperty("shutdownPromptSeconds")]
public int ShutdownPromptSeconds { get; set; }
[JsonProperty("volumes")]
/// <summary>
/// Gets or sets the Volumes
/// </summary>
public EssentialsRoomVolumesConfig Volumes { get; set; }
/// <summary>
/// Gets or sets the Tech
/// </summary>
[JsonProperty("tech")]
public EssentialsRoomTechConfig Tech { get; set; }
/// <summary>
/// Gets or sets the Volumes
/// </summary>
[JsonProperty("volumes")]
public EssentialsRoomVolumesConfig Volumes { get; set; }
[JsonProperty("fusion")]
/// <summary>
/// Gets or sets the Fusion
/// </summary>
[JsonProperty("fusion")]
public EssentialsRoomFusionConfig Fusion { get; set; }
[JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling=NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the UiBehavior
/// </summary>
[JsonProperty("essentialsRoomUiBehaviorConfig", NullValueHandling = NullValueHandling.Ignore)]
public EssentialsRoomUiBehaviorConfig UiBehavior { get; set; }
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
/// <summary>
/// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices
/// </summary>
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
/// <summary>
/// Gets or sets the ZeroVolumeWhenSwtichingVolumeDevices
/// </summary>
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
/// <summary>
/// Indicates if this room represents a combination of other rooms
@@ -236,7 +236,7 @@ namespace PepperDash.Essentials.Room.Config
LogoLight = new EssentialsLogoPropertiesConfig();
LogoDark = new EssentialsLogoPropertiesConfig();
}
}
}
/// <summary>
/// Represents a EssentialsRoomUiBehaviorConfig
@@ -327,15 +327,15 @@ namespace PepperDash.Essentials.Room.Config
}
/// <summary>
/// Represents a EssentialsEnvironmentPropertiesConfig
/// </summary>
public class EssentialsEnvironmentPropertiesConfig
{
/// <summary>
/// Gets or sets the Enabled
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Represents a EssentialsEnvironmentPropertiesConfig
/// </summary>
public class EssentialsEnvironmentPropertiesConfig
{
/// <summary>
/// Gets or sets the Enabled
/// </summary>
public bool Enabled { get; set; }
[JsonProperty("deviceKeys")]
/// <summary>
@@ -348,7 +348,7 @@ namespace PepperDash.Essentials.Room.Config
DeviceKeys = new List<string>();
}
}
}
/// <summary>
/// Represents a EssentialsRoomFusionConfig
@@ -359,7 +359,7 @@ namespace PepperDash.Essentials.Room.Config
{
get
{
try
try
{
return Convert.ToUInt32(IpId, 16);
}
@@ -367,7 +367,7 @@ namespace PepperDash.Essentials.Room.Config
{
throw new FormatException(string.Format("ERROR:Unable to convert IP ID: {0} to hex. Error:\n{1}", IpId));
}
}
}
@@ -390,17 +390,17 @@ namespace PepperDash.Essentials.Room.Config
/// </summary>
public class EssentialsRoomMicrophonePrivacyConfig
{
[JsonProperty("deviceKey")]
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
public string DeviceKey { get; set; }
[JsonProperty("deviceKey")]
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
public string DeviceKey { get; set; }
[JsonProperty("behaviour")]
/// <summary>
/// Gets or sets the Behaviour
/// </summary>
public string Behaviour { get; set; }
[JsonProperty("behaviour")]
/// <summary>
/// Gets or sets the Behaviour
/// </summary>
public string Behaviour { get; set; }
}
/// <summary>
@@ -408,23 +408,23 @@ namespace PepperDash.Essentials.Room.Config
/// </summary>
public class EssentialsHelpPropertiesConfig
{
[JsonProperty("message")]
/// <summary>
/// Gets or sets the Message
/// </summary>
public string Message { get; set; }
[JsonProperty("message")]
/// <summary>
/// Gets or sets the Message
/// </summary>
public string Message { get; set; }
[JsonProperty("showCallButton")]
public bool ShowCallButton { get; set; }
/// <summary>
[JsonProperty("showCallButton")]
public bool ShowCallButton { get; set; }
/// <summary>
/// Defaults to "Call Help Desk"
/// </summary>
[JsonProperty("callButtonText")]
/// <summary>
/// Gets or sets the CallButtonText
/// </summary>
public string CallButtonText { get; set; }
[JsonProperty("callButtonText")]
/// <summary>
/// Gets or sets the CallButtonText
/// </summary>
public string CallButtonText { get; set; }
public EssentialsHelpPropertiesConfig()
{
@@ -437,23 +437,23 @@ namespace PepperDash.Essentials.Room.Config
/// </summary>
public class EssentialsOneButtonMeetingPropertiesConfig
{
[JsonProperty("enable")]
/// <summary>
/// Gets or sets the Enable
/// </summary>
public bool Enable { get; set; }
[JsonProperty("enable")]
/// <summary>
/// Gets or sets the Enable
/// </summary>
public bool Enable { get; set; }
}
public class EssentialsRoomAddressPropertiesConfig
{
[JsonProperty("phoneNumber")]
public string PhoneNumber { get; set; }
[JsonProperty("phoneNumber")]
public string PhoneNumber { get; set; }
[JsonProperty("sipAddress")]
/// <summary>
/// Gets or sets the SipAddress
/// </summary>
public string SipAddress { get; set; }
[JsonProperty("sipAddress")]
/// <summary>
/// Gets or sets the SipAddress
/// </summary>
public string SipAddress { get; set; }
}
@@ -462,14 +462,14 @@ namespace PepperDash.Essentials.Room.Config
/// </summary>
public class EssentialsLogoPropertiesConfig
{
[JsonProperty("type")]
/// <summary>
/// Gets or sets the Type
/// </summary>
public string Type { get; set; }
[JsonProperty("type")]
/// <summary>
/// Gets or sets the Type
/// </summary>
public string Type { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
/// <summary>
/// GetLogoUrlLight method
/// </summary>
@@ -478,7 +478,7 @@ namespace PepperDash.Essentials.Room.Config
if (Type == "url")
return Url;
if (Type == "system")
return string.Format("http://{0}:8080/logo.png",
return string.Format("http://{0}:8080/logo.png",
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
return null;
}
@@ -502,22 +502,22 @@ namespace PepperDash.Essentials.Room.Config
/// </summary>
public class EssentialsRoomOccSensorConfig
{
[JsonProperty("deviceKey")]
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
public string DeviceKey { get; set; }
[JsonProperty("deviceKey")]
/// <summary>
/// Gets or sets the DeviceKey
/// </summary>
public string DeviceKey { get; set; }
[JsonProperty("timeoutMinutes")]
public int TimeoutMinutes { get; set; }
[JsonProperty("timeoutMinutes")]
public int TimeoutMinutes { get; set; }
}
public class EssentialsRoomTechConfig
{
[JsonProperty("password")]
/// <summary>
/// Gets or sets the Password
/// </summary>
public string Password { get; set; }
}
public class EssentialsRoomTechConfig
{
[JsonProperty("password")]
/// <summary>
/// Gets or sets the Password
/// </summary>
public string Password { get; set; }
}
}

View File

@@ -14,14 +14,14 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core
{
////*****************************************************************************
/// <summary>
/// Base class for all subpage reference list controllers
/// </summary>
//public class SubpageReferenceListController
//{
// public SubpageReferenceList TheList { get; protected set; }
//}
////*****************************************************************************
///// <summary>
///// Base class for all subpage reference list controllers
///// </summary>
//public class SubpageReferenceListController
//{
// public SubpageReferenceList TheList { get; protected set; }
//}
//*****************************************************************************
/// <summary>
@@ -34,26 +34,26 @@ namespace PepperDash.Essentials.Core
public ushort Count
{
get { return SetNumberOfItemsSig.UShortValue; }
set { SetNumberOfItemsSig.UShortValue = value; }
set { SetNumberOfItemsSig.UShortValue = value; }
}
public ushort MaxDefinedItems { get; private set; }
/// <summary>
/// Gets or sets the ScrollToItemSig
/// </summary>
/// <summary>
/// Gets or sets the ScrollToItemSig
/// </summary>
public UShortInputSig ScrollToItemSig { get; private set; }
UShortInputSig SetNumberOfItemsSig;
/// <summary>
/// Gets or sets the BoolIncrement
/// </summary>
/// <summary>
/// Gets or sets the BoolIncrement
/// </summary>
public uint BoolIncrement { get; protected set; }
/// <summary>
/// Gets or sets the UShortIncrement
/// </summary>
/// <summary>
/// Gets or sets the UShortIncrement
/// </summary>
public uint UShortIncrement { get; protected set; }
/// <summary>
/// Gets or sets the StringIncrement
/// </summary>
/// <summary>
/// Gets or sets the StringIncrement
/// </summary>
public uint StringIncrement { get; protected set; }
protected readonly SmartObject SRL;
@@ -87,8 +87,8 @@ namespace PepperDash.Essentials.Core
SRL.SigChange += new SmartObjectSigChangeEventHandler(SRL_SigChange);
}
else
Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
triList.ID, smartObjectId);
Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
triList.ID, smartObjectId);
}
/// <summary>
@@ -96,17 +96,17 @@ namespace PepperDash.Essentials.Core
/// DOES NOT adjust Count
/// </summary>
/// <param name="item"></param>
/// <summary>
/// AddItem method
/// </summary>
/// <summary>
/// AddItem method
/// </summary>
public void AddItem(SubpageReferenceListItem item)
{
Items.Add(item);
}
/// <summary>
/// Clear method
/// </summary>
/// <summary>
/// Clear method
/// </summary>
public void Clear()
{
// If a line item needs to disconnect an CueActionPair or do something to release RAM
@@ -116,12 +116,12 @@ namespace PepperDash.Essentials.Core
// Clean up the SRL
Count = 1;
ScrollToItemSig.UShortValue = 1;
ScrollToItemSig.UShortValue = 1;
}
/// <summary>
/// Refresh method
/// </summary>
/// <summary>
/// Refresh method
/// </summary>
public void Refresh()
{
foreach (var item in Items) item.Refresh();
@@ -157,7 +157,7 @@ namespace PepperDash.Essentials.Core
public UShortOutputSig GetUShortOutputSig(uint index, uint sigNum)
{
if (sigNum > UShortIncrement) return null;
return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum)));
return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum)));
}
/// <summary>
@@ -172,7 +172,7 @@ namespace PepperDash.Essentials.Core
public StringOutputSig GetStringOutputSig(uint index, uint sigNum)
{
if (sigNum > StringIncrement) return null;
return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum)));
return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum)));
}
/// <summary>
@@ -263,9 +263,9 @@ namespace PepperDash.Essentials.Core
/// </summary>
/// <param name="currentDevice"></param>
/// <param name="args"></param>
/// <summary>
/// SRL_SigChange method
/// </summary>
/// <summary>
/// SRL_SigChange method
/// </summary>
public static void SRL_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
{
var uo = args.Sig.UserObject;

View File

@@ -6,9 +6,9 @@ using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Represents a ModalDialog
/// </summary>
/// <summary>
/// Represents a ModalDialog
/// </summary>
public class ModalDialog
{
/// <summary>
@@ -19,10 +19,10 @@ namespace PepperDash.Essentials.Core
/// Bool press 3992
/// </summary>
public const uint Button2Join = 3992;
/// <summary>
/// 3993
/// </summary>
public const uint CancelButtonJoin = 3993;
/// <summary>
/// 3993
/// </summary>
public const uint CancelButtonJoin = 3993;
/// <summary>
///For visibility of single button. Bool feedback 3994
/// </summary>
@@ -35,19 +35,19 @@ namespace PepperDash.Essentials.Core
/// Shows the timer guage if in use. Bool feedback 3996
/// </summary>
public const uint TimerVisibleJoin = 3996;
/// <summary>
/// Visibility join to show "X" button 3997
/// </summary>
public const uint CancelVisibleJoin = 3997;
/// <summary>
/// Visibility join to show "X" button 3997
/// </summary>
public const uint CancelVisibleJoin = 3997;
/// <summary>
/// Shows the modal subpage. Boolean feeback join 3999
/// </summary>
public const uint ModalVisibleJoin = 3999;
/// <summary>
/// The seconds value of the countdown timer. Ushort join 3991
/// </summary>
//public const uint TimerSecondsJoin = 3991;
///// <summary>
///// The seconds value of the countdown timer. Ushort join 3991
///// </summary>
//public const uint TimerSecondsJoin = 3991;
/// <summary>
/// The full ushort value of the countdown timer for a gauge. Ushort join 3992
/// </summary>
@@ -77,15 +77,15 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// Returns true when modal is showing
/// </summary>
public bool ModalIsVisible
{
get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; }
public bool ModalIsVisible
{
get { return TriList.BooleanInput[ModalVisibleJoin].BoolValue; }
}
/// <summary>
///
/// </summary>
public bool CanCancel { get; private set; }
/// <summary>
///
/// </summary>
public bool CanCancel { get; private set; }
BasicTriList TriList;
@@ -103,10 +103,10 @@ namespace PepperDash.Essentials.Core
TriList = triList;
// Attach actions to buttons
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1));
triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2));
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
CanCancel = true;
triList.SetSigFalseAction(CancelButtonJoin, () => { if (CanCancel) CancelDialog(); });
CanCancel = true;
}
/// <summary>
@@ -117,7 +117,7 @@ namespace PepperDash.Essentials.Core
/// <param name="decreasingGauge">If the progress bar gauge needs to count down instead of up</param>
/// <param name="completeAction">The action to run when the dialog is dismissed. Parameter will be 1 or 2 if button pressed, or 0 if dialog times out</param>
/// <returns>True when modal is created.</returns>
public bool PresentModalDialog(uint numberOfButtons, string title, string iconName,
public bool PresentModalDialog(uint numberOfButtons, string title, string iconName,
string message, string button1Text,
string button2Text, bool showGauge, bool showCancel, Action<uint> completeAction)
{
@@ -151,15 +151,15 @@ namespace PepperDash.Essentials.Core
TriList.StringInput[Button2TextJoin].StringValue = button2Text;
}
// Show/hide guage
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
CanCancel = showCancel;
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge;
CanCancel = showCancel;
TriList.BooleanInput[CancelVisibleJoin].BoolValue = showCancel;
//Reveal and activate
TriList.BooleanInput[ModalVisibleJoin].BoolValue = true;
WakePanel();
WakePanel();
return true;
}
@@ -167,48 +167,48 @@ namespace PepperDash.Essentials.Core
return false;
}
/// <summary>
/// WakePanel method
/// </summary>
public void WakePanel()
{
try
{
var panel = TriList as TswFt5Button;
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
panel.ExtenderSystemReservedSigs.BacklightOn();
}
catch
{
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
}
}
/// <summary>
/// CancelDialog method
/// </summary>
public void CancelDialog()
/// <summary>
/// WakePanel method
/// </summary>
public void WakePanel()
{
OnModalComplete(0);
try
{
var panel = TriList as TswFt5Button;
if (panel != null && panel.ExtenderSystemReservedSigs.BacklightOffFeedback.BoolValue)
panel.ExtenderSystemReservedSigs.BacklightOn();
}
catch
{
Debug.LogMessage(LogEventLevel.Debug, "Error Waking Panel. Maybe testing with Xpanel?");
}
}
/// <summary>
/// Hides dialog. Fires no action
/// </summary>
public void HideDialog()
{
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
}
/// <summary>
/// CancelDialog method
/// </summary>
public void CancelDialog()
{
OnModalComplete(0);
}
/// <summary>
/// Hides dialog. Fires no action
/// </summary>
public void HideDialog()
{
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
}
// When the modal is cleared or times out, clean up the various bits
void OnModalComplete(uint buttonNum)
{
TriList.BooleanInput[ModalVisibleJoin].BoolValue = false;
var action = ModalCompleteAction;
if (action != null)
action(buttonNum);
var action = ModalCompleteAction;
if (action != null)
action(buttonNum);
}
}

View File

@@ -140,17 +140,19 @@ namespace PepperDash.Essentials.AppServer.Messengers
if (Camera is IHasCameraPresets presetsCamera)
{
for (int i = 1; i <= 6; i++)
AddAction("/recallPreset", (id, content) =>
{
var preset = i;
AddAction("/cameraPreset" + i, (id, content) =>
{
var msg = content.ToObject<MobileControlSimpleContent<int>>();
var msg = content.ToObject<MobileControlSimpleContent<int>>();
presetsCamera.PresetSelect(msg.Value);
});
presetsCamera.PresetSelect(msg.Value);
});
}
AddAction("/storePreset", (id, content) =>
{
var msg = content.ToObject<MobileControlSimpleContent<int>>();
presetsCamera.PresetStore(msg.Value, string.Empty);
});
}
}
@@ -164,9 +166,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
return;
}
timerHandler(state.Value, cameraAction);
timerHandler(Camera.Key, cameraAction);
cameraAction(state.Value.Equals("true", StringComparison.InvariantCultureIgnoreCase));
}
/// <summary>

View File

@@ -0,0 +1,77 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using System.Collections.Generic;
namespace PepperDash.Essentials.AppServer.Messengers
{
/// <summary>
/// Represents a IBasicVideoMuteWithFeedbackMessenger
/// </summary>
public class IBasicVideoMuteWithFeedbackMessenger : MessengerBase
{
private readonly IBasicVideoMuteWithFeedback device;
public IBasicVideoMuteWithFeedbackMessenger(string key, string messagePath, IBasicVideoMuteWithFeedback device)
: base(key, messagePath, device as IKeyName)
{
this.device = device;
}
/// <summary>
/// SendFullStatus method
/// </summary>
public void SendFullStatus()
{
var messageObj = new IBasicVideoMuteWithFeedbackMessage
{
VideoMuteState = device.VideoMuteIsOn.BoolValue
};
PostStatusMessage(messageObj);
}
protected override void RegisterActions()
{
base.RegisterActions();
AddAction("/fullStatus", (id, content) => SendFullStatus());
AddAction("/videoMuteToggle", (id, content) =>
{
device.VideoMuteToggle();
});
AddAction("/videoMuteOn", (id, content) =>
{
device.VideoMuteOn();
});
AddAction("/videoMuteOff", (id, content) =>
{
device.VideoMuteOff();
});
device.VideoMuteIsOn.OutputChange += VideoMuteIsOnFeedback_OutputChange;
}
private void VideoMuteIsOnFeedback_OutputChange(object sender, FeedbackEventArgs args)
{
PostStatusMessage(JToken.FromObject(new
{
videoMuteState = args.BoolValue
})
);
}
}
/// <summary>
/// Represents a IBasicVideoMuteWithFeedbackMessage
/// </summary>
public class IBasicVideoMuteWithFeedbackMessage : DeviceStateMessageBase
{
[JsonProperty("videoMuteState")]
public bool VideoMuteState { get; set; }
}
}

View File

@@ -1,6 +1,6 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections.Generic;
namespace PepperDash.Essentials
{
@@ -9,25 +9,34 @@ namespace PepperDash.Essentials
/// </summary>
public class MobileControlConfig
{
/// <summary>
/// Gets or sets the ServerUrl
/// </summary>
[JsonProperty("serverUrl")]
public string ServerUrl { get; set; }
/// <summary>
/// Gets or sets the ClientAppUrl
/// </summary>
[JsonProperty("clientAppUrl")]
public string ClientAppUrl { get; set; }
/// <summary>
/// Gets or sets the DirectServer
/// </summary>
[JsonProperty("directServer")]
public MobileControlDirectServerPropertiesConfig DirectServer { get; set; }
[JsonProperty("applicationConfig")]
/// <summary>
/// Gets or sets the ApplicationConfig
/// </summary>
[JsonProperty("applicationConfig")]
public MobileControlApplicationConfig ApplicationConfig { get; set; } = null;
[JsonProperty("enableApiServer")]
/// <summary>
/// Gets or sets the EnableApiServer
/// </summary>
[JsonProperty("enableApiServer")]
public bool EnableApiServer { get; set; } = true;
}
@@ -36,27 +45,42 @@ namespace PepperDash.Essentials
/// </summary>
public class MobileControlDirectServerPropertiesConfig
{
[JsonProperty("enableDirectServer")]
/// <summary>
/// Gets or sets the EnableDirectServer
/// </summary>
[JsonProperty("enableDirectServer")]
public bool EnableDirectServer { get; set; }
[JsonProperty("port")]
/// <summary>
/// Gets or sets the Port
/// </summary>
[JsonProperty("port")]
public int Port { get; set; }
[JsonProperty("logging")]
/// <summary>
/// Gets or sets the Logging
/// </summary>
[JsonProperty("logging")]
public MobileControlLoggingConfig Logging { get; set; }
/// <summary>
/// Gets or sets the AutomaticallyForwardPortToCSLAN
/// </summary>
[JsonProperty("automaticallyForwardPortToCSLAN")]
public bool? AutomaticallyForwardPortToCSLAN { get; set; }
/// <summary>
/// Gets or sets the CSLanUiDeviceKeys
/// </summary>
/// <remarks>
/// A list of device keys for the CS LAN UI. These devices will get the CS LAN IP address instead of the LAN IP Address
/// </remarks>
[JsonProperty("csLanUiDeviceKeys")]
public List<string> CSLanUiDeviceKeys { get; set; }
/// <summary>
/// Initializes a new instance of the MobileControlDirectServerPropertiesConfig class.
/// </summary>
public MobileControlDirectServerPropertiesConfig()
{
Logging = new MobileControlLoggingConfig();
@@ -68,26 +92,26 @@ namespace PepperDash.Essentials
/// </summary>
public class MobileControlLoggingConfig
{
[JsonProperty("enableRemoteLogging")]
/// <summary>
/// Gets or sets the EnableRemoteLogging
/// </summary>
[JsonProperty("enableRemoteLogging")]
public bool EnableRemoteLogging { get; set; }
[JsonProperty("host")]
/// <summary>
/// Gets or sets the Host
/// </summary>
[JsonProperty("host")]
public string Host { get; set; }
[JsonProperty("port")]
/// <summary>
/// Gets or sets the Port
/// </summary>
[JsonProperty("port")]
public int Port { get; set; }
}
/// <summary>
@@ -95,16 +119,16 @@ namespace PepperDash.Essentials
/// </summary>
public class MobileControlRoomBridgePropertiesConfig
{
[JsonProperty("key")]
/// <summary>
/// Gets or sets the Key
/// </summary>
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("roomKey")]
/// <summary>
/// Gets or sets the RoomKey
/// </summary>
[JsonProperty("roomKey")]
public string RoomKey { get; set; }
}
@@ -113,53 +137,71 @@ namespace PepperDash.Essentials
/// </summary>
public class MobileControlSimplRoomBridgePropertiesConfig
{
[JsonProperty("eiscId")]
/// <summary>
/// Gets or sets the EiscId
/// </summary>
[JsonProperty("eiscId")]
public string EiscId { get; set; }
}
/// <summary>
/// Represents a MobileControlApplicationConfig
/// </summary>
public class MobileControlApplicationConfig
{
/// <summary>
/// Gets or sets the ApiPath
/// </summary>
[JsonProperty("apiPath")]
public string ApiPath { get; set; }
[JsonProperty("gatewayAppPath")]
/// <summary>
/// Gets or sets the GatewayAppPath
/// </summary>
[JsonProperty("gatewayAppPath")]
public string GatewayAppPath { get; set; }
/// <summary>
/// Gets or sets the EnableDev
/// </summary>
[JsonProperty("enableDev")]
public bool? EnableDev { get; set; }
[JsonProperty("logoPath")]
/// <summary>
/// Gets or sets the LogoPath
/// </summary>
[JsonProperty("logoPath")]
public string LogoPath { get; set; }
/// <summary>
/// Gets or sets the IconSet
/// </summary>
[JsonProperty("iconSet")]
[JsonConverter(typeof(StringEnumConverter))]
public MCIconSet? IconSet { get; set; }
/// <summary>
/// Gets or sets the LoginMode
/// </summary>
[JsonProperty("loginMode")]
public string LoginMode { get; set; }
/// <summary>
/// Gets or sets the Modes
/// </summary>
[JsonProperty("modes")]
public Dictionary<string, McMode> Modes { get; set; }
[JsonProperty("enableRemoteLogging")]
/// <summary>
/// Gets or sets the Logging
/// </summary>
[JsonProperty("enableRemoteLogging")]
public bool Logging { get; set; }
[JsonProperty("partnerMetadata", NullValueHandling = NullValueHandling.Ignore)]
/// <summary>
/// Gets or sets the PartnerMetadata
/// </summary>
[JsonProperty("partnerMetadata", NullValueHandling = NullValueHandling.Ignore)]
public List<MobileControlPartnerMetadata> PartnerMetadata { get; set; }
}
@@ -168,22 +210,22 @@ namespace PepperDash.Essentials
/// </summary>
public class MobileControlPartnerMetadata
{
[JsonProperty("role")]
/// <summary>
/// Gets or sets the Role
/// </summary>
[JsonProperty("role")]
public string Role { get; set; }
[JsonProperty("description")]
/// <summary>
/// Gets or sets the Description
/// </summary>
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("logoPath")]
/// <summary>
/// Gets or sets the LogoPath
/// </summary>
[JsonProperty("logoPath")]
public string LogoPath { get; set; }
}
@@ -192,21 +234,22 @@ namespace PepperDash.Essentials
/// </summary>
public class McMode
{
[JsonProperty("listPageText")]
/// <summary>
/// Gets or sets the ListPageText
/// </summary>
[JsonProperty("listPageText")]
public string ListPageText { get; set; }
[JsonProperty("loginHelpText")]
/// <summary>
/// Gets or sets the LoginHelpText
/// </summary>
[JsonProperty("loginHelpText")]
public string LoginHelpText { get; set; }
[JsonProperty("passcodePageText")]
/// <summary>
/// Gets or sets the PasscodePageText
/// </summary>
[JsonProperty("passcodePageText")]
public string PasscodePageText { get; set; }
}
@@ -215,8 +258,19 @@ namespace PepperDash.Essentials
/// </summary>
public enum MCIconSet
{
/// <summary>
/// Google icon set
/// </summary>
GOOGLE,
/// <summary>
/// Habanero icon set
/// </summary>
HABANERO,
/// <summary>
/// Neo icon set
/// </summary>
NEO
}
}

View File

@@ -505,6 +505,25 @@ namespace PepperDash.Essentials
messengerAdded = true;
}
if (device is IBasicVideoMuteWithFeedback)
{
var deviceKey = device.Key;
this.LogVerbose(
"Adding IBasicVideoMuteWithFeedback for {deviceKey}",
deviceKey
);
var videoMuteControlDevice = device as IBasicVideoMuteWithFeedback;
var messenger = new IBasicVideoMuteWithFeedbackMessenger(
$"{device.Key}-videoMute-{Key}",
string.Format("/device/{0}", deviceKey),
videoMuteControlDevice
);
AddDefaultDeviceMessenger(messenger);
messengerAdded = true;
}
if (device is ILightingScenes || device is LightingBase)
{
var deviceKey = device.Key;

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
@@ -14,6 +16,7 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.DeviceInfo;
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
using PepperDash.Essentials.Core.UI;
using Serilog.Events;
using Feedback = PepperDash.Essentials.Core.Feedback;
namespace PepperDash.Essentials.Touchpanel
@@ -106,6 +109,11 @@ namespace PepperDash.Essentials.Touchpanel
public ReadOnlyCollection<ConnectedIpInformation> ConnectedIps => Panel.ConnectedIpList;
private System.Net.IPAddress csIpAddress;
private System.Net.IPAddress csSubnetMask;
/// <summary>
/// Initializes a new instance of the MobileControlTouchpanelController class.
/// </summary>
@@ -182,6 +190,28 @@ namespace PepperDash.Essentials.Touchpanel
};
RegisterForExtenders();
try
{
var csAdapterId = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetCSAdapter);
var csSubnetMask = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, csAdapterId);
var csIpAddress = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, csAdapterId);
this.csSubnetMask = System.Net.IPAddress.Parse(csSubnetMask);
this.csIpAddress = System.Net.IPAddress.Parse(csIpAddress);
}
catch (ArgumentException)
{
Debug.LogInformation("This processor does not have a CS LAN", this);
}
catch (InvalidOperationException)
{
Debug.LogInformation("This processor does not have a CS LAN", this);
}
catch (Exception ex)
{
Debug.LogError($"Unexpected exception when checking CS LAN: {ex}", this);
}
}
/// <summary>
@@ -381,19 +411,81 @@ namespace PepperDash.Essentials.Touchpanel
McServerUrlFeedback.LinkInputSig(Panel.StringInput[3]);
UserCodeFeedback.LinkInputSig(Panel.StringInput[4]);
Panel.IpInformationChange += (sender, args) =>
{
if (args.Connected)
{
this.LogVerbose("Connection from IP: {ip}", args.DeviceIpAddress);
this.LogInformation("Sending {appUrl} on join 1", AppUrlFeedback.StringValue);
var appUrl = GetUrlWithCorrectIp(_appUrl);
Panel.StringInput[1].StringValue = appUrl;
SetAppUrl(appUrl);
}
else
{
this.LogVerbose("Disconnection from IP: {ip}", args.DeviceIpAddress);
}
};
Panel.OnlineStatusChange += (sender, args) =>
{
UpdateFeedbacks();
this.LogInformation("Sending {appUrl} on join 1", AppUrlFeedback.StringValue);
Panel.StringInput[1].StringValue = AppUrlFeedback.StringValue;
UpdateFeedbacks();
Panel.StringInput[1].StringValue = _appUrl;
Panel.StringInput[2].StringValue = QrCodeUrlFeedback.StringValue;
Panel.StringInput[3].StringValue = McServerUrlFeedback.StringValue;
Panel.StringInput[4].StringValue = UserCodeFeedback.StringValue;
};
}
/// <summary>
/// Gets the URL with the correct IP address based on the connected devices and the Crestron processor's IP address.
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
private string GetUrlWithCorrectIp(string url)
{
var lanAdapterId = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetLANAdapter);
var processorIp = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, lanAdapterId);
if(csIpAddress == null || csSubnetMask == null || url == null)
{
this.LogWarning("CS IP Address Subnet Mask or url is null, cannot determine correct IP for URL");
return url;
}
this.LogVerbose("Processor IP: {processorIp}, CS IP: {csIpAddress}, CS Subnet Mask: {csSubnetMask}", processorIp, csIpAddress, csSubnetMask);
this.LogVerbose("Connected IP Count: {connectedIps}", ConnectedIps.Count);
var ip = ConnectedIps.Any(ipInfo =>
{
if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp))
{
return csIpAddress.IsInSameSubnet(parsedIp, csSubnetMask);
}
this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress);
return false;
}) ? csIpAddress.ToString() : processorIp;
var match = Regex.Match(url, @"^http://([^:/]+):\d+/mc/app\?token=.+$");
if (match.Success)
{
string ipa = match.Groups[1].Value;
// ip will be "192.168.1.100"
}
// replace ipa with ip but leave the rest of the string intact
var updatedUrl = Regex.Replace(url, @"^http://[^:/]+", $"http://{ip}");
this.LogVerbose("Updated URL: {updatedUrl}", updatedUrl);
return updatedUrl;
}
private void SubscribeForMobileControlUpdates()
{
foreach (var dev in DeviceManager.AllDevices)
@@ -426,7 +518,7 @@ namespace PepperDash.Essentials.Touchpanel
_bridge.UserCodeChanged += UpdateFeedbacks;
_bridge.AppUrlChanged += (s, a) =>
{
this.LogInformation("AppURL changed");
this.LogInformation("AppURL changed: {appURL}", _bridge.AppUrl);
SetAppUrl(_bridge.AppUrl);
UpdateFeedbacks(s, a);
};
@@ -443,7 +535,8 @@ namespace PepperDash.Essentials.Touchpanel
/// </summary>
public void SetAppUrl(string url)
{
_appUrl = url;
_appUrl = GetUrlWithCorrectIp(url);
AppUrlFeedback.FireUpdate();
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net.Http;
@@ -41,8 +42,14 @@ namespace PepperDash.Essentials.WebSocketServer
private HttpServer _server;
/// <summary>
/// Gets the HttpServer instance
/// </summary>
public HttpServer Server => _server;
/// <summary>
/// Gets the collection of UI client contexts
/// </summary>
public Dictionary<string, UiClientContext> UiClients { get; private set; }
private readonly MobileControlSystemController _parent;
@@ -61,17 +68,20 @@ namespace PepperDash.Essentials.WebSocketServer
}
}
private string lanIpAddress => CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetLANAdapter));
private string LanIpAddress => CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetLANAdapter));
private System.Net.IPAddress csIpAddress;
private readonly System.Net.IPAddress csIpAddress;
private System.Net.IPAddress csSubnetMask;
private readonly System.Net.IPAddress csSubnetMask;
/// <summary>
/// The path for the WebSocket messaging
/// </summary>
private readonly string _wsPath = "/mc/api/ui/join/";
/// <summary>
/// Gets the WebSocket path
/// </summary>
public string WsPath => _wsPath;
/// <summary>
@@ -89,6 +99,9 @@ namespace PepperDash.Essentials.WebSocketServer
/// </summary>
public int Port { get; private set; }
/// <summary>
/// Gets the user app URL prefix
/// </summary>
public string UserAppUrlPrefix
{
get
@@ -101,6 +114,9 @@ namespace PepperDash.Essentials.WebSocketServer
}
}
/// <summary>
/// Gets the count of connected UI clients
/// </summary>
public int ConnectedUiClientsCount
{
get
@@ -119,6 +135,9 @@ namespace PepperDash.Essentials.WebSocketServer
}
}
/// <summary>
/// Initializes a new instance of the MobileControlWebsocketServer class.
/// </summary>
public MobileControlWebsocketServer(string key, int customPort, MobileControlSystemController parent)
: base(key)
{
@@ -327,17 +346,26 @@ namespace PepperDash.Essentials.WebSocketServer
}
string ip = processorIp;
if (touchpanel.Touchpanel is IMobileControlCrestronTouchpanelController crestronTouchpanel && csIpAddress != null)
// Moved to the MobileControlTouchpanelController class in the GetUrlWithCorrectIp method
// triggered by the Panel.IpInformationChange event so that we know we have the necessary info
// to make the determination of which IP to use.
//if (touchpanel.Touchpanel is IMobileControlCrestronTouchpanelController crestronTouchpanel && csIpAddress != null)
//{
// ip = crestronTouchpanel.ConnectedIps.Any(ipInfo =>
// {
// if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp))
// {
// return csIpAddress.IsInSameSubnet(parsedIp, csSubnetMask);
// }
// this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress);
// return false;
// }) ? csIpAddress.ToString() : processorIp;
//}
if (_parent.Config.DirectServer.CSLanUiDeviceKeys != null && _parent.Config.DirectServer.CSLanUiDeviceKeys.Any(k => k.Equals(touchpanel.Touchpanel.Key, StringComparison.InvariantCultureIgnoreCase)) && csIpAddress != null)
{
ip = crestronTouchpanel.ConnectedIps.Any(ipInfo =>
{
if (System.Net.IPAddress.TryParse(ipInfo.DeviceIpAddress, out var parsedIp))
{
return csIpAddress.IsInSameSubnet(parsedIp, csSubnetMask);
}
this.LogWarning("Invalid IP address: {deviceIpAddress}", ipInfo.DeviceIpAddress);
return false;
}) ? csIpAddress.ToString() : processorIp;
ip = csIpAddress.ToString();
}
var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}";
@@ -621,6 +649,9 @@ namespace PepperDash.Essentials.WebSocketServer
CrestronConsole.ConsoleCommandResponse($"Token: {token}");
}
/// <summary>
/// Validates the grant code against the room key
/// </summary>
public (string, string) ValidateGrantCode(string grantCode, string roomKey)
{
var bridge = _parent.GetRoomBridge(roomKey);
@@ -634,6 +665,9 @@ namespace PepperDash.Essentials.WebSocketServer
return ValidateGrantCode(grantCode, bridge);
}
/// <summary>
/// Validates the grant code against the room key
/// </summary>
public (string, string) ValidateGrantCode(string grantCode, MobileControlBridgeBase bridge)
{
// TODO: Authenticate grant code passed in
@@ -655,6 +689,9 @@ namespace PepperDash.Essentials.WebSocketServer
}
}
/// <summary>
/// Generates a new client token for the specified bridge
/// </summary>
public (string, string) GenerateClientToken(MobileControlBridgeBase bridge, string touchPanelKey = "")
{
var key = Guid.NewGuid().ToString();

View File

@@ -563,14 +563,21 @@ namespace PepperDash.Essentials
if (zipFiles.Length == 1)
{
var zipFile = zipFiles[0];
var assetsRoot = System.IO.Path.GetFullPath(Global.FilePathPrefix);
if (!assetsRoot.EndsWith(Path.DirectorySeparatorChar.ToString()) && !assetsRoot.EndsWith(Path.AltDirectorySeparatorChar.ToString()))
{
assetsRoot += Path.DirectorySeparatorChar;
}
Debug.LogMessage(LogEventLevel.Information, "Found assets zip file: {zipFile:l}... Unzipping...", zipFile.FullName);
using (var archive = ZipFile.OpenRead(zipFile.FullName))
{
foreach (var entry in archive.Entries)
{
var destinationPath = Path.Combine(Global.FilePathPrefix, entry.FullName);
var fullDest = System.IO.Path.GetFullPath(destinationPath);
if (!fullDest.StartsWith(assetsRoot, StringComparison.OrdinalIgnoreCase))
throw new InvalidOperationException($"Entry '{entry.FullName}' is trying to extract outside of the target directory.");
// If the entry is a directory, ensure it exists and skip extraction
if (string.IsNullOrEmpty(entry.Name))
{
Directory.CreateDirectory(destinationPath);
@@ -581,11 +588,8 @@ namespace PepperDash.Essentials
if (Directory.Exists(destinationPath))
Directory.Delete(destinationPath, true);
// Ensure the parent directory exists
Directory.CreateDirectory(Path.GetDirectoryName(destinationPath));
entry.ExtractToFile(destinationPath, true);
Debug.LogMessage(LogEventLevel.Information, "Extracted: {entry:l} to {Destination}", entry.FullName, destinationPath);
}
}
@@ -597,6 +601,67 @@ namespace PepperDash.Essentials
File.Delete(file.FullName);
}
var htmlZipFiles = applicationDirectory.GetFiles("htmlassets*.zip");
if (htmlZipFiles.Length > 1)
{
throw new Exception("Multiple htmlassets zip files found in application directory. Please ensure only one htmlassets*.zip file is present and retry.");
}
if (htmlZipFiles.Length == 1)
{
var htmlZipFile = htmlZipFiles[0];
var programDir = new DirectoryInfo(Global.FilePathPrefix.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
var userOrNvramDir = programDir.Parent;
var rootDir = userOrNvramDir?.Parent;
if (rootDir == null)
{
throw new Exception($"Unable to determine root directory for html extraction. Current path: {Global.FilePathPrefix}");
}
var htmlDir = Path.Combine(rootDir.FullName, "html");
var htmlRoot = System.IO.Path.GetFullPath(htmlDir);
if (!htmlRoot.EndsWith(Path.DirectorySeparatorChar.ToString()) &&
!htmlRoot.EndsWith(Path.AltDirectorySeparatorChar.ToString()))
{
htmlRoot += Path.DirectorySeparatorChar;
}
Debug.LogMessage(LogEventLevel.Information, "Found htmlassets zip file: {zipFile:l}... Unzipping...", htmlZipFile.FullName);
using (var archive = ZipFile.OpenRead(htmlZipFile.FullName))
{
foreach (var entry in archive.Entries)
{
var destinationPath = Path.Combine(htmlDir, entry.FullName);
var fullDest = System.IO.Path.GetFullPath(destinationPath);
if (!fullDest.StartsWith(htmlRoot, StringComparison.OrdinalIgnoreCase))
throw new InvalidOperationException($"Entry '{entry.FullName}' is trying to extract outside of the target directory.");
if (string.IsNullOrEmpty(entry.Name))
{
Directory.CreateDirectory(destinationPath);
continue;
}
// Only delete the file if it exists and is a file, not a directory
if (File.Exists(destinationPath))
File.Delete(destinationPath);
var parentDir = Path.GetDirectoryName(destinationPath);
if (!string.IsNullOrEmpty(parentDir))
Directory.CreateDirectory(parentDir);
entry.ExtractToFile(destinationPath, true);
Debug.LogMessage(LogEventLevel.Information, "Extracted: {entry:l} to {Destination}", entry.FullName, destinationPath);
}
}
}
// cleaning up html zip files
foreach (var file in htmlZipFiles)
{
File.Delete(file.FullName);
}
var jsonFiles = applicationDirectory.GetFiles("*configurationFile*.json");
if (jsonFiles.Length > 1)