private static void ShowUsage(Parameters parameters)
 {
     string helpString = parameters.GetUsageString(Assembly.GetExecutingAssembly(), 12);
     Console.WriteLine("\nUsage:");
     Console.WriteLine(helpString);
     Console.WriteLine("Note: For detailed help, use -?? or -help.");
 }
 private static void ShowHelp(Parameters parameters)
 {
     switch (parameters.HelpChars)
     {
         case "?":
             ShowUsage(parameters);
             return;
         case "help":
         case "??":
             string helpString = parameters.GetDetailedHelp(Assembly.GetExecutingAssembly());
             Console.WriteLine();
             Console.Write(helpString);
             Console.WriteLine("Note: For a usage summary, use -?.");
             return;
     }
 }
        private static Parameters CreateParameters(Parameter[] parmArray)
        {
            if ( parmArray == null )
                throw new ArgumentNullException("parmArray");
            if ( parmArray.Length == 0 )
                throw new ArgumentException("count is zero.", "parmArray");

            Parameters ps = new Parameters();

            foreach(Parameter p in parmArray)
            {
                if ( p == null )
                    throw new ArgumentNullException("parameter array contains a null element or element not of type Parameter.");
                ParameterSet pSet = ps.Find(p.SetName);
                if ( pSet == null )
                {
                    pSet = ParameterSet.CreateParameterSet(p.SetName);
                    ps.Add(pSet);	// Add the new parm set.
                }
                pSet.Add(p);		// Add the parm.  If dup, will error.
            }
            // Changed 4/13
            // Enum parms and remove dups.  You will get dups when ParameterAttribute is
            // used multiple times to add parm to different sets.
            Hashtable ht = new Hashtable();
            foreach(Parameter p in parmArray)
            {
                ht[p.Name] = p;
            }
            ArrayList al = new ArrayList();
            foreach(Parameter p in ht.Values)
            {
                al.Add(p);
            }
            // Sort al by parameter name.
            al.Sort(new ParameterNameComparer());
            ps.parameters = (Parameter[])al.ToArray(typeof(Parameter));
            return ps;
        }