本文整理汇总了C#中System.Web.Hosting.VirtualPathProvider.DirectoryExists方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualPathProvider.DirectoryExists方法的具体用法?C# VirtualPathProvider.DirectoryExists怎么用?C# VirtualPathProvider.DirectoryExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Hosting.VirtualPathProvider
的用法示例。
在下文中一共展示了VirtualPathProvider.DirectoryExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnalyzeViews
public virtual IEnumerable<ContentRegistration> AnalyzeViews(VirtualPathProvider vpp, HttpContextBase httpContext, IEnumerable<ViewTemplateSource> sources)
{
var registrations = new List<ContentRegistration>();
foreach (var source in sources)
{
string virtualDir = Url.ResolveTokens(Url.ThemesUrlToken) + "Default/Views/" + source.ControllerName;
logger.DebugFormat("Analyzing directory {0}", virtualDir);
if (!vpp.DirectoryExists(virtualDir))
{
virtualDir = "~/Views/" + source.ControllerName;
if (!vpp.DirectoryExists(virtualDir))
continue;
}
foreach (var file in vpp.GetDirectory(virtualDir).Files.OfType<VirtualFile>().Where(f => f.Name.EndsWith(source.ViewFileExtension)))
{
logger.DebugFormat("Analyzing file {0}", file.VirtualPath);
var registration = AnalyzeView(httpContext, file, source.ControllerName, source.ModelType);
if (registration != null)
registrations.Add(registration);
}
}
return registrations;
}
示例2: FindRegistrations
public virtual IEnumerable<ViewTemplateDescription> FindRegistrations(VirtualPathProvider vpp, HttpContextBase httpContext, IEnumerable<ViewTemplateSource> sources)
{
foreach (var source in sources)
{
string virtualDir = "~/Views/" + source.ControllerName;
if (!vpp.DirectoryExists(virtualDir))
continue;
List<ViewTemplateDescription> descriptions = new List<ViewTemplateDescription>();
foreach (var file in vpp.GetDirectory(virtualDir).Files.OfType<VirtualFile>().Where(f => f.Name.EndsWith(source.ViewFileExtension)))
{
var description = AnalyzeView(httpContext, file, source.ControllerName, source.ModelType);
if (description != null)
descriptions.Add(description);
}
foreach (var description in descriptions)
{
description.Definition.Add(new TemplateSelectorAttribute
{
Name = "TemplateName",
Title = "Template",
AllTemplates = descriptions.Select(d => new TemplateSelectorAttribute.Info { Name = d.Registration.Template, Title = d.Registration.Title }).ToArray(),
ContainerName = source.TemplateSelectorContainerName,
Required = true,
HelpTitle = "The page must be saved for another template's fields to appear",
RequiredPermission = Security.Permission.Administer
});
}
foreach (var description in descriptions)
yield return description;
}
}
示例3: AnalyzeViews
public virtual IEnumerable<ViewTemplateDescription> AnalyzeViews(VirtualPathProvider vpp, HttpContextBase httpContext, IEnumerable<ViewTemplateSource> sources)
{
foreach (var source in sources)
{
string virtualDir = Url.ResolveTokens(Url.ThemesUrlToken) + "Default/Views/" + source.ControllerName;
if (!vpp.DirectoryExists(virtualDir))
{
virtualDir = "~/Views/" + source.ControllerName;
if (!vpp.DirectoryExists(virtualDir))
continue;
}
List<ViewTemplateDescription> descriptions = new List<ViewTemplateDescription>();
foreach (var file in vpp.GetDirectory(virtualDir).Files.OfType<VirtualFile>().Where(f => f.Name.EndsWith(source.ViewFileExtension)))
{
var description = AnalyzeView(httpContext, file, source.ControllerName, source.ModelType);
if (description != null)
descriptions.Add(description);
}
foreach (var description in descriptions)
yield return description;
}
}