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


C# IFolder.GetFilesAsync方法代码示例

本文整理汇总了C#中IFolder.GetFilesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IFolder.GetFilesAsync方法的具体用法?C# IFolder.GetFilesAsync怎么用?C# IFolder.GetFilesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFolder的用法示例。


在下文中一共展示了IFolder.GetFilesAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FileCache

        internal FileCache(string cacheToken)
        {
            _cacheToken = cacheToken;
            _folder = FileSystem.Current.LocalStorage.CreateFolderAsync(_cacheToken, CreationCollisionOption.OpenIfExists).Result;
            _httpClient =  new HttpClient(new HttpClientHandler() { AllowAutoRedirect = true, CookieContainer = Client.CookieContainer, UseCookies = true });
            _cachedFiles = new Dictionary<string, string>();

            IList<IFile> files = _folder.GetFilesAsync().Result;

            foreach(IFile file in files)
            {
                _cachedFiles.Add(file.Name, file.Path);
            }
        }
开发者ID:Rhombulus,项目名称:WTalk,代码行数:14,代码来源:FileCache.cs

示例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);
 }
开发者ID:GSDan,项目名称:Speeching_Client,代码行数:17,代码来源:Utils.cs

示例3: RollingLogFileNameAsync

        private async Task<string> RollingLogFileNameAsync(IFolder folder)
        {
            var files = await folder.GetFilesAsync().ConfigureAwait(false);

            var counter = 0;
            if (files.Count > 0)
            {
                var logFiles = (from f in files where Regex.Match(f.Name, LOG_FILE_PATTERN).Success select f).OrderBy(f => f.Name).ToList();

                if (logFiles.Count > 0)
                {
                    //if the number of files are greater than the max number of files allowed then,
                    //delete the oldest file. oldest file is the file with the lowest number
                    while (logFiles.Count > MAX_FILES_COUNT)
                    {
                        await logFiles[0].DeleteAsync().ConfigureAwait(false);

                        logFiles.RemoveAt(0);
                    }

                    // the current file is the file at the zeroth index.
                    var currentFile = logFiles[logFiles.Count - 1];

                    long fileSize = 0;
                    using (var stream = await currentFile.OpenAsync(PCLStorage.FileAccess.Read).ConfigureAwait(false))
                    {
                        fileSize = stream.Length;
                    }

                    if (fileSize < MAX_SIZE)
                    {
                        return currentFile.Name;
                    }
                    else
                    {
                        var fileName = currentFile.Name;
                        var regex = new Regex(LOG_FILE_PATTERN);
                        var match = regex.Match(fileName);
                        if (match.Success)
                        {
                            if (int.TryParse(match.Groups["counter"].Value, out counter))
                                counter++;
                        }
                    }
                }
            }

            return string.Format(LOG_FILE_FORMAT, counter);
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:49,代码来源:Logger.File.cs

示例4: GetEvents

 private async Task<IEnumerable<Event>> GetEvents(IFolder collectionFolder)
 {
     var files = await collectionFolder.GetFilesAsync();
     var fileContents = await TaskEx.WhenAll(files.Select(file => file.ReadAllTextAsync()));
     return fileContents.Select(fc => new Event(fc));
 }
开发者ID:ahsanulhadi,项目名称:connect-net-sdk,代码行数:6,代码来源:FileEventStore.cs

示例5: IndexFilesAsync

 private async Task<IEnumerable<TopicData>> IndexFilesAsync(IFolder folder)
 {
     var files = await folder.GetFilesAsync(cancellationToken);
     return files.Where(IsTopic)
         .Select(CreateTopicData);
 }
开发者ID:AMDL,项目名称:amdl2maml,代码行数:6,代码来源:FolderIndexer.cs


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