Esempio n. 1
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("usage: ReportWriterConsole.exe <input> <output>");
                return;
            }
            if (!File.Exists(args[0]))
            {
                Console.WriteLine("Input file does not exist: " + args[0]);
                return;
            }

            DocumentLib.Parser fullParser = new DocumentLib.Parser();
            string document = File.ReadAllText(args[0]);

            fullParser.SetDocument(document, Path.GetDirectoryName(args[0]));
            fullParser.Parse(true);

            string html = DocumentLib.HtmlGenerator.GetHtml(fullParser, true);

            File.WriteAllText(args[1], html);

            fullParser.GetLog().Reverse();

            foreach (DocumentLib.LogLine line in fullParser.GetLog())
            {
                int lineNum = GetLineNumber(document, line.position);
                string logLine = line.GetLevel() + ":" + lineNum + " " + line.text;
                Console.WriteLine(logLine);
            }

            Console.WriteLine("Exported document to '" + args[1] + "'");
        }
Esempio n. 2
0
        private void Export()
        {
            Save();
            UpdateInterface();

            DocumentLib.Parser fullParser = new DocumentLib.Parser();
            fullParser.SetDocument(txtDocument.Text, Path.GetDirectoryName(filePath));
            fullParser.Parse(true);

            string exportName = Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileName(filePath).Replace(".txt", ".html"));
            string html = DocumentLib.HtmlGenerator.GetHtml(fullParser);

            File.WriteAllText(exportName, html);

            tsslblTip.Text = "Exported document to '" + exportName + "'";
        }