Пример #1
0
        public async Task HashArchives()
        {
            Utils.Log("Looking for files to hash");

            var allFiles = DownloadFolder.EnumerateFiles()
                           .Concat(Game.GameLocation().EnumerateFiles())
                           .ToList();

            var hashDict = allFiles.GroupBy(f => f.Size).ToDictionary(g => g.Key);

            var toHash = ModList.Archives.Where(a => hashDict.ContainsKey(a.Size)).SelectMany(a => hashDict[a.Size]).ToList();

            Utils.Log($"Found {allFiles.Count} total files, {toHash.Count} matching filesize");

            var hashResults = await
                              toHash
                              .PMap(Queue, UpdateTracker, async e => (await e.FileHashCachedAsync(), e));

            HashedArchives.SetTo(hashResults
                                 .OrderByDescending(e => e.Item2.LastModified)
                                 .GroupBy(e => e.Item1)
                                 .Select(e => e.First())
                                 .Where(x => x.Item1 != null)
                                 .Select(e => new KeyValuePair <Hash, AbsolutePath>(e.Item1 !.Value, e.Item2)));
        }
Пример #2
0
        public async Task HashArchives()
        {
            var hashResults = await DownloadFolder.EnumerateFiles()
                              .Where(e => e.Extension != Consts.HashFileExtension)
                              .PMap(Queue, async e => (await e.FileHashCachedAsync(), e));

            HashedArchives.SetTo(hashResults
                                 .OrderByDescending(e => e.Item2.LastModified)
                                 .GroupBy(e => e.Item1)
                                 .Select(e => e.First())
                                 .Select(e => new KeyValuePair <Hash, AbsolutePath>(e.Item1, e.Item2)));
        }
Пример #3
0
        public async Task HashArchives()
        {
            Utils.Log("Looking for files to hash");
            var toHash = DownloadFolder.EnumerateFiles()
                         .Concat(Game.GameLocation().EnumerateFiles())
                         .ToList();

            Utils.Log($"Found {toHash.Count} files to hash");

            var hashResults = await
                              toHash
                              .PMap(Queue, UpdateTracker, async e => (await e.FileHashCachedAsync(), e));

            HashedArchives.SetTo(hashResults
                                 .OrderByDescending(e => e.Item2.LastModified)
                                 .GroupBy(e => e.Item1)
                                 .Select(e => e.First())
                                 .Select(e => new KeyValuePair <Hash, AbsolutePath>(e.Item1, e.Item2)));
        }
 private IEnumerable <FileInfo> GetDownloadFiles() => DownloadFolder.EnumerateFiles("*", SearchOption.AllDirectories);
Пример #5
0
 public List <FileInfo> GetDownloadFiles() => DownloadFolder.EnumerateFiles("*", SearchOption.AllDirectories).ToList();