This utility displays the field, ctor, and method membership of a SSCLI class.
Example #1
0
    /// <summary>
    ///  Main does all the real work.  call the arg processor, show the help, and
    ///  run throug the class list on the command line.
    /// </summary>
    /// <param name="args"></param>
    public static void Main (String[] args) 
    {
      corcls lister = new corcls();

      // processArgs() will set the switches and return an array of the non-
      // switch arguments -- the classnames to be displayed.
      String[] classList = lister.processArgs( args );

      // show help if the user asked, or if there were no classname args
      if (showHelp || (classList.Length == 0 && lister.moduleName == null)) 
      {
        Console.WriteLine( "corcls:  Shared Source CLI Runtime class display utility" );

        Console.WriteLine( "\nusage: corcls [options] <classname> [classname...]" );
        Console.WriteLine( "" );
        Console.WriteLine( "   options" );
        Console.WriteLine( "   -a <level>  abbreviation level [ short | medium | long ]" );
        Console.WriteLine( "   -w          generate HTML content" );
        Console.WriteLine( "   -f          force full package qualifiers" );
        Console.WriteLine( "   -m <module> load and search the named CLI assembly" );
        Console.WriteLine( "   -noinherit  don't display inherited methods and fields" );
        Console.WriteLine( "   -o          only show class names within modules (use with -m)" );
        Console.WriteLine( "   -q          be quiet, suppress errors" );
        Console.WriteLine( "   -v          visible (public & protected) classes/methods/fields only" );
        Console.WriteLine( "   -p          public classes, methods, or fields only" );
        Console.WriteLine( "   -h          Show this usage help" );
      }

      Assembly module = null;
      if (lister.moduleName != null)
        module = Assembly.LoadFrom( lister.moduleName );

      // there are no named classes, dump all in the module
      if (classList.Length == 0) 
      {
        lister.showModule( module );
      }
      else 
      {
        // for each classname in the list
        for (int i = 0; i < classList.Length; i++) 
        {
          if (classList[ i ].Equals( "*" ))
            lister.showModule( module );
          else 
          {
            // find the Class
            Type cls = FindClass( classList[ i ], module );

            // if null then there's a problem
            if (cls == null) 
            {
              if (!BaseGenerator.beQuiet)
                Console.WriteLine( "class " + classList[ i ] + " not found." );
            }
            else
              // or, we've got one, so show it.
              lister.showClass( cls );
          }
        }
      }
    }
Example #2
0
        /// <summary>
        ///  Main does all the real work.  call the arg processor, show the help, and
        ///  run throug the class list on the command line.
        /// </summary>
        /// <param name="args"></param>
        public static void Main(String[] args)
        {
            corcls lister = new corcls();

            // processArgs() will set the switches and return an array of the non-
            // switch arguments -- the classnames to be displayed.
            String[] classList = lister.processArgs(args);

            // show help if the user asked, or if there were no classname args
            if (showHelp || (classList.Length == 0 && lister.moduleName == null))
            {
                Console.WriteLine("corcls:  Shared Source CLI Runtime class display utility");

                Console.WriteLine("\nusage: corcls [options] <classname> [classname...]");
                Console.WriteLine("");
                Console.WriteLine("   options");
                Console.WriteLine("   -a <level>  abbreviation level [ short | medium | long ]");
                Console.WriteLine("   -w          generate HTML content");
                Console.WriteLine("   -f          force full package qualifiers");
                Console.WriteLine("   -m <module> load and search the named CLI assembly");
                Console.WriteLine("   -noinherit  don't display inherited methods and fields");
                Console.WriteLine("   -o          only show class names within modules (use with -m)");
                Console.WriteLine("   -q          be quiet, suppress errors");
                Console.WriteLine("   -v          visible (public & protected) classes/methods/fields only");
                Console.WriteLine("   -p          public classes, methods, or fields only");
                Console.WriteLine("   -h          Show this usage help");
            }

            Assembly module = null;

            if (lister.moduleName != null)
            {
                module = Assembly.LoadFrom(lister.moduleName);
            }

            // there are no named classes, dump all in the module
            if (classList.Length == 0)
            {
                lister.showModule(module);
            }
            else
            {
                // for each classname in the list
                for (int i = 0; i < classList.Length; i++)
                {
                    if (classList[i].Equals("*"))
                    {
                        lister.showModule(module);
                    }
                    else
                    {
                        // find the Class
                        Type cls = FindClass(classList[i], module);

                        // if null then there's a problem
                        if (cls == null)
                        {
                            if (!BaseGenerator.beQuiet)
                            {
                                Console.WriteLine("class " + classList[i] + " not found.");
                            }
                        }
                        else
                        {
                            // or, we've got one, so show it.
                            lister.showClass(cls);
                        }
                    }
                }
            }
        }