public ServerCommandTarget InterpretTarget(string handlerId) { if (_channelHandlers.GetHandler(handlerId) == null) { return(ServerCommandTarget.ChannelMethod); } else { return(ServerCommandTarget.Channel); } }
public IServerCommand GetCommand(ServerCommandContext context) { if (context.CommandTarget == ServerCommandTarget.Channel) { var channelHandler = _channelHandlers.GetHandler(context.HandlerId); return(context.CommandType switch { ServerCommandType.Read => new ReadStateCommand(channelHandler), ServerCommandType.Restart => new RestartCommand(channelHandler), ServerCommandType.Start => new StartCommand(channelHandler), ServerCommandType.Stop => new StopCommand(channelHandler), _ => null });