Ejemplo n.º 1
0
        /// <summary>
        ///     Parses the specified arguments.
        /// </summary>
        /// <param name="args">The arguments.</param>
        /// <returns>IParseResult.</returns>
        public IParseResult Parse(string[] args)
        {
            var context = Context;
            var strat   = new ParseStrategy(context);

            strat = OnParseStrategyCreated(strat);
            return(strat.Parse(args));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Called when a new parse strategy has been created for use
        /// </summary>
        /// <param name="parseStrategy">The parse strategy.</param>
        /// <returns>ParseStrategy.</returns>
        protected virtual ParseStrategy OnParseStrategyCreated(ParseStrategy parseStrategy)
        {
            var parseStrategyCreatedEventArgs =
                new ParseStrategyCreatedEventArgs(parseStrategy.ThrowIfArgumentNull(nameof(parseStrategy)));

            ParseStrategyCreated?.Invoke(this, parseStrategyCreatedEventArgs);
            return(parseStrategyCreatedEventArgs.ParseStrategy);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ParseStrategyCreatedEventArgs" /> class.
 /// </summary>
 /// <param name="parseStrategy">The parse strategy.</param>
 public ParseStrategyCreatedEventArgs(ParseStrategy parseStrategy)
 {
     ParseStrategy = parseStrategy.ThrowIfArgumentNull(nameof(parseStrategy));
 }