Example #1
0
            private static int Compare(SccStamp lhs, SccStamp rhs)
            {
                Debug.Assert(lhs != null);
                Debug.Assert(rhs != null);

                return(lhs.Revision.CompareTo(rhs.Revision));
            }
Example #2
0
            private static int Compare(SccStamp lhs, SccStamp rhs)
            {
                Debug.Assert(lhs != null);
                Debug.Assert(rhs != null);

                return(lhs.LastChanged.CompareTo(rhs.LastChanged));
            }
Example #3
0
            private static int Compare(SccStamp lhs, SccStamp rhs)
            {
                Debug.Assert(lhs != null);
                Debug.Assert(rhs != null);

                return lhs.LastChanged.CompareTo(rhs.LastChanged);
            }
Example #4
0
        /// <summary>
        /// Sorts an array of <see cref="SccStamp"/> objects by their 
        /// revision numbers in ascending or descending order.
        /// </summary>

        public static void SortByLastChanged(SccStamp[] stamps, bool descending)
        {
            IComparer comparer = new LastChangedComparer();
            
            if (descending)
                comparer = new ReverseComparer(comparer);
            
            Array.Sort(stamps, comparer);
        }
Example #5
0
        /// <summary>
        /// Sorts an array of <see cref="SccStamp"/> objects by their 
        /// revision numbers in ascending order.
        /// </summary>

        public static void SortByLastChanged(SccStamp[] stamps)
        {
            SortByLastChanged(stamps, false);
        }
Example #6
0
        /// <summary>
        /// Finds the latest stamp among an array of <see cref="SccStamp"/> 
        /// objects. The latest stamp is the one with the highest revision 
        /// number.
        /// </summary>

        public static SccStamp FindLatest(SccStamp[] stamps)
        {
            if (stamps == null)
                throw new ArgumentNullException("stamps");
            
            if (stamps.Length == 0)
                return null;
            
            stamps = (SccStamp[]) stamps.Clone();
            SortByLastChanged(stamps, /* descending */ true);
            return stamps[0];
        }
Example #7
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            //
            // Emit a script that emit version info and checks for updates.
            //

            writer.WriteLine(@"
                <script type='text/javascript' language='JavaScript'>
                    function onCheckForUpdate(sender) {
                        var script = document.createElement('script');
                        script.type = 'text/javascript';
                        script.language = 'JavaScript';
                        script.src = 'http://elmah.googlecode.com/svn/www/update.js?__=' + (new Date()).getTime();
                        document.getElementsByTagName('head')[0].appendChild(script);
                        return false;
                    }
                    var ELMAH = {
                        info : {
                            version     : '" + GetVersion() + @"',
                            fileVersion : '" + GetFileVersion() + @"',
                            type        : '" + Build.TypeLowercase + @"',
                            status      : '" + Build.Status + @"',
                            framework   : '" + Build.Framework + @"',
                            imageRuntime: '" + Build.ImageRuntimeVersion + @"'
                        }
                    };
                </script>");

            //
            // Title
            //

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "PageTitle");
            writer.RenderBeginTag(HtmlTextWriterTag.H1);
            writer.Write(PageTitle);
            writer.RenderEndTag(); // </h1>
            writer.WriteLine();

            //
            // Speed Bar
            //

            SpeedBar.Render(writer,
                            SpeedBar.Home.Format(BasePageName),
                            SpeedBar.Help,
                            SpeedBar.About.Format(BasePageName));

            //
            // Content...
            //

            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "return onCheckForUpdate(this)");
            writer.AddAttribute(HtmlTextWriterAttribute.Title, "Checks if your ELMAH version is up to date (requires Internet connection)");
            writer.RenderBeginTag(HtmlTextWriterTag.Button);
            writer.Write("Check for Update");
            writer.RenderEndTag(); // </button>
            writer.RenderEndTag(); // </p>

            SccStamp[] stamps = SccStamp.FindAll(typeof(ErrorLog).Assembly);
            SccStamp.SortByRevision(stamps, /* descending */ true);

            writer.RenderBeginTag(HtmlTextWriterTag.P);
            writer.Write("This <strong>{0}</strong> ", Build.TypeLowercase);

            if (stamps.Length > 0)
            {
                writer.Write("(SCC #{0}) ", stamps[0].Revision.ToString("N0"));
            }

            writer.Write("build was compiled from the following sources for CLR {0}:", Build.ImageRuntimeVersion);

            writer.RenderEndTag(); // </p>

            //
            // Stamps...
            //

            writer.RenderBeginTag(HtmlTextWriterTag.Ul);

            foreach (SccStamp stamp in stamps)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Li);
                writer.RenderBeginTag(HtmlTextWriterTag.Code);
                Server.HtmlEncode(stamp.Id, writer);
                writer.RenderEndTag(); // </code>
                writer.RenderEndTag(); // </li>
            }

            writer.RenderEndTag(); // </ul>
        }
Example #8
0
        /// <summary>
        /// Sorts an array of <see cref="SccStamp"/> objects by their 
        /// revision numbers in ascending or descending order.
        /// </summary>
        public static void SortByRevision(SccStamp[] stamps, bool descending)
        {
            Comparison<SccStamp> comparer = (lhs, rhs) => lhs.Revision.CompareTo(rhs.Revision);

            Array.Sort(stamps, descending
                               ? ((lhs, rhs) => -comparer(lhs, rhs))
                               : comparer);
        }
Example #9
0
 /// <summary>
 /// Sorts an array of <see cref="SccStamp"/> objects by their 
 /// revision numbers in ascending order.
 /// </summary>
 public static void SortByRevision(SccStamp[] stamps)
 {
     SortByRevision(stamps, false);
 }
Example #10
0
        /// <summary>
        /// Finds the latest stamp among an array of <see cref="SccStamp"/> 
        /// objects. The latest stamp is the one with the highest revision 
        /// number.
        /// </summary>

        public static SccStamp FindLatest(SccStamp[] stamps)
        {
            if (stamps == null)
                throw new ArgumentNullException("stamps");
            
            if (stamps.Length == 0)
                return null;
            
            stamps = stamps.CloneObject();
            SortByRevision(stamps, /* descending */ true);
            return stamps[0];
        }
Example #11
0
            private static int Compare(SccStamp lhs, SccStamp rhs)
            {
                Debug.Assert(lhs != null);
                Debug.Assert(rhs != null);

                return lhs.Revision.CompareTo(rhs.Revision);
            }
Example #12
0
        /// <summary>
        /// Sorts an array of <see cref="SccStamp"/> objects by their 
        /// revision numbers in ascending or descending order.
        /// </summary>
        public static void SortByRevision(SccStamp[] stamps, bool descending)
        {
            IComparer comparer = new RevisionComparer();

            if (descending)
                comparer = new ReverseComparer(comparer);

            Array.Sort(stamps, comparer);
        }
Example #13
0
        public override void Execute()
        {
            WriteLiteral("\r\n");



            #line 6 "..\..\AboutPage.cshtml"

            var basePageName = Request.ServerVariables["URL"];

            const string title = "About ELMAH";
            Layout = new Elmah.MasterPage
            {
                Context       = Context, /* TODO Consider not requiring this */
                Title         = title,
                SpeedBarItems = new[]
                {
                    SpeedBar.Home.Format(basePageName),
                    SpeedBar.Help,
                    SpeedBar.About.Format(basePageName),
                },
            };

            var stamps = SccStamp.FindAll(typeof(ErrorLog).Assembly)
                         .OrderByDescending(s => s.Revision)
                         .ToArray();



            #line default
            #line hidden


            WriteLiteral(@"

<script type='text/javascript' language='JavaScript'>
    function onCheckForUpdate(sender) {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.language = 'JavaScript';
        script.src = 'https://elmah.github.io/update.js?__=' + (new Date()).getTime();
        document.getElementsByTagName('head')[0].appendChild(script);
        return false;
    }
    var ELMAH = {
        info: {
            version: '");



            #line 41 "..\..\AboutPage.cshtml"
            Write(GetVersion());


            #line default
            #line hidden
            WriteLiteral("\',\r\n            fileVersion: \'");



            #line 42 "..\..\AboutPage.cshtml"
            Write(GetFileVersion());


            #line default
            #line hidden
            WriteLiteral("\',\r\n            type: \'");



            #line 43 "..\..\AboutPage.cshtml"
            Write(Build.TypeLowercase);


            #line default
            #line hidden
            WriteLiteral("\',\r\n            status: \'");



            #line 44 "..\..\AboutPage.cshtml"
            Write(Build.Status);


            #line default
            #line hidden
            WriteLiteral("\',\r\n            framework: \'");



            #line 45 "..\..\AboutPage.cshtml"
            Write(Build.Framework);


            #line default
            #line hidden
            WriteLiteral("\',\r\n            imageRuntime: \'");



            #line 46 "..\..\AboutPage.cshtml"
            Write(Build.ImageRuntimeVersion);


            #line default
            #line hidden
            WriteLiteral("\'\r\n        }\r\n    };\r\n</script>\r\n\r\n<h1 id=\"PageTitle\">");



            #line 51 "..\..\AboutPage.cshtml"
            Write(title);


            #line default
            #line hidden
            WriteLiteral("</h1>\r\n\r\n<p>\r\n    <button class=\"btn\"\r\n        onclick=\"return onCheckForUpdate(t" +
                         "his)\"\r\n        title=\"Checks if your ELMAH version is up to date (requires Inter" +
                         "net connection)\">Check for Update</button>\r\n</p>\r\n\r\n<p>\r\n    This <strong>");



            #line 60 "..\..\AboutPage.cshtml"
            Write(Build.TypeLowercase);


            #line default
            #line hidden
            WriteLiteral("</strong>\r\n    ");



            #line 61 "..\..\AboutPage.cshtml"
            Write(stamps.Any() ? "(SCC #" + stamps.First().Revision.ToString("N0") + ")" : null);


            #line default
            #line hidden
            WriteLiteral("\r\n    build was compiled from the following sources for CLR ");



            #line 62 "..\..\AboutPage.cshtml"
            Write(Build.ImageRuntimeVersion);


            #line default
            #line hidden
            WriteLiteral(":\r\n</p>\r\n\r\n<ul>\r\n");



            #line 66 "..\..\AboutPage.cshtml"
            foreach (var stamp in stamps)
            {
            #line default
            #line hidden
                WriteLiteral("        <li><code>");



            #line 68 "..\..\AboutPage.cshtml"
                Write(stamp.Id);


            #line default
            #line hidden
                WriteLiteral("</code></li>        \r\n");



            #line 69 "..\..\AboutPage.cshtml"
            }


            #line default
            #line hidden
            WriteLiteral("</ul>\r\n");


            WriteLiteral("\r\n");
        }