<commit_before>using System.Collections.Generic;
using System.Linq;
using Glimpse.AspNet.AlternateType;
using Glimpse.AspNet.Extensibility;
using Glimpse.AspNet.Model;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Extensions;
using Glimpse.Core.Tab.Assist;
using MvcRoute = System.Web.Routing.Route;
using MvcRouteBase = System.Web.Routing.RouteBase;
using MvcRouteValueDictionary = System.Web.Routing.RouteValueDictionary;

namespace Glimpse.AspNet.Tab
{
    public class Routes : AspNetTab, IDocumentation, ITabSetup, ITabLayout, IKey
    {
        private static readonly object Layout = TabLayout.Create()
                .Row(r =>
                {
                    r.Cell(0).WidthInPixels(100);
                    r.Cell(1).AsKey();
                    r.Cell(2);
                    r.Cell(3).WidthInPercent(20).SetLayout(TabLayout.Create().Row(x => 
                        {
                            x.Cell("{{0}} ({{1}})").WidthInPercent(45); 
                            x.Cell(2);
                        }));
                    r.Cell(4).WidthInPercent(35).SetLayout(TabLayout.Create().Row(x =>
                        {
                            x.Cell(0).WidthInPercent(30);
                            x.Cell(1);
                            x.Cell(2).WidthInPercent(30);
                        }));
                    r.Cell(5).WidthInPercent(15).SetLayout(TabLayout.Create().Row(x =>
                        {
                            x.Cell(0).WidthInPercent(45);
                            x.Cell(1).WidthInPercent(55); 
                        }));
                    r.Cell(6).WidthInPixels(100).Suffix(" ms").Class("mono").AlignRight();
                }).Build();

        public override string Name
        {
            get { return "Routes"; }
        }

        public string Key
        {
            get { return "glimpse_routes"; }
        }

        public string DocumentationUri
        {
            get { return "http://getGlimpse.com/Help/Routes-Tab"; }
        }

        public object GetLayout()
        {
            return Layout;
        }

        public void Setup(ITabSetupContext context)
        {
            context.PersistMessages<RouteBase.ProcessConstraint.Message>();
            context.PersistMessages<RouteBase.GetRouteData.Message>();
        }

        public override object GetData(ITabContext context)
        {
            var routeMessages = ProcessMessages(context.GetMessages<RouteBase.GetRouteData.Message>());
            var constraintMessages = ProcessMessages(context.GetMessages<RouteBase.ProcessConstraint.Message>());

             var result = new List<RouteModel>();

            using (System.Web.Routing.RouteTable.Routes.GetReadLock())
            {
                foreach (var routeBase in System.Web.Routing.RouteTable.Routes)
                {
                    var routeModel = GetRouteModelForRoute(context, routeBase, routeMessages, constraintMessages);

                    result.Add(routeModel);
                }
            }

            return result;
        }

        private static TSource SafeFirstOrDefault<TSource>(IEnumerable<TSource> source)
        {
            if (source == null)
            {
                return default(TSource);
            }

            return source.FirstOrDefault();
        }

        private Dictionary<int, List<RouteBase.GetRouteData.Message>> ProcessMessages(IEnumerable<RouteBase.GetRouteData.Message> messages)
        { 
            if (messages == null)
            {
                return new Dictionary<int, List<RouteBase.GetRouteData.Message>>();
            }
<commit_msg>AspNet Route Tab should ignore non AspNet Routes<commit_after>using System.Collections.Generic;
using System.Linq;
using Glimpse.AspNet.AlternateType;
using Glimpse.AspNet.Extensibility;
using Glimpse.AspNet.Model;
using Glimpse.Core.Extensibility;
using Glimpse.Core.Extensions;
using Glimpse.Core.Tab.Assist;
using MvcRoute = System.Web.Routing.Route;
using MvcRouteBase = System.Web.Routing.RouteBase;
using MvcRouteValueDictionary = System.Web.Routing.RouteValueDictionary;

namespace Glimpse.AspNet.Tab
{
    public class Routes : AspNetTab, IDocumentation, ITabSetup, ITabLayout, IKey
    {
        private static readonly object Layout = TabLayout.Create()
                .Row(r =>
                {
                    r.Cell(0).WidthInPixels(100);
                    r.Cell(1).AsKey();
                    r.Cell(2);
                    r.Cell(3).WidthInPercent(20).SetLayout(TabLayout.Create().Row(x => 
                        {
                            x.Cell("{{0}} ({{1}})").WidthInPercent(45); 
                            x.Cell(2);
                        }));
                    r.Cell(4).WidthInPercent(35).SetLayout(TabLayout.Create().Row(x =>
                        {
                            x.Cell(0).WidthInPercent(30);
                            x.Cell(1);
                            x.Cell(2).WidthInPercent(30);
                        }));
                    r.Cell(5).WidthInPercent(15).SetLayout(TabLayout.Create().Row(x =>
                        {
                            x.Cell(0).WidthInPercent(45);
                            x.Cell(1).WidthInPercent(55); 
                        }));
                    r.Cell(6).WidthInPixels(100).Suffix(" ms").Class("mono").AlignRight();
                }).Build();

        public override string Name
        {
            get { return "Routes"; }
        }

        public string Key
        {
            get { return "glimpse_routes"; }
        }

        public string DocumentationUri
        {
            get { return "http://getGlimpse.com/Help/Routes-Tab"; }
        }

        public object GetLayout()
        {
            return Layout;
        }

        public void Setup(ITabSetupContext context)
        {
            context.PersistMessages<RouteBase.ProcessConstraint.Message>();
            context.PersistMessages<RouteBase.GetRouteData.Message>();
        }

        public override object GetData(ITabContext context)
        {
            var routeMessages = ProcessMessages(context.GetMessages<RouteBase.GetRouteData.Message>());
            var constraintMessages = ProcessMessages(context.GetMessages<RouteBase.ProcessConstraint.Message>());

             var result = new List<RouteModel>();

            using (System.Web.Routing.RouteTable.Routes.GetReadLock())
            {
                foreach (var routeBase in System.Web.Routing.RouteTable.Routes)
                {
                	if ((typeof(System.Web.Routing.RouteBase)).IsAssignableFrom(routeBase.GetType()))
                    {
	                    var routeModel = GetRouteModelForRoute(context, routeBase, routeMessages, constraintMessages);

	                    result.Add(routeModel);
                    }
                }
            }

            return result;
        }

        private static TSource SafeFirstOrDefault<TSource>(IEnumerable<TSource> source)
        {
            if (source == null)
            {
                return default(TSource);
            }

            return source.FirstOrDefault();
        }

        private Dictionary<int, List<RouteBase.GetRouteData.Message>> ProcessMessages(IEnumerable<RouteBase.GetRouteData.Message> messages)
        { 
            if (messages == null)
            {
                return new Dictionary<int, List<RouteBase.GetRouteData.Message>>();
            }

{'fraction_non_alphanumeric': 0.10559421841541757, 'fraction_numerical': 0.009903640256959315, 'mean_word_length': 1.5876038781163435, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6595157', 'n_tokens_mistral': 1978, 'n_tokens_neox': 1914, 'n_words': 297}