本文整理汇总了C#中IFolder.GetFoldersAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IFolder.GetFoldersAsync方法的具体用法?C# IFolder.GetFoldersAsync怎么用?C# IFolder.GetFoldersAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFolder
的用法示例。
在下文中一共展示了IFolder.GetFoldersAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IndexFoldersAsync
private async Task<IEnumerable<TopicData>> IndexFoldersAsync(IFolder folder)
{
var folders = await folder.GetFoldersAsync(cancellationToken);
var foldersArray = folders.Where(IsTopic).ToArray();
var count = foldersArray.Count();
Indicator.Report(progress, count);
var folderTopics = Enumerable.Range(0, count).Select(index =>
IndexFolderAsync(foldersArray[index], relativePath, index, count));
var topicsMany = await Task.WhenAll(folderTopics);
return topicsMany.SelectMany(t => t);
}
示例2: DirSize
public static async Task<long> DirSize(IFolder d, Func<string, long> GetFolderSize, Func<string, long> GetFileSize)
{
long Size = 0;
// Add file sizes.
IList<IFile> fis = await d.GetFilesAsync();
foreach (IFile fi in fis)
{
Size += GetFileSize(fi.Path);
}
// Add subdirectory sizes.
IList<IFolder> fols = await d.GetFoldersAsync();
foreach (IFolder fo in fols)
{
Size += GetFolderSize(fo.Path);
}
return (Size);
}
示例3: SearchFolder
private static IFolder SearchFolder(String[] paths, IFolder storageFolder, int option)
{
if (paths == null || paths.Length <= 0)
{
return storageFolder;
}
var foldersTasks = storageFolder.GetFoldersAsync();
foldersTasks.Wait ();
if (foldersTasks.Exception != null)
{
throw foldersTasks.Exception;
}
IList<IFolder> folders = foldersTasks.Result;
foreach (IFolder folder in folders)
{
for (int i = 0; i < paths.Length; i++)
{
if (folder.Name.Equals(paths[i], StringComparison.OrdinalIgnoreCase))
{
String[] newPaths = new String[paths.Length - 1];
int count = 0;
for (int j = 1;j < paths.Length; j++)
{
newPaths[count++] = paths[j];
}
return SearchFolder(newPaths, folder, option);
}
}
}
return null;
}