Пример #1
0
 public void WriteSourceCode(SourceModel source, bool collapse = true)
 {
     this.Write(@"
 <div class='source code'>
     <label>");
     if (collapse)
     {
         this.Write(@"<input type='checkbox' class='collapse' />");
     }
     Write(@"<div class='source-prelines collapse-on'>");
     if (source.PreLines != null)
     {
         WriteSourceLines(source.LineNumber - source.PreLines.Length, source.PreLines);
     }
     Write(@"</div><div class='source-errorLine'>");
     if (source.CurrentLine != null)
     {
         WriteErrorLine(source.LineNumber, source.CurrentLine, source.ErrorColumn, source.ErrorLength);
     }
     this.Write(@"</div><div class='source-postlines collapse-on'>");
     if (source.PostLines != null)
     {
         WriteSourceLines(source.LineNumber + 1, source.PostLines);
     }
     Write(@"</div></label></div>");
     if (!string.IsNullOrEmpty(source.FileName))
     {
         Write("<p class='source file'>Source File: <strong>");
         Write(source.SystemFileName);
         Write("</strong></p>");
     }
 }
Пример #2
0
        public static SourceModel LoadSourcePiece(string fileName, int lineNumber,
                                                  int additionalLineCount = 7,
                                                  int errorColumn         = 0,
                                                  int errorLength         = 0)
        {
            var result = new SourceModel();

            result.FileName    = fileName;
            result.LineNumber  = lineNumber;
            result.ErrorColumn = errorColumn;
            result.ErrorLength = errorLength;
            if (fileName != null)
            {
                try
                {
                    var lines = File.ReadAllLines(fileName);
                    if (lineNumber >= 0)
                    {
                        result.CurrentLine = lines[Math.Max(0, lineNumber - 1)];
                        result.PreLines    = lines.Skip(lineNumber - additionalLineCount).TakeWhile(l => l != result.CurrentLine).ToArray();
                    }
                    else
                    {
                        additionalLineCount = 30;
                    }
                    result.PostLines = lines.Skip(lineNumber).Take(additionalLineCount).ToArray();
                    return(result);
                }
                catch
                {
                    result.LoadFailed = true;
                }
            }
            return(result);
        }
Пример #3
0
        public void WriteSourceCode(SourceModel source, bool collapse = true)
        {
        #line default
        #line hidden

        #line 192 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t<div class=\"source code\">\r\n\t\t\t<label>\r\n\t\t\t\t");


        #line default
        #line hidden

        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (collapse)
            {
        #line default
        #line hidden

        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
                this.Write(" <input type=\"checkbox\" class=\"collapse\" /> ");


        #line default
        #line hidden

        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            }

        #line default
        #line hidden

        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t<div class=\"source-prelines collapse-on\">\r\n\t\t\t\t\t");


        #line default
        #line hidden

        #line 197 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (source.PreLines != null)
            {
                WriteSourceLines(source.LineNumber - source.PreLines.Length, source.PreLines);
            }

        #line default
        #line hidden

        #line 197 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t</div>\r\n\t\t\t\t<div class=\"source-errorLine\">\r\n\t\t\t\t\t");


        #line default
        #line hidden

        #line 200 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (source.CurrentLine != null)
            {
                WriteErrorLine(source.LineNumber, source.CurrentLine, source.ErrorColumn, source.ErrorLength);
            }

        #line default
        #line hidden

        #line 200 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t</div>\r\n\t\t\t\t<div class=\"source-postlines collapse-on\">\r\n\t\t\t\t\t");


        #line default
        #line hidden

        #line 203 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (source.PostLines != null)
            {
                WriteSourceLines(source.LineNumber + 1, source.PostLines);
            }

        #line default
        #line hidden

        #line 203 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t</div>\r\n\t\t\t</label>\r\n\t\t</div>\r\n\t\t");


        #line default
        #line hidden

        #line 207 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (!string.IsNullOrEmpty(source.FileName))
            {
        #line default
        #line hidden

        #line 207 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
                this.Write("\t\t<p class=\"source file\">Source File: <strong>");


        #line default
        #line hidden

        #line 208 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
                Write(source.SystemFileName);

        #line default
        #line hidden

        #line 208 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
                this.Write("</strong></p>\r\n\t\t");


        #line default
        #line hidden

        #line 209 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            }

        #line default
        #line hidden

        #line 209 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t");


        #line default
        #line hidden

        #line 210 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
        }
Пример #4
0
        public void WriteSourceCode(SourceModel source, bool collapse = true)
        {
        #line default
        #line hidden

        #line 170 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t<div class=\"source code\">\r\n\t\t\t<label>\r\n\t\t\t\t");


        #line default
        #line hidden

        #line 173 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (collapse)
            {
        #line default
        #line hidden

        #line 173 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
                this.Write(" <input type=\"checkbox\" class=\"collapse\" /> ");


        #line default
        #line hidden

        #line 173 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            }

        #line default
        #line hidden

        #line 173 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t<div class=\"source-prelines collapse-on\">\r\n\t\t\t\t\t");


        #line default
        #line hidden

        #line 175 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (source.PreLines != null)
            {
                WriteSourceLines(source.LineNumber - source.PreLines.Length, source.PreLines);
            }

        #line default
        #line hidden

        #line 175 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t</div>\r\n\t\t\t\t<div class=\"source-errorLine\">\r\n\t\t\t\t\t");


        #line default
        #line hidden

        #line 178 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (source.CurrentLine != null)
            {
                WriteErrorLine(source.LineNumber, source.CurrentLine, source.ErrorColumn, source.ErrorLength);
            }

        #line default
        #line hidden

        #line 178 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t</div>\r\n\t\t\t\t<div class=\"source-postlines collapse-on\">\r\n\t\t\t\t\t");


        #line default
        #line hidden

        #line 181 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            if (source.PostLines != null)
            {
                WriteSourceLines(source.LineNumber + 1, source.PostLines);
            }

        #line default
        #line hidden

        #line 181 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
            this.Write("\t\t\t\t</div>\r\n\t\t\t</label>\r\n\t\t</div>\r\n\t");


        #line default
        #line hidden

        #line 185 "C:\git\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
        }
Пример #5
0
	public void WriteSourceCode(SourceModel source, bool collapse = true)
	{
        
        #line default
        #line hidden
        
        #line 192 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("\t\t<div class=\"source code\">\r\n\t\t\t<label>\r\n\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
if(collapse){
        
        #line default
        #line hidden
        
        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write(" <input type=\"checkbox\" class=\"collapse\" /> ");

        
        #line default
        #line hidden
        
        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
}
        
        #line default
        #line hidden
        
        #line 195 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("\t\t\t\t<div class=\"source-prelines collapse-on\">\r\n\t\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 197 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
 if(source.PreLines != null) WriteSourceLines(source.LineNumber - source.PreLines.Length, source.PreLines); 
        
        #line default
        #line hidden
        
        #line 197 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("\t\t\t\t</div>\r\n\t\t\t\t<div class=\"source-errorLine\">\r\n\t\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 200 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
 if(source.CurrentLine != null) WriteErrorLine(source.LineNumber, source.CurrentLine, source.ErrorColumn, source.ErrorLength);
        
        #line default
        #line hidden
        
        #line 200 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("\t\t\t\t</div>\r\n\t\t\t\t<div class=\"source-postlines collapse-on\">\r\n\t\t\t\t\t");

        
        #line default
        #line hidden
        
        #line 203 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
 if(source.PostLines != null) WriteSourceLines(source.LineNumber + 1, source.PostLines);
        
        #line default
        #line hidden
        
        #line 203 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("\t\t\t\t</div>\r\n\t\t\t</label>\r\n\t\t</div>\r\n\t\t");

        
        #line default
        #line hidden
        
        #line 207 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
 if (!string.IsNullOrEmpty(source.FileName)) { 
        
        #line default
        #line hidden
        
        #line 207 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("\t\t<p class=\"source file\">Source File: <strong>");

        
        #line default
        #line hidden
        
        #line 208 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
 Write(source.SystemFileName); 
        
        #line default
        #line hidden
        
        #line 208 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("</strong></p>\r\n\t\t");

        
        #line default
        #line hidden
        
        #line 209 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
 } 
        
        #line default
        #line hidden
        
        #line 209 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
this.Write("\t");

        
        #line default
        #line hidden
        
        #line 210 "C:\Users\exyi\Source\Repos\dotvvm\src\DotVVM.Framework\Hosting\ErrorPages\ErrorPageTemplate.tt"
}