System.Web.WebPages.WebPageRoute.MatchDefaultFiles C# (CSharp) Method

MatchDefaultFiles() private static method

private static MatchDefaultFiles ( string pathValue, string supportedExtensions, bool>.Func virtualPathExists, HttpContextBase context, System.Web.WebPages.DisplayModeProvider displayModes, string currentLevel ) : System.Web.WebPages.WebPageMatch
pathValue string
supportedExtensions string
virtualPathExists bool>.Func
context HttpContextBase
displayModes System.Web.WebPages.DisplayModeProvider
currentLevel string
return System.Web.WebPages.WebPageMatch
        private static WebPageMatch MatchDefaultFiles(string pathValue, string[] supportedExtensions, Func<string, bool> virtualPathExists, HttpContextBase context, DisplayModeProvider displayModes, string currentLevel)
        {
            // If we haven't found anything yet, now try looking for default.* or index.* at the current url
            currentLevel = pathValue;
            string currentLevelIndex;
            if (String.IsNullOrEmpty(currentLevel))
            {
                currentLevelIndex = "index";
            }
            else
            {
                if (currentLevel[currentLevel.Length - 1] != '/')
                {
                    currentLevel += "/";
                }
                currentLevelIndex = currentLevel + "index";
            }

            // Does the current route level match any supported extension?
            string indexMatch = GetRouteLevelMatch(currentLevelIndex, supportedExtensions, virtualPathExists, context, displayModes);
            if (indexMatch != null)
            {
                return new WebPageMatch(indexMatch, String.Empty);
            }

            return null;
        }
    }