本文整理汇总了C#中System.Web.VirtualPath.DirectoryExists方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualPath.DirectoryExists方法的具体用法?C# VirtualPath.DirectoryExists怎么用?C# VirtualPath.DirectoryExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.VirtualPath
的用法示例。
在下文中一共展示了VirtualPath.DirectoryExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetGeneratedSourceFile
internal string GetGeneratedSourceFile(VirtualPath virtualPath) {
// Add a pending call to make sure our thread doesn't get killed
AddPendingCall();
Type codeDomProviderType;
CompilerParameters compilerParameters;
string generatedFilesDir;
try {
if (!virtualPath.DirectoryExists()) {
throw new ArgumentException(SR.GetString(SR.GetGeneratedSourceFile_Directory_Only,
virtualPath.VirtualPathString), "virtualPath");
}
// Calls GetCodeDirectoryInformation to ensure the source files are created for the
// directory specified by virtualPath
GetCodeDirectoryInformation(virtualPath,
out codeDomProviderType, out compilerParameters,
out generatedFilesDir);
return BuildManager.GenerateFileTable[virtualPath.VirtualPathStringNoTrailingSlash];
}
finally {
RemovePendingCall();
}
}
示例2: GetGeneratedSourceFile
internal string GetGeneratedSourceFile(VirtualPath virtualPath)
{
string str2;
this.AddPendingCall();
try
{
Type type;
CompilerParameters parameters;
string str;
if (!virtualPath.DirectoryExists())
{
throw new ArgumentException(System.Web.SR.GetString("GetGeneratedSourceFile_Directory_Only", new object[] { virtualPath.VirtualPathString }), "virtualPath");
}
this.GetCodeDirectoryInformation(virtualPath, out type, out parameters, out str);
str2 = BuildManager.GenerateFileTable[virtualPath.VirtualPathStringNoTrailingSlash];
}
finally
{
this.RemovePendingCall();
}
return str2;
}
示例3: VirtualDirectoryExistsWithAssert
private static bool VirtualDirectoryExistsWithAssert(VirtualPath virtualDir)
{
try
{
string path = virtualDir.MapPathInternal();
if (path != null)
{
new FileIOPermission(FileIOPermissionAccess.Read, path).Assert();
}
return virtualDir.DirectoryExists();
}
catch
{
return false;
}
}