namespace PepperDash.Essentials.Core { /// /// Represents a RouteSwitchDescriptor /// public class RouteSwitchDescriptor { /// /// Gets or sets the SwitchingDevice /// public IRoutingInputs SwitchingDevice { get { return InputPort?.ParentDevice; } } /// /// The output port being switched from (relevant for matrix switchers). Null for sink devices. /// public RoutingOutputPort OutputPort { get; set; } /// /// The input port being switched to. /// public RoutingInputPort InputPort { get; set; } /// /// Initializes a new instance of the class for sink devices (no output port). /// /// The input port being switched to. public RouteSwitchDescriptor(RoutingInputPort inputPort) { InputPort = inputPort; } /// /// Initializes a new instance of the class for matrix switchers. /// /// The output port being switched from. /// The input port being switched to. public RouteSwitchDescriptor(RoutingOutputPort outputPort, RoutingInputPort inputPort) { InputPort = inputPort; OutputPort = outputPort; } /// /// Returns a string representation of the route switch descriptor. /// /// A string describing the switch operation. /// public override string ToString() { if (SwitchingDevice is IRouting) return $"{(SwitchingDevice != null ? SwitchingDevice.Key : "No Device")} switches output {(OutputPort != null ? OutputPort.Key : "No output port")} to input {(InputPort != null ? InputPort.Key : "No input port")}"; else return $"{(SwitchingDevice != null ? SwitchingDevice.Key : "No Device")} switches to input {(InputPort != null ? InputPort.Key : "No input port")}"; } } }