Exemplo n.º 1
0
        internal static bool TryGuessHost(string projectRoot, string projectRelativePath, out GuessedHost host)
        {
            RazorRuntime?runtime = DetermineRazorRuntimeVersion(projectRoot);

            if (runtime.HasValue)
            {
                var mvcHelperRegex = new Regex(@"(^|\\)Views(\\.*)+Helpers?", RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
                if (mvcHelperRegex.IsMatch(projectRelativePath))
                {
                    host = new GuessedHost("MvcHelper", runtime.Value);
                }
                host = new GuessedHost("MvcView", runtime.Value);
                return(true);
            }

            host = default(GuessedHost);
            return(false);
        }
Exemplo n.º 2
0
        internal static bool TryGuessHost(string projectRoot, string projectRelativePath, out GuessedHost host)
        {
            RazorRuntime runtime;
            bool         isMvcProject = IsMvcProject(projectRoot, out runtime) ?? false;

            if (isMvcProject)
            {
                var mvcHelperRegex = new Regex(@"(^|\\)Views(\\.*)+Helpers?", RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
                if (mvcHelperRegex.IsMatch(projectRelativePath))
                {
                    host = new GuessedHost("MvcHelper", runtime);
                }
                host = new GuessedHost("MvcView", runtime);
                return(true);
            }

            host = default(GuessedHost);
            return(false);
        }