示例#1
0
        public Consolery(Type targetType, object target, string[] args, IMessenger messenger, Notation notationType)
        {
            Contract.Requires(targetType != null);
            Contract.Requires(args != null);
            Contract.Requires(messenger != null);

            _target     = target;
            _targetType = targetType;
            _args       = args;
            _messenger  = messenger;

            _actionMethods = _targetType
                             .GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)
                             .Where(method => method.GetCustomAttributes(false).OfType <ActionAttribute>().Any())
                             .ToList();

            _metadata          = new Metadata(_actionMethods);
            _metadataValidator = new MetadataValidator(_targetType, _actionMethods, _metadata);
            if (notationType == Notation.Windows)
            {
                _notation = new WindowsNotationStrategy(_args, _messenger, _metadata, _targetType, _actionMethods);
            }
            else
            {
                _notation = new LinuxNotationStrategy(_args, _messenger, _metadata);
            }
        }
示例#2
0
        public Consolery(Type targetType, object target, string[] args, IMessenger messenger, Notation notationType)
        {
            Contract.Requires(targetType != null);
            Contract.Requires(args != null);
            Contract.Requires(messenger != null);

            _target = target;
            _targetType = targetType;
            _args = args;
            _messenger = messenger;

            _actionMethods = _targetType
                .GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)
                .Where(method => method.GetCustomAttributes(false).OfType<ActionAttribute>().Any())
                .ToList();

            _metadata = new Metadata(_actionMethods);
            _metadataValidator = new MetadataValidator(_targetType, _actionMethods, _metadata);
            if (notationType == Notation.Windows)
            {
                _notation = new WindowsNotationStrategy(_args, _messenger, _metadata, _targetType, _actionMethods);
            }
            else
            {
                _notation = new LinuxNotationStrategy(_args, _messenger, _metadata);
            }
        }