BF2Statistics.ExceptionForm.ShowTemplateError C# (CSharp) Method

ShowTemplateError() public static method

Displays a custom version of this form to display Razor template compile errors
public static ShowTemplateError ( TemplateCompilationException E, string TemplateFile ) : DialogResult
E TemplateCompilationException
TemplateFile string
return DialogResult
        public static DialogResult ShowTemplateError(TemplateCompilationException E, string TemplateFile)
        {
            using (ExceptionForm F = new ExceptionForm(E, true))
            {
                // Get our relative path from the program root
                string fileRelativePath = TemplateFile.Replace(Program.RootPath, "");

                // Set the window properties
                F.WindowTitle = "Compile Error";
                F.HeaderText = "Template Compile Error";
                F.Message = "An error occured while trying to compile the file \"" + Path.GetFileName(fileRelativePath) + "\"";
                F.ImgIcon = Properties.Resources.vistaWarning;

                if (E.CompilerErrors.Count > 0)
                {
                    StringBuilder builder = new StringBuilder();

                    // Append each error's details into the Details stringbuilder
                    foreach (RazorEngineCompilerError error in E.CompilerErrors)
                    {
                        builder.AppendLine("Compile Error:");
                        builder.AppendLine(error.ErrorText);
                        builder.AppendLine();
                        builder.AppendLine("Error #: " + error.ErrorNumber);
                        builder.AppendLine("File: " + fileRelativePath);
                        builder.AppendLine("Line: " + error.Line);
                        builder.AppendLine("Column: " + error.Column);
                        builder.AppendLine();
                    }

                    // Set the Details pane contents
                    F.ExceptionDetails.Text = builder.ToString();
                }
                else
                {
                    F.ExceptionDetails.Text = E.Message;
                }

                return F.ShowDialog(false);
            }
        }