public HandlerMapping(string version, string command, string type, string assembly)
        {
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }

            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            _versionMapping = ConvertToVersionMapping(version);
            _commandMapping = ConvertToCommandMapping(command);
            _handler        = CreateMessageHandler(assembly, type);
        }
        public HandlerMapping(VersionFlags version, CommandType command, IMessageHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            _versionMapping = version;
            _commandMapping = command;
            _handler        = handler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HandlerMapping"/> class.
        /// </summary>
        /// <param name="version">The version, flagged enum</param>
        /// <param name="command">The command.</param>
        /// <param name="type">The type.</param>
        /// <param name="assembly">The assembly.</param>
        public HandlerMapping(VersionFlags version, CommandType command, string type, string assembly)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            _versionMapping = version;
            _commandMapping = command;
            _handler        = CreateMessageHandler(assembly, type);
        }
        public HandlerMapping(string version, string command, IMessageHandler handler)
        {
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }

            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            _commandMapping = ConvertToCommandMapping(command);
            _versionMapping = ConvertToVersionMapping(version);
            _handler        = handler;
        }
        private static bool MatchVersionCode(VersionCode msgVersion, VersionFlags flags)
        {
            //GetFlags would be more "elegant", but this is simply faster and for now good enough to maintain
            if (msgVersion == VersionCode.V1 && (flags & VersionFlags.V1) == VersionFlags.V1)
            {
                return(true);
            }
            if (msgVersion == VersionCode.V2 && (flags & VersionFlags.V2) == VersionFlags.V2)
            {
                return(true);
            }
            if (msgVersion == VersionCode.V2U && (flags & VersionFlags.V2) == VersionFlags.V2)
            {
                return(true);
            }
            if (msgVersion == VersionCode.V3 && (flags & VersionFlags.V3) == VersionFlags.V3)
            {
                return(true);
            }

            return(false);
        }