mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 20:47:04 +00:00
feat: add IHasDestinationList and IHasSourceList interfaces for room management
This commit is contained in:
parent
5a07e837ee
commit
af913b9498
3 changed files with 47 additions and 1 deletions
14
src/PepperDash.Essentials.Core/Room/IHasDestinationList.cs
Normal file
14
src/PepperDash.Essentials.Core/Room/IHasDestinationList.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for rooms with a list of destinations
|
||||||
|
/// </summary>
|
||||||
|
interface IHasDestinationList
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the dictionary of destinations.
|
||||||
|
/// </summary>
|
||||||
|
Dictionary<string, IRoutingSink> Destinations { get; }
|
||||||
|
}
|
||||||
14
src/PepperDash.Essentials.Core/Room/IHasSourceList.cs
Normal file
14
src/PepperDash.Essentials.Core/Room/IHasSourceList.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for rooms with a list of destinations
|
||||||
|
/// </summary>
|
||||||
|
interface IHasSourceList
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of sources.
|
||||||
|
/// </summary>
|
||||||
|
Dictionary<string, SourceListItem> SourceList { get; }
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
@ -230,6 +231,15 @@ namespace PepperDash.Essentials.Core.Routing
|
||||||
return roomDefaultDisplay.DefaultDisplay.Key == destination.Key;
|
return roomDefaultDisplay.DefaultDisplay.Key == destination.Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r is IHasDestinationList roomDestinationList)
|
||||||
|
{
|
||||||
|
return roomDestinationList.Destinations.Any(d =>
|
||||||
|
d.Value.Key == destination.Key
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var destList = ConfigReader.ConfigObject.GetDestinationListForKey(r.DestinationListKey);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -247,7 +257,15 @@ namespace PepperDash.Essentials.Core.Routing
|
||||||
|
|
||||||
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found room {room} for destination {destination}", this, room.Key, destination.Key);
|
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Found room {room} for destination {destination}", this, room.Key, destination.Key);
|
||||||
|
|
||||||
var sourceList = ConfigReader.ConfigObject.GetSourceListForKey(room.SourceListKey);
|
Dictionary<string, SourceListItem> sourceList = null;
|
||||||
|
|
||||||
|
if (room is IHasSourceList roomWithSourceList)
|
||||||
|
{
|
||||||
|
sourceList = roomWithSourceList.SourceList;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sourceList = ConfigReader.ConfigObject.GetSourceListForKey(room.SourceListKey);
|
||||||
|
}
|
||||||
|
|
||||||
if (sourceList == null)
|
if (sourceList == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue