diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs index 904bfc74..818c1e17 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs @@ -6,6 +6,7 @@ using Crestron.SimplSharp; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials.Core.Config { @@ -23,7 +24,10 @@ namespace PepperDash.Essentials.Core.Config [JsonProperty("sourceLists")] public Dictionary> SourceLists { get; set; } - [JsonProperty("tieLines")] + [JsonProperty("destinationLists")] + public Dictionary> DestinationLists { get; set; } + + [JsonProperty("tieLines")] public List TieLines { get; set; } [JsonProperty("joinMaps")] @@ -40,6 +44,14 @@ namespace PepperDash.Essentials.Core.Config return SourceLists[key]; } + public Dictionary GetDestinationListForKey(string key) + { + if (string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key)) + return null; + + return DestinationLists[key]; + } + /// /// Checks Devices for an item with a Key that matches and returns it if found. Otherwise, retunes null /// @@ -52,12 +64,9 @@ namespace PepperDash.Essentials.Core.Config var deviceConfig = Devices.FirstOrDefault(d => d.Key.Equals(key)); - if (deviceConfig != null) - return deviceConfig; - else - { - return null; - } + //removed if statement that was here... + //DeviceConfig will be null if it's not found in the list + return deviceConfig; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DestinationListItem.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DestinationListItem.cs new file mode 100644 index 00000000..56af8d6c --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DestinationListItem.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Newtonsoft.Json; +using PepperDash.Essentials.Core; + +namespace PepperDash_Essentials_Core.Devices +{ + public class DestinationListItem + { + [JsonProperty("sinkYey")] + public string SinkKey { get; set; } + + private EssentialsDevice _sinkDevice; + + public EssentialsDevice SinkDevice + { + get { return _sinkDevice ?? (_sinkDevice = DeviceManager.GetDeviceForKey(SinkKey) as EssentialsDevice); } + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs index 601d75a7..f5567255 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/SourceListItem.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharpPro; - +using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using PepperDash.Core; namespace PepperDash.Essentials.Core { @@ -31,16 +24,11 @@ namespace PepperDash.Essentials.Core /// Returns the source Device for this, if it exists in DeviceManager /// [JsonIgnore] - public Device SourceDevice + public EssentialsDevice SourceDevice { - get - { - if (_SourceDevice == null) - _SourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as Device; - return _SourceDevice; - } + get { return _sourceDevice ?? (_sourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as EssentialsDevice); } } - Device _SourceDevice; + private EssentialsDevice _sourceDevice; /// /// Gets either the source's Name or this AlternateName property, if @@ -51,13 +39,12 @@ namespace PepperDash.Essentials.Core { get { - if (string.IsNullOrEmpty(Name)) - { - if (SourceDevice == null) - return "---"; - return SourceDevice.Name; - } - return Name; + if (!string.IsNullOrEmpty(Name)) + { + return Name; + } + + return SourceDevice == null ? "---" : SourceDevice.Name; } }