本文整理汇总了C#中System.IO.DirectoryInfo.HasSubdirectory方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.HasSubdirectory方法的具体用法?C# DirectoryInfo.HasSubdirectory怎么用?C# DirectoryInfo.HasSubdirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.DirectoryInfo
的用法示例。
在下文中一共展示了DirectoryInfo.HasSubdirectory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compare
public void Compare(DirectoryInfo referenceDirectory, DirectoryInfo targetDirectory)
{
CompareSubdirectories(referenceDirectory, targetDirectory);
CompareFiles(referenceDirectory, targetDirectory);
foreach(DirectoryInfo di in referenceDirectory.EnumerateDirectories().Where( d => targetDirectory.HasSubdirectory(d) ))
{
Compare(di, targetDirectory.EnumerateDirectories(di.Name).Single());
}
}
示例2: CompareSubdirectories
private void CompareSubdirectories(DirectoryInfo referenceDirectory, DirectoryInfo targetDirectory)
{
foreach (DirectoryInfo di in targetDirectory.EnumerateDirectories().Where(d => !referenceDirectory.HasSubdirectory(d)))
{
OnModification(new ModificationEventArgs(di.FullName, ModificationType.Added));
}
foreach (DirectoryInfo di in referenceDirectory.EnumerateDirectories().Where(d => !targetDirectory.HasSubdirectory(d)))
{
OnModification(new ModificationEventArgs(di.FullName, ModificationType.Removed));
}
}
示例3: LoadCourse
public Course LoadCourse(DirectoryInfo dir)
{
var courseId = dir.Name;
dir = dir.HasSubdirectory("Slides") ? dir.Subdirectory("Slides") : dir;
var settings = CourseSettings.Load(dir);
var slides = LoadSlides(dir, settings).ToArray();
CheckDuplicateSlideIds(slides);
var notes = LoadInstructorNotes(dir, courseId);
var title = settings.Title ?? GetTitle(dir);
return new Course(courseId, title, slides, notes, settings, dir);
}