private PageTemplateDescriptor GetIncorrectlyLoadedPageTemplate(string virtualPath, Exception loadingException) { Guid templateId; string idTokenBegin = "TemplateId = new Guid(\""; string idTokenEnd = "\");"; if (!TemplateParsingHelper.TryExtractTemplateIdFromCSharpCode(PathUtil.Resolve(virtualPath), out templateId, idTokenBegin, idTokenEnd)) { templateId = GetMD5Hash(virtualPath.ToLowerInvariant()); } return(new RazorPageTemplateDescriptor(virtualPath) { Id = templateId, Title = Path.GetFileName(virtualPath), LoadingException = loadingException }); }
private PageTemplateDescriptor GetIncorrectlyLoadedPageTemplate(string filePath, Exception loadingException) { string codeBehindFile = GetCodebehindFilePath(filePath); Guid templateId; string idTokenBegin = "Guid TemplateId { get { return new Guid(\""; string idTokenEnd = "\"); } }"; if (!TemplateParsingHelper.TryExtractTemplateIdFromCSharpCode(codeBehindFile, out templateId, idTokenBegin, idTokenEnd)) { templateId = GetMD5Hash(filePath.ToLowerInvariant()); } return(new MasterPagePageTemplateDescriptor(filePath, codeBehindFile) { Id = templateId, Title = Path.GetFileName(filePath), LoadingException = loadingException }); }