protected override Channel <T> Visitor <T>(ChannelAdapter <T> channel) { Channel <T> output = channel.Output; if (_channels.Contains(output)) { var shunt = new ShuntChannel <T>(); channel.ChangeOutputChannel(output, shunt); _channels.Remove(output); } Channel <T> newOutput = Visit(output); if (newOutput != output) { channel.ChangeOutputChannel(output, newOutput); } return(channel); }
protected override UntypedChannel Visitor(ChannelAdapter channel) { channel.ChangeOutputChannel(output => { UntypedChannel replacement = Visit(output); if (_channels.Contains(output)) { replacement = null; _channels.Remove(output); } return(replacement ?? new ShuntChannel()); }); return(channel); }
protected override UntypedChannel Visitor(ChannelAdapter channel) { UntypedChannel original = channel.Output; UntypedChannel replacement = Visit(original); if (!_added) { if (replacement.GetType() == typeof(ShuntChannel)) { replacement = new BroadcastChannel(new[] { _newChannel }); _added = true; } } if (original != replacement) { channel.ChangeOutputChannel(original, replacement); } return(channel); }
protected override Channel <T> Visitor <T>(ChannelAdapter <T> channel) { channel.ChangeOutputChannel(output => { Channel <T> replacement = output; if (_channels.Contains(output)) { replacement = new ShuntChannel <T>(); _channels.Remove(output); } Channel <T> newOutput = Visit(output); if (newOutput != output) { replacement = newOutput; } return(replacement); }); return(channel); }
protected override UntypedChannel Visitor(ChannelAdapter channel) { bool wasAdded = _added; channel.ChangeOutputChannel(original => { _added = wasAdded; UntypedChannel replacement = Visit(original); if (!_added) { if (replacement.GetType() == typeof(ShuntChannel)) { replacement = new BroadcastChannel(new[] { _newChannel }); _added = true; } } return(replacement); }); return(channel); }
protected override UntypedChannel Visitor(ChannelAdapter channel) { UntypedChannel original = channel.Output; UntypedChannel replacement = Visit(original); if (_channels.Contains(replacement)) { _channels.Remove(replacement); replacement = null; } if (replacement == null) { replacement = new ShuntChannel(); } if (replacement != original) { channel.ChangeOutputChannel(original, replacement); } return(channel); }
protected override UntypedChannel Visitor(ChannelAdapter channel) { UntypedChannel original = channel.Output; UntypedChannel replacement = Visit(original); if (!_added) { if (replacement.GetType() == typeof(ShuntChannel)) { replacement = new BroadcastChannel(new[] {_newChannel}); _added = true; } } if (original != replacement) channel.ChangeOutputChannel(original, replacement); return channel; }
protected override UntypedChannel Visitor(ChannelAdapter channel) { bool wasAdded = _added; channel.ChangeOutputChannel(original => { _added = wasAdded; UntypedChannel replacement = Visit(original); if (!_added) { if (replacement.GetType() == typeof(ShuntChannel)) { replacement = new BroadcastChannel(new[] { _newChannel }); _added = true; } } return replacement; }); return channel; }