public override HashList <T> Range(T query, int range)
        {
            HashList <T> ls = new HashList <T>();
            HashList <T> r  = base.Range(query, range);

            ls.AddRange(r.Where(a => !a.IsDeleted));
            ls.AddRange(Secondary.Where(a => !a.IsDeleted && a.CalculateDistance(query) < range));
            ls.CustomSort(0, ls.Count - 1);
            return(ls);
        }
Exemplo n.º 2
0
        private async Task <List <FileData> > EnumerateDownloadableFilesFromHashList(string path)
        {
            HashList = await SmartCopy.GetHashList(remote, true);

            List <FileData> workingList = HashList.Where(f => f.RelativePath.StartsWith(path)).ToList();

            OnReportTotalFilesCount?.Invoke(workingList.Count);
            var retv = new List <FileData>();

            foreach (var a in HashList)
            {
                string hash = "";
                if (local.Exists(a.RelativePath))
                {
                    local.Read(a.RelativePath, async(stream) => {
                        await Task.Yield();
                        hash = await GetHash(stream);
                    }).Wait();
                }

                var gzSuffix = "";
                if (options.UseGZip)
                {
                    gzSuffix = GZIP_FILE_SUFFIX;
                }
                while ((a.Hash != hash || !local.Exists(a.RelativePath)))
                {
                    if (remote.Exists(a.RelativePath + gzSuffix))
                    {
                        retv.Add(a);
                    }
                }
            }
            return(retv);
        }