Ejemplo n.º 1
0
        //StdOut - output
        //StdIn - input
        //StdError - errors and messages
        //0 - D, A or Doc, assemble, disassemble or doc generation
        //1 - language (assembly or disassembly only)
        //2 - disassembly mode (disassembly only)
        //3 - offset to disassemble (disassembly only)
        //4 - priority to disassemble (disassembly only)
        //5 - length to disassemble (disassembly only)
        //flags: -addEndGuards
        //       -raws:Folder or file
        //       -rawsExt:extension
        //       -output:File
        //       -input:File
        //       -error:File
        //       -docHeader:File
        //       -docFooter:File
        private static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                return;
            }

            var messageLog = new MessageLog(1000);

            //var cmd = HandleFlags(flags, messageLog);
            var cmd = new CommandLineArgs();
            var error = cmd.SetArgs(args);

            if (!error.CausedError)
            {
                try
                {
                    Run(messageLog, cmd);
                }
                catch (Exception e)
                {
                    messageLog.AddError(e.Message);
                }
            }

            if (cmd.errorFile != null)
            {
                using (var writer = new StreamWriter(cmd.errorFile))
                {
                    messageLog.WriteToStream(writer);
                }
            }
            else
            {
                messageLog.WriteToStream(Console.Error);
            }
            messageLog.Clear();
        }
Ejemplo n.º 2
0
        public void PrintAll(MessageLog messageLog)
        {
            string message;
            using (StringWriter writer = new StringWriter())
            {
                messageLog.WriteToStream(writer);
                message = writer.ToString();
            }

            using (TextShower shower = new TextShower(message))
            {
                shower.Text = "";
                shower.ShowDialog();
            }
        }