Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public WindowsNotationStrategy(string[] _args, IMessenger _messenger, Metadata _metadata, Type _targetType, List<MethodInfo> _actionMethods)
 {
     this._args = _args;
     this._messenger = _messenger;
     this._metadata = _metadata;
     this._targetType = _targetType;
     this._actionMethods = _actionMethods;
 }
Ejemplo n.º 3
0
 public MetadataValidator(Type targetType, IList<MethodInfo> actionMethods, Metadata metadata)
 {
     _targetType = targetType;
     _actionMethods = actionMethods;
     _metadata = metadata;
 }
Ejemplo n.º 4
0
 public LinuxNotationStrategy(string[] args, IMessenger messenger, Metadata metadata)
 {
     _args = args;
     _messenger = messenger;
     _metadata = metadata;
 }