Пример #1
0
        public void SaveHtmlFile(string saveFile, string fileName, bool headerIncludes = true)
        {
            using (StreamReader reader = new StreamReader(fileName, Encoding.UTF8))
            {
                using (StreamWriter writer = new StreamWriter(saveFile, false, Encoding.UTF8))
                {
                    StringWriter messageWriter = new StringWriter();

                    HtmlEncodeParameters parameters = new HtmlEncodeParameters();
                    parameters.HeaderIncludes = headerIncludes;
                    parameters.DocumentTitle  = Path.GetFileNameWithoutExtension(fileName);
                    parameters.CssUrl         = Contents.GetCssPath();

                    MdocTool.EncodeHtml(
                        writer,
                        reader,
                        messageWriter,
                        parameters);
                }
            }
        }
Пример #2
0
        public void LoadMdocFile(string fileName)
        {
            using (StreamReader reader = new StreamReader(fileName, Encoding.UTF8))
            {
                StringWriter writer        = new StringWriter();
                StringWriter messageWriter = new StringWriter();

                HtmlEncodeParameters parameters = new HtmlEncodeParameters();
                parameters.HeaderIncludes = true;
                parameters.DocumentTitle  = Path.GetFileNameWithoutExtension(fileName);
                parameters.CssUrl         = Contents.GetCssAbsolutePath();

                MdocTool.EncodeHtml(
                    writer,
                    reader,
                    messageWriter,
                    parameters);

                mdocFile             = fileName;
                browser.DocumentText = writer.ToString();

                messageBox.Text = messageWriter.ToString();
            }
        }