예제 #1
0
    public CommandLine()
    {
        bool usersGuide = false;

        CommandLineParser.ParseForConsoleApplication(delegate(CommandLineParser parser)
        {
            string dllPathHelp = "The path to the DLL containing the Event provider (the class that subclasses EventSource).";
            // parser.NoDashOnParameterSets = true;
            // #CommandLineDefinitions
            parser.DefineOptionalQualifier("ReferencePath", ref ReferencePath, "If specified, use this list of semi-colon separated assemblies to resolve the assembly containing the EventSource base class. Use only if regular resolution does not work adequately.");
            parser.DefineOptionalQualifier("ManifestGenerator", ref ManifestGenerator,
                                           "Specifies what code runs to validate and generate the manifest for the user-defined event source classes. " +
                                           "Use \"builtin\" (the default choice) to choose the tool's builtin EventSource. " +
                                           "Use \"base\" to choose the code from the base class of the user-defined event source. " +
                                           "Or use a path name to choose the first \"EventSource\" type from the assembly specified by the path.");

            parser.DefineParameterSet("UsersGuide", ref usersGuide, true, "Display the users guide.");

            parser.DefineParameterSet("DumpManifest", ref Command, CommandType.DumpManifest, "Just generates the XML manifest for the managed code.");
            parser.DefineParameter("AssemblyPath", ref DllPath, dllPathHelp);
            parser.DefineOptionalParameter("ManifestXmlPrefix", ref ManifestPrefix, "The file name prefix used to generate output file names for the provider manifests.");

            parser.DefineParameterSet("CompileManifest", ref Command, CommandType.CompileManifest, "Just generates the registration DLL from the XML manifest.");
            parser.DefineParameter("ManifestXmlPath", ref ManPath, "The path to the XML manifest containing the Event provider");
            DllPath = ManPath; // fake it so "Main" can create the secondary app domain

            parser.DefineParameterSet("DumpRegDlls", ref Command, CommandType.DumpRegDlls, "Just generates the XML manifest and registration DLL for the managed code.");
            parser.DefineOptionalQualifier("ForceAll", ref ForceAll, "If specified, generate manifests and registration DLLs for all EventSource-derived classes, otherwise it generates them only for the classes that need explicit registration.");
            parser.DefineParameter("AssemblyPath", ref DllPath, dllPathHelp);
            parser.DefineOptionalParameter("ManifestXmlPrefix", ref ManifestPrefix, "The file name prefix used to generate output file names for the provider manifests.");

            parser.DefineParameterSet("Uninstall", ref Command, CommandType.Uninstall, "Uninstall all providers defined in the assembly.");
            parser.DefineParameter("AssemblyPath", ref DllPath, dllPathHelp);

            parser.DefineDefaultParameterSet("Installs managed Event Tracing for Windows (ETW) event providers defined in the assembly.");
            parser.DefineParameter("AssemblyPath", ref DllPath, dllPathHelp);
            parser.DefineOptionalParameter("ManifestXmlPrefix", ref ManifestPrefix, "The file name prefix used to generate output file names for the provider manifests.");
        });
        if (usersGuide)
        {
            UsersGuide.DisplayConsoleAppUsersGuide("UsersGuide.htm");
        }
    }
예제 #2
0
    public CommandLine()
    {
        bool usersGuide = false;

        CommandLineParser.ParseForConsoleApplication(delegate(CommandLineParser parser)
        {
            // #CommandLineDefinitions
            parser.DefineParameterSet("UsersGuide", ref usersGuide, true, "Display the users guide.");
            parser.DefineDefaultParameterSet("Generates a set of C# classes that can be used with TraceEvent to parse ETW events.\r\n" +
                                             "OS providers can be listed using 'logMan query Providers' and a manifest obtained by doing\r\n" +
                                             "* PerfView /nogui userCommand DumpRegisteredManifest PROVIDER_NAME\r\n" +
                                             "EventSource manifests can be obtained from an ETL file containing EventSource data using\r\n" +
                                             "* PerfView /nogui userCommand DumpEventSourceManifests etlFileName\r\n" +
                                             "If the DLL containing the EventSource is available, TraceParserGen can use it directly with the /EventSource qualifier.\r\n" +
                                             "* TraceParserGen /EventSource EVENTSOURCE_DLL\r\n");
            parser.DefineOptionalQualifier("Verbose", ref Verbose, "Print Verbose information.");
            parser.DefineOptionalQualifier("EventSource", ref EventSource, "Assume 'ManifestFile' is a text EXE or DLL, " +
                                           "This parameter indicates the name of the event source in the EXE or DLL to generate.  " +
                                           "Passing the empty string will select every eventSource in the file.");
            parser.DefineOptionalQualifier("Internal", ref Internal, "If specified generates a provider that defines the overrides \"internal\".");
            parser.DefineOptionalQualifier("NeedsState", ref NeedsState, "If specified generates a provider that has a state class associated with it.");
            parser.DefineParameter("ManifestFile", ref ManifestFile, "ETW Manifest to generate C# TraceEvent subclasses from.");
            parser.DefineOptionalParameter("OutputFile", ref outputFile, "The output C# file to generate.");
#if PRIVATE
            parser.DefineOptionalQualifier("Internal", ref Internal, "Make the Dispatch and Verify methods internal protected rather than just protected.");
            parser.DefineOptionalQualifier("Mof", ref Mof, "Assume 'ManifestFile' is a text MOF description instead of a manifest file.");
            parser.DefineOptionalQualifier("Old", ref Old, "Use old mechanism for generating a parser gen.");
#endif
#if MERGE
            parser.DefineOptionalQualifier("Merge", ref Merge, "Merge the differences between a /baseFile and the output file.");
            parser.DefineOptionalQualifier("BaseFile", ref baseFile, "If /merge is specified, the differences between this file and output file will be merged in.");
            parser.DefineOptionalQualifier("RenameFile", ref RenameFile, "If /renameFile is a file that has two words per line, specifying how to rename identifiers.  They can be .NET regular expressions");
#endif
        });
        if (usersGuide)
        {
            UsersGuide.DisplayConsoleAppUsersGuide("UsersGuide.htm");
        }
    }