Пример #1
0
            static void Main(string[] args)
            {
                bool            is_verbose     = false;
                bool            show_help      = false;
                CLRPH_DEMANGLER demangler_name = CLRPH_DEMANGLER.Default;

                OptionSet opts = new OptionSet()
                {
                    { "v|verbose", "redirect debug traces to console", v => is_verbose = v != null },
                    { "h|help", "show this message and exit", v => show_help = v != null },
                    { "d=|demangler=", "Choose demangler name", v => demangler_name = ParseDemanglerName(v) },
                };

                List <string> eps = opts.Parse(args);

                if (show_help)
                {
                    ShowHelp(opts);
                    return;
                }

                if (is_verbose)
                {
                    // Redirect debug log to the console
                    Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
                    Debug.AutoFlush = true;
                }

                // always the first call to make
                Phlib.InitializePhLib();
                Demangler demangler;

                switch (args.Length)
                {
                case 0:
                    demangler = new Demangler(CLRPH_DEMANGLER.Microsoft);
                    TestKnownInputs(demangler);
                    break;

                default:
                case 1:
                    demangler = new Demangler(demangler_name);
                    string Filepath = args[1];

                    if (NativeFile.Exists(Filepath))
                    {
                        TestFilepath(Filepath, demangler);
                    }
                    else
                    {
                        string undecoratedName = demangler.UndecorateName(args[1]).Item2;
                        Console.WriteLine(undecoratedName);
                    }

                    break;
                }

                // Force flushing out buffer
                Console.Out.Flush();
            }
Пример #2
0
 public Demangler(CLRPH_DEMANGLER demangler = CLRPH_DEMANGLER.Default)
 {
     _demangler = demangler;
 }