Ejemplo n.º 1
0
        private static RouteData CreateRouteData(RouteBase route, RouteValueDictionary routeValues, RouteValueDictionary dataTokens, ViewContext parentViewContext)
        {
            RouteData routeData = new RouteData();

            foreach (KeyValuePair <string, object> kvp in routeValues)
            {
                routeData.Values.Add(kvp.Key, kvp.Value);
            }

            foreach (KeyValuePair <string, object> kvp in dataTokens)
            {
                routeData.DataTokens.Add(kvp.Key, kvp.Value);
            }

            routeData.Route = route;
            routeData.DataTokens[ControllerContext.ParentActionViewContextToken] = parentViewContext;

            // It's possible that the outgoing route is a direct route - in which case it's not possible to reach using
            // the action name and controller name. We need to check for that case to determine if we need to create a
            // 'direct route' routedata to reach it.
            if (route.IsDirectRoute())
            {
                return(RouteCollectionRoute.CreateDirectRouteMatch(route, new List <RouteData>()
                {
                    routeData
                }));
            }
            else
            {
                return(routeData);
            }
        }
Ejemplo n.º 2
0
        /// <summary>Calculates a route base for a given origin and destination.</summary>
        /// <param name="originPoint">The origin point.</param>
        /// <param name="destinationPoint">The destination point.</param>
        /// <returns>The route base.</returns>
        private async Task <RouteBase> CalculateRouteBaseAsync(string originPoint, string destinationPoint)
        {
            // Error if origin and destination are the same point
            PointsValidation.ValidateEqualPointsAsync(originPoint, destinationPoint);

            // Error if point description does not exist
            var origin = await PointsValidation.ValidatePointExistsAsync(_pointRepository, originPoint);

            var destination = await PointsValidation.ValidatePointExistsAsync(_pointRepository, destinationPoint);

            var routeBase = new RouteBase
            {
                Origin      = origin,
                Destination = destination
            };

            // Error if route base with such points does not exist
            await ValidateRouteBaseExistsAsync(routeBase);

            // Error if there is not any step to begin the route, or if there is not any step to finish the route
            await ValidateStepStartExistsAsync(origin);
            await ValidateStepEndExistsAsync(destination);

            return(routeBase);
        }
Ejemplo n.º 3
0
        public void RegisterController_DesignerController_NotRegistersAnyRoutes()
        {
            // Arrange
            var  initializer = new DummyControllerContainerInitializer();
            Type controller  = typeof(DesignerController);

            using (new ObjectFactoryContainerRegion())
            {
                ObjectFactory.Container.RegisterType <ConfigManager, ConfigManager>(typeof(XmlConfigProvider).Name.ToUpperInvariant(), new InjectionConstructor(typeof(XmlConfigProvider).Name));

                ObjectFactory.Container.RegisterType <XmlConfigProvider, DummyConfigProvider>();

                // Act
                initializer.RegisterControllerPublic(controller);
            }

            // Assert
            ControllerInfo registration = ControllerStore.Controllers().SingleOrDefault(c => c.ControllerType == controller);

            Assert.IsNotNull(registration, "DesignerController was not registered.");

            RouteBase route = RouteTable.Routes[controller.Name];

            Assert.IsNull(route, "Route was registered for the controller.");
        }
Ejemplo n.º 4
0
        private string GetPath(RouteBase route, string viewName, string[] formats, bool useCache, out string[] strArray)
        {
            strArray = null;

            List <string> pathes = new List <string>();
            string        virtualPath;

            foreach (string format in formats)
            {
                string path = SiteManager.Current.GetUrlByRoute(route);
                virtualPath = string.Format(format
                                            , viewName
                                            , viewName.StartsWith("/") ? string.Empty : path
                                            , SiteManager.Current.DistinctName
                                            ).Replace("//", "/");
                pathes.Add(virtualPath);
                if (base.VirtualPathProvider.FileExists(virtualPath))
                {
                    return(virtualPath);
                }
            }

            strArray = pathes.ToArray();
            return(null);
        }
Ejemplo n.º 5
0
        public async Task Get_PredefinedRouteBase_ReturnsOneRouteBase(string pointOrigin, string pointDestination)
        {
            try
            {
                var routeBaseFilter = new RouteBase
                {
                    Origin = new Point
                    {
                        Description = pointOrigin
                    },
                    Destination = new Point
                    {
                        Description = pointDestination
                    }
                };

                var collectList = await _routeBaseService.GetAsync(routeBaseFilter);

                var isOne = collectList.Count() == 1;

                Assert.True(isOne);
            }
            catch (AppCustomException)
            {
                Assert.True(false);
            }
        }
 public RedirectRoute(RouteBase sourceRoute, RouteBase targetRoute, bool permanent, Func <RequestContext, RouteValueDictionary> additionalRouteValues)
 {
     SourceRoute = sourceRoute;
     TargetRoute = targetRoute;
     Permanent   = permanent;
     AdditionalRouteValuesFunc = additionalRouteValues;
 }
Ejemplo n.º 7
0
 public RedirectRoute(RouteBase sourceRoute, RouteBase targetRoute, bool permanent, RouteValueDictionary additionalRouteValues)
 {
     SourceRoute           = sourceRoute;
     TargetRoute           = targetRoute;
     Permanent             = permanent;
     AdditionalRouteValues = additionalRouteValues;
 }
Ejemplo n.º 8
0
 /// <summary>Validates if the route base already exists.</summary>
 /// <param name="routeBaseCheck">The route base to check.</param>
 private async Task ValidateRouteBaseAlreadyExistsAsync(RouteBase routeBaseCheck)
 {
     if ((await _routeBaseRepository.GetAsync(routeBaseCheck)).Any())
     {
         throw AppCustomExceptions.RouteBaseAlreadyExists;
     }
 }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Determine current view
            bool isMobile = WebFormsFriendlyUrlResolver.IsMobileView(new HttpContextWrapper(Context));

            CurrentView = isMobile ? "Mobile" : "Desktop";

            // Determine alternate view
            AlternateView = isMobile ? "Desktop" : "Mobile";

            // Create switch URL from the route, e.g. ~/__FriendlyUrls_SwitchView/Mobile?ReturnUrl=/Page
            const string switchViewRouteName = "AspNet.FriendlyUrls.SwitchView";
            RouteBase    switchViewRoute     = RouteTable.Routes[switchViewRouteName];

            if (switchViewRoute == null)
            {
                // Friendly URLs is not enabled or the name of the switch view route is out of sync
                Visible = false;
                return;
            }
            string url = GetRouteUrl(switchViewRouteName, new { view = AlternateView, __FriendlyUrls_SwitchViews = true });

            url      += "?ReturnUrl=" + HttpUtility.UrlEncode(Request.RawUrl);
            SwitchUrl = url;
        }
Ejemplo n.º 10
0
        private Type GetControllerTypeWithinNamespaces(
            RouteBase route,
            string controllerName,
            HashSet <string> namespaces
            )
        {
            // Once the master list of controllers has been created we can quickly index into it
            ControllerTypeCache.EnsureInitialized(BuildManager);

            ICollection <Type> matchingTypes = ControllerTypeCache.GetControllerTypes(
                controllerName,
                namespaces
                );

            switch (matchingTypes.Count)
            {
            case 0:
                // no matching types
                return(null);

            case 1:
                // single matching type
                return(matchingTypes.First());

            default:
                // multiple matching types
                throw CreateAmbiguousControllerException(route, controllerName, matchingTypes);
            }
        }
        internal static InvalidOperationException CreateAmbiguousControllerException(RouteBase route, string controllerName, ICollection <Type> matchingTypes)
        {
            // we need to generate an exception containing all the controller types
            StringBuilder typeList = new StringBuilder();

            foreach (Type matchedType in matchingTypes)
            {
                typeList.AppendLine();
                typeList.Append(matchedType.FullName);
            }

            string errorText;
            Route  castRoute = route as Route;

            if (castRoute != null)
            {
                errorText = String.Format(CultureInfo.CurrentCulture, MvcResources.DefaultControllerFactory_ControllerNameAmbiguous_WithRouteUrl,
                                          controllerName, castRoute.Url, typeList, Environment.NewLine);
            }
            else
            {
                errorText = String.Format(CultureInfo.CurrentCulture, MvcResources.DefaultControllerFactory_ControllerNameAmbiguous_WithoutRouteUrl,
                                          controllerName, typeList, Environment.NewLine);
            }

            return(new InvalidOperationException(errorText));
        }
Ejemplo n.º 12
0
        public async Task UpdateAsync(RouteBase routeBaseUpdate)
        {
            // Error if route base does not exist
            var routeBase = await ValidateRouteBaseExistsAsync(routeBaseUpdate.Id);

            var routeBaseControl = routeBase;

            // Error if origin and destination are the same point
            PointsValidation.ValidateEqualPointsAsync(routeBaseUpdate.Origin?.Description, routeBaseUpdate.Destination?.Description);

            if (!string.IsNullOrWhiteSpace(routeBaseUpdate.Origin?.Description))
            {
                // Error if point description does not exist
                var origin = await PointsValidation.ValidatePointExistsAsync(_pointRepository, routeBaseUpdate.Origin.Description);

                routeBase.Origin = origin;
            }

            if (!string.IsNullOrWhiteSpace(routeBaseUpdate.Destination?.Description))
            {
                // Error if point description does not exist
                var destination = await PointsValidation.ValidatePointExistsAsync(_pointRepository, routeBaseUpdate.Destination.Description);

                routeBase.Destination = destination;
            }

            // Error if route base with such points already exists
            await ValidateRouteBaseAlreadyExistsAsync(routeBase);

            await _routeBaseRepository.UpdateAsync(routeBase);

            RemoveDependentObjectsFromCache(routeBaseControl);
        }
        private static IContentRoute MapCategoryRoute(this RouteCollection routes, string insertAfterRouteName, string name, string url, object defaults, Func<SiteDefinition, ContentReference> contentRootResolver)
        {
            var basePathResolver = ServiceLocator.Current.GetInstance<IBasePathResolver>();
            var urlSegmentRouter = ServiceLocator.Current.GetInstance<IUrlSegmentRouter>();
            var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
            urlSegmentRouter.RootResolver = contentRootResolver;
            Func<RequestContext, RouteValueDictionary, string> resolver = basePathResolver.Resolve;

            var contentRouteParameters = new MapContentRouteParameters
            {
                UrlSegmentRouter = urlSegmentRouter,
                BasePathResolver = resolver,
                Direction = SupportedDirection.Both,
                Constraints = new { node = new ContentTypeConstraint<CategoryData>(contentLoader) }
            };

            RouteBase mediaRoute = RouteTable.Routes[insertAfterRouteName];
            int insertIndex = mediaRoute != null
                ? RouteTable.Routes.IndexOf(mediaRoute) + 1
                : RouteTable.Routes.Count;

            var route = routes.MapContentRoute(name, url, defaults, contentRouteParameters) as DefaultContentRoute;
            routes.Remove(route);
            routes.Insert(insertIndex, route);
            return route;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Check whether the specified route should be exposed in the JavaScript output
        /// </summary>
        /// <param name="routeBase">Route to check</param>
        /// <returns><c>false</c> if the route should definitely be blocked, <c>true</c> if the route should be exposed (or unsure)</returns>
        public bool AllowRoute(RouteBase routeBase)
        {
            var route = routeBase as Route;

            if (route == null)
            {
                return(true);
            }

            // WebForms - Not supported
            if (route.RouteHandler is PageRouteHandler)
            {
                return(false);
            }

            // Ignore routes
            if (route.RouteHandler is StopRoutingHandler)
            {
                return(false);
            }

            // ASP.NET WebAPI (https://github.com/Daniel15/RouteJs/issues/9)
            // Ugly hack so we don't have to reference the WebAPI assembly for now.
            if (route.GetType().FullName == "System.Web.Http.WebHost.Routing.HttpWebRoute")
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 15
0
        RouteModel CreateRouteModelData(String name, RouteBase rr, int index)
        {
            RouteModel rm = CreateModel(rr, index);

            rm.Name = name;
            return(rm);
        }
Ejemplo n.º 16
0
        public void ReturnOneMethod(IProxyFactory proxyFactory, ILogger logger)
        {
            var alternationImplementation = new RouteBase(proxyFactory, logger);

            Assert.Equal(2, alternationImplementation.AllMethodsRouteBase.Count());
            Assert.Equal(3, alternationImplementation.AllMethodsRoute.Count());
        } 
        public static RouteData CreateDirectRouteMatch(RouteBase route, List <RouteData> matches)
        {
            if (matches.Count == 0)
            {
                return(null);
            }
            else
            {
                var routeData = new RouteData();
                routeData.Route        = route;
                routeData.RouteHandler = new MvcRouteHandler();
                routeData.SetDirectRouteMatches(matches);

                // At a few points in the code (MvcRouteHandler, MvcHandler) we need to look up the controller
                // by name. For the purposes of error handling/debugging, it's helpful if we can have a name
                // in this code to pass through.
                //
                // Inside the DefaultControllerFactory we'll double check the route data and throw if we have
                // multiple controller matches, but for now let's just use the controller of the first match.
                ControllerDescriptor controllerDescriptor = matches[0].GetTargetControllerDescriptor();
                if (controllerDescriptor != null)
                {
                    routeData.Values[RouteDataTokenKeys.Controller] = controllerDescriptor.ControllerName;
                }

                return(routeData);
            }
        }
Ejemplo n.º 18
0
        public async Task <RouteBase> CreateAsync(RouteBase routeBase)
        {
            // Error if origin and destination are the same point
            PointsValidation.ValidateEqualPointsAsync(routeBase.Origin?.Description, routeBase.Destination?.Description);

            // Error if point description does not exist
            var origin = await PointsValidation.ValidatePointExistsAsync(_pointRepository, routeBase.Origin?.Description);

            var destination = await PointsValidation.ValidatePointExistsAsync(_pointRepository, routeBase.Destination?.Description);

            var routeBaseToAdd = new RouteBase
            {
                Origin      = origin,
                Destination = destination
            };

            // Error if route base with such points already exists
            await ValidateRouteBaseAlreadyExistsAsync(routeBaseToAdd);

            await _routeBaseRepository.AddAsync(routeBaseToAdd);

            var routeBases = await _routeBaseRepository.GetAsync();

            var routeReturn = routeBases.FirstOrDefault(x =>
                                                        (x.Origin?.Description?.Equals(routeBaseToAdd.Origin.Description) == true || x.OriginId == routeBaseToAdd.OriginId) &&
                                                        (x.Destination?.Description?.Equals(routeBaseToAdd.Destination.Description) == true || x.DestinationId == routeBaseToAdd.DestinationId));

            return(routeReturn);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Creates the ambiguous controller exception.
        /// </summary>
        /// <param name="route">The route.</param>
        /// <param name="controllerName">Name of the controller.</param>
        /// <param name="matchingTypes">The matching types.</param>
        /// <returns></returns>
        internal static InvalidOperationException CreateAmbiguousControllerException(RouteBase route, string controllerName, ICollection <Type> matchingTypes)
        {
            StringBuilder stringBuilder = new StringBuilder();

            foreach (Type current in matchingTypes)
            {
                stringBuilder.AppendLine();
                stringBuilder.Append(current.FullName);
            }
            Route  route2 = route as Route;
            string message;

            if (route2 != null)
            {
                message = string.Format(CultureInfo.CurrentUICulture,
                                        "The request for '{0}' has found the following matching controllers:{2}\r\n\r\nMultiple types were found that match the controller named '{0}'. This can happen if the route that services this request does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.",
                                        new object[]
                {
                    controllerName,
                    route2.Url,
                    stringBuilder
                });
            }
            else
            {
                message = string.Format(CultureInfo.CurrentUICulture,
                                        "The request for '{0}' has found the following matching controllers:{2}\r\n\r\nMultiple types were found that match the controller named '{0}'.",
                                        new object[]
                {
                    controllerName,
                    stringBuilder
                });
            }
            return(new InvalidOperationException(message));
        }
Ejemplo n.º 20
0
        public void ReturnOneMethod(IProxyFactory proxyFactory, ILogger logger)
        {
            var alternationImplementation = new RouteBase(proxyFactory, logger);

            Assert.Equal(2, alternationImplementation.AllMethodsRouteBase.Count());
            Assert.Equal(3, alternationImplementation.AllMethodsRoute.Count());
        }
Ejemplo n.º 21
0
 public LocalResourceUrlManager(DotvvmConfiguration configuration, IResourceHashService hasher)
 {
     this.resourceRoute        = new DotvvmRoute("dotvvmResource/{hash}/{name:regex(.*)}", null, null, null, configuration);
     this.hasher               = hasher;
     this.resources            = configuration.Resources;
     this.alternateDirectories = configuration.Debug ? new ConcurrentDictionary <string, string>() : null;
     this.suppressVersionHash  = configuration.Debug;
 }
Ejemplo n.º 22
0
        public static void MapRoute(string routeName, RouteBase route)
        {
            // note_ route name can be null or empty
            Guard.ArgumentNotNull(route, "route");

            // and we add
            RouteTable.Routes.Add(routeName, route);
        }
 protected override void InsertItem(Int32 index, RouteBase item)
 {
     if (EnableRestrictions)
     {
         throw new Exception("Unexpected route added".);
     }
     base.InsertItem(index, item);
 }
 protected override void SetItem(Int32 index, RouteBase item)
 {
     if (EnableRestrictions)
     {
         throw new Exception("Unexpected change of RouteCollection item.");
     }
     base.SetItem(index, item);
 }
Ejemplo n.º 25
0
 protected virtual string GetAreaName(RouteBase route)
 {
     if (route is Route route2 && route2.DataTokens != null)
     {
         return(route2.DataTokens["area"] as string);
     }
     return(null);
 }
Ejemplo n.º 26
0
        internal static Route ShouldBeRoute(this RouteBase subject, Route expected)
        {
            subject.Should().NotBeNull().And.BeAssignableTo <Route>();
            var route = subject as Route;

            route.ShouldBeEquivalentTo(expected, o => o.Excluding(r => r.RouteHandler));
            return(route);
        }
Ejemplo n.º 27
0
        protected internal virtual Type GetControllerType(RequestContext requestContext, string controllerName)
        {
            if (requestContext == null)
            {
                throw new ArgumentNullException("requestContext");
            }

            if (String.IsNullOrEmpty(controllerName) &&
                (requestContext.RouteData == null || !requestContext.RouteData.HasDirectRouteMatch()))
            {
                throw new ArgumentException(MvcResources.Common_NullOrEmpty, "controllerName");
            }

            RouteData routeData = requestContext.RouteData;

            if (routeData != null && routeData.HasDirectRouteMatch())
            {
                return(GetControllerTypeFromDirectRoute(routeData));
            }

            // first search in the current route's namespace collection
            object routeNamespacesObj;
            Type   match;

            if (routeData != null && routeData.DataTokens.TryGetValue(RouteDataTokenKeys.Namespaces, out routeNamespacesObj))
            {
                IEnumerable <string> routeNamespaces = routeNamespacesObj as IEnumerable <string>;
                if (routeNamespaces != null && routeNamespaces.Any())
                {
                    HashSet <string> namespaceHash = new HashSet <string>(routeNamespaces, StringComparer.OrdinalIgnoreCase);
                    match = GetControllerTypeWithinNamespaces(routeData.Route, controllerName, namespaceHash);

                    // the UseNamespaceFallback key might not exist, in which case its value is implicitly "true"
                    if (match != null || false.Equals(routeData.DataTokens[RouteDataTokenKeys.UseNamespaceFallback]))
                    {
                        // got a match or the route requested we stop looking
                        return(match);
                    }
                }
            }

            // then search in the application's default namespace collection
            RouteBase route = routeData == null ? null : routeData.Route;

            if (ControllerBuilder.DefaultNamespaces.Count > 0)
            {
                HashSet <string> namespaceDefaults = new HashSet <string>(ControllerBuilder.DefaultNamespaces, StringComparer.OrdinalIgnoreCase);
                match = GetControllerTypeWithinNamespaces(route, controllerName, namespaceDefaults);
                if (match != null)
                {
                    return(match);
                }
            }

            // if all else fails, search every namespace
            return(GetControllerTypeWithinNamespaces(route, controllerName, null /* namespaces */));
        }
Ejemplo n.º 28
0
 private string GetRouteExistingFiles(RouteBase routeBase)
 {
     try
     {
         return(routeBase.GetType().InvokeMember("_routeExistingFiles", System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, routeBase, null) as string);
     }
     catch { }
     return(String.Empty);
 }
Ejemplo n.º 29
0
        public virtual RouteBase GetFullPageRoute(RouteBase ampRoute)
        {
            if (!RouteMap.TryGetValue(ampRoute, out var fullPageRoute))
            {
                throw new ArgumentException($"Could not find full version of {ampRoute}.");
            }

            return(fullPageRoute);
        }
Ejemplo n.º 30
0
        public void ProcessRequest(HttpContext context)
        {
            Logger.Debug("DebugHttpHandler.ProcessRequest");

            string               format    = "<html>\r\n<head>\r\n    <title>Route Tester</title>\r\n    <style>\r\n        body, td, th {{font-family: verdana; font-size: small;}}\r\n        .message {{font-size: .9em;}}\r\n        caption {{font-weight: bold;}}\r\n        tr.header {{background-color: #ffc;}}\r\n        label {{font-weight: bold; font-size: 1.1em;}}\r\n        .false {{color: #c00;}}\r\n        .true {{color: #0c0;}}\r\n    </style>\r\n</head>\r\n<body>\r\n<h1>Route Tester</h1>\r\n<div id=\"main\">\r\n    <p class=\"message\">\r\n        Type in a url in the address bar to see which defined routes match it. \r\n        A {{*catchall}} route is added to the list of routes automatically in \r\n        case none of your routes match.\r\n    </p>\r\n    <p><label>Route</label>: {1}</p>\r\n    <div style=\"float: left;\">\r\n        <table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"300\">\r\n            <caption>Route Data</caption>\r\n            <tr class=\"header\"><th>Key</th><th>Value</th></tr>\r\n            {0}\r\n        </table>\r\n    </div>\r\n    <div style=\"float: left; margin-left: 10px;\">\r\n        <table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"300\">\r\n            <caption>Data Tokens</caption>\r\n            <tr class=\"header\"><th>Key</th><th>Value</th></tr>\r\n            {4}\r\n        </table>\r\n    </div>\r\n    <hr style=\"clear: both;\" />\r\n    <table border=\"1\" cellpadding=\"3\" cellspacing=\"0\">\r\n        <caption>All Routes</caption>\r\n        <tr class=\"header\">\r\n            <th>Matches Current Request</th>\r\n            <th>Url</th>\r\n            <th>Defaults</th>\r\n            <th>Constraints</th>\r\n            <th>DataTokens</th>\r\n        </tr>\r\n        {2}\r\n    </table>\r\n    <hr />\r\n    <strong>AppRelativeCurrentExecutionFilePath</strong>: {3}\r\n</div>\r\n</body>\r\n</html>";
            string               str2      = string.Empty;
            RouteData            routeData = this.RequestContext.RouteData;
            RouteValueDictionary values    = routeData.Values;
            RouteBase            base2     = routeData.Route;
            string               str3      = string.Empty;

            using (RouteTable.Routes.GetReadLock())
            {
                foreach (RouteBase base3 in RouteTable.Routes)
                {
                    bool   flag  = base3.GetRouteData(this.RequestContext.HttpContext) != null;
                    string str4  = string.Format("<span class=\"{0}\">{0}</span>", flag);
                    string url   = "n/a";
                    string str6  = "n/a";
                    string str7  = "n/a";
                    string str8  = "n/a";
                    Route  route = base3 as Route;
                    if (route != null)
                    {
                        url  = route.Url;
                        str6 = FormatRouteValueDictionary(route.Defaults);
                        str7 = FormatRouteValueDictionary(route.Constraints);
                        str8 = FormatRouteValueDictionary(route.DataTokens);
                    }
                    str3 = str3 + string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{3}</td></tr>", new object[] { str4, url, str6, str7, str8 });
                }
            }
            string str9  = "n/a";
            string str10 = "";

            if (base2 is DebugRoute)
            {
                str9 = "<strong class=\"false\">NO MATCH!</strong>";
            }
            else
            {
                foreach (string str11 in values.Keys)
                {
                    str2 = str2 + string.Format("\t<tr><td>{0}</td><td>{1}&nbsp;</td></tr>", str11, values[str11]);
                }
                foreach (string str11 in routeData.DataTokens.Keys)
                {
                    str10 = str10 + string.Format("\t<tr><td>{0}</td><td>{1}&nbsp;</td></tr>", str11, routeData.DataTokens[str11]);
                }
                Route route2 = base2 as Route;
                if (route2 != null)
                {
                    str9 = route2.Url;
                }
            }
            context.Response.Write(string.Format(format, new object[] { str2, str9, str3, context.Request.AppRelativeCurrentExecutionFilePath, str10 }));
        }
Ejemplo n.º 31
0
        protected virtual string GetAreaName(RouteBase route)
        {
            string item;

            if (!(route is IRouteWithArea routeWithArea))
            {
                if (!(route is Route route1) || route1.DataTokens == null)
                {
                    item = null;
                }
Ejemplo n.º 32
0
        private void UpdateRoute(RouteBase.GetRouteData.Message message, ITabSetupContext context)
        {
            var model = GetModel(context.GetTabStore());

            // string.Empty is a valid routeName
            if (message.IsMatch && model.MatchedRouteName == null)
            {
                // only update the first matched route
                model.MatchedRouteName = message.RouteName;
            }
        }