BEurtle.BEurtlePlugin.writeHTML C# (CSharp) Метод

writeHTML() публичный Метод

public writeHTML ( IWin32Window hwnd, string rootdir = null ) : void
hwnd IWin32Window
rootdir string
Результат void
        public void writeHTML(IWin32Window hwnd, string rootdir=null)
        {
            if (rootdir == null) rootdir = rootpath;
            try
            {
                if (parameters.DumpHTML)
                {
                    if (parameters.DumpHTMLPath.Length < 3) throw new Exception("DumpHTMLPath has no length. This would delete your entire repo!");
                    try
                    {
                        Directory.Delete(rootdir + "\\" + parameters.DumpHTMLPath, true);
                    }
                    catch (Exception)
                    {
                    }
                    string result = callBEcmd(rootdir, new string[1] { "html -o \"" + parameters.DumpHTMLPath + "\"" })[0];
                    if (Directory.Exists(rootdir + "\\" + parameters.DumpHTMLPath))
                    {
                        // Strip out the generated date
                        var htmlfiles = walkDirectoryTree(new DirectoryInfo(rootdir + "\\" + parameters.DumpHTMLPath), new string[1] { "*.html" });
                        foreach (var htmlfile in htmlfiles)
                        {
                            var fh = new StreamReader(htmlfile);
                            var f = fh.ReadToEnd();
                            fh.Close();
                            int idx = f.LastIndexOf("<p>Generated by <a href=\"http://www.bugseverywhere.org/\">");
                            if (idx >= 0)
                            {
                                idx = f.IndexOf("</a>", idx);
                                var eidx = f.IndexOf("</p>", idx);
                                f = f.Remove(idx + 4, eidx - idx - 4);
                                var fo = new StreamWriter(htmlfile);
                                fo.Write(f);
                                fo.Close();
                            }
                        }
                        // Add any new HTML files
                        result = callBEcmd(rootdir, new string[1] { "vcs add \"" + parameters.DumpHTMLPath + "\"" })[0];
                        if (result.Contains("ERROR:"))
                            throw new Exception(result);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(hwnd, "Error when writing HTML: " + e.ToString(), "Error from BEurtle", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }