Ejemplo n.º 1
0
 public override string getHelp(string format)
 {
     if ("".Equals(format) || StreamFactoryRegistry.DEFAULT_FORMAT.Equals(format))
     {
         return(getBasicHelp(paramsClass, StreamFactoryRegistry.getFactory(type, StreamFactoryRegistry.DEFAULT_FORMAT).getParameters <P>()));
     }
     else
     {
         ObjectStreamFactory factory = StreamFactoryRegistry.getFactory(type, format);
         if (null == factory)
         {
             throw new TerminateToolException(1, "Format " + format + " is not found.\n" + Help);
         }
         return("Usage: " + CLI.CMD + " " + Name + "." + format + " " + ArgumentParser.createUsage(paramsClass, factory.getParameters <P>()));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Validates arguments using parameters from <code>argProxyInterface</code> and the parameters of the
        /// <code>format</code>.
        /// </summary>
        /// <param name="args"> arguments </param>
        /// <param name="argProxyInterface"> interface with parameter descriptions </param>
        /// <param name="format"> data format name </param>
        /// @param <A> A </param>
        protected internal virtual void validateAllArgs <A>(string[] args, Type argProxyInterface, string format)
        {
            ObjectStreamFactory factory = getStreamFactory(format);
            string errMessage           = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface, factory.getParameters <A>());

            if (null != errMessage)
            {
                throw new TerminateToolException(1, errMessage + "\n" + getHelp(format));
            }
        }