private static string DumpWevt(Stream stream)
 {
     stream.Position  = 0;
     using var writer = new StringWriter();
     using var dumper = new EventTemplateDumper(writer);
     dumper.Verify    = false;
     dumper.DumpWevtTemplate(stream);
     return(writer.ToString());
 }
        private static string DumpMsg(Stream stream)
        {
            stream.Position  = 0;
            using var writer = new StringWriter();
            var dumper = new EventTemplateDumper(writer);

            dumper.DumpMessageTable(stream);
            return(writer.ToString());
        }
Esempio n. 3
0
        public int Execute()
        {
            var msgTableFile = opts.DumpMessageTable;
            var wevtFile     = opts.DumpEventTemplate;
            var d            = new EventTemplateDumper(Console.Out);

            if (msgTableFile != null)
            {
                try {
                    if (IsModule(wevtFile))
                    {
                        d.DumpMessageTableResource(wevtFile);
                    }
                    else
                    {
                        d.DumpMessageTable(msgTableFile);
                    }
                } catch (Exception ex) {
                    diags.ReportError(ex.Message);
                }
            }
            else if (wevtFile != null)
            {
                try {
                    if (IsModule(wevtFile))
                    {
                        d.DumpWevtTemplateResource(wevtFile);
                    }
                    else
                    {
                        d.DumpWevtTemplate(wevtFile);
                    }
                } catch (Exception ex) {
                    diags.ReportError(ex.Message);
                }
            }

            return(ExitCode.Success);
        }