示例#1
0
 private Route CastRoute(RouteBase routeBase)
 {
     var route = routeBase as Route;
     if (route == null)
     {
         // cheat!
         // TODO: Create an interface for self reporting routes.
         var type = routeBase.GetType();
         var property = type.GetProperty("__DebugRoute", BindingFlags.NonPublic | BindingFlags.Instance);
         if (property != null)
         {
             route = property.GetValue(routeBase, null) as Route;
         }
     }
     return route;
 }
        private string GetRouteExistingFiles(RouteBase routeBase)
        {
            try
            {
                return
                    routeBase.GetType().InvokeMember("_routeExistingFiles", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance, null, routeBase, null) as string;
            }
            catch { }

            return string.Empty;
        }
        RouteModel CreateModel(RouteBase rb, int index)
        {
            var rm = new RouteModel
            {
                Order = index.ToString(),
                Type = rb.GetType().FullName,
                Route = rb,
                RouteExistingFiles = GetRouteExistingFiles(rb)
            };

            return rm;
        }
 private Route CastRoute(RouteBase routeBase)
 {
     var route = routeBase as Route;
     if (route == null)
     {
         // cheat!
         var type = routeBase.GetType();
         var property = type.GetProperty("__DebugRoute", BindingFlags.NonPublic | BindingFlags.Instance);
         if (property != null)
         {
             route = property.GetValue(routeBase, null) as Route;
         }
     }
     return route;
 }