当前位置: 首页>>代码示例>>C#>>正文


C# VirtualPathProvider.DirectoryExists方法代码示例

本文整理汇总了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;
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:27,代码来源:ViewTemplateAnalyzer.cs

示例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;
            }
        }
开发者ID:AnonymousRetard,项目名称:n2cms,代码行数:34,代码来源:ViewTemplateAnalyzer.cs

示例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;
            }
        }
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:24,代码来源:ViewTemplateAnalyzer.cs


注:本文中的System.Web.Hosting.VirtualPathProvider.DirectoryExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。