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")}"; } } /*/// /// Represents an individual link for a route /// /// /// Represents a RouteSwitchDescriptor /// public class RouteSwitchDescriptor { /// /// Gets or sets the SwitchingDevice /// public IRoutingInputs SwitchingDevice { get { return InputPort.ParentDevice; } } /// /// Gets or sets the OutputPort /// public RoutingOutputPort OutputPort { get; set; } /// /// Gets or sets the InputPort /// public RoutingInputPort InputPort { get; set; } public RouteSwitchDescriptor(RoutingInputPort inputPort) { InputPort = inputPort; } public RouteSwitchDescriptor(RoutingOutputPort outputPort, RoutingInputPort inputPort) { InputPort = inputPort; OutputPort = outputPort; } /// /// ToString method /// /// public override string ToString() { if (SwitchingDevice is IRouting) return string.Format("{0} switches output '{1}' to input '{2}'", SwitchingDevice.Key, OutputPort.Selector, InputPort.Selector); else return string.Format("{0} switches to input '{1}'", SwitchingDevice.Key, InputPort.Selector); } }*/ }