Exemplo n.º 1
0
 async Task VerifyHashState()
 {
     // FIXME: I should really just ensure that zero length files always exist on disk. If the first file is
     // a zero length file and someone deletes it after the first piece has been written to disk, it will
     // never be recreated. If the downloaded data requires this file to exist, we have an issue.
     if (Manager.HasMetadata)
     {
         foreach (var file in Manager.Torrent.Files)
         {
             if (!file.BitField.AllFalse && Manager.HashChecked && file.Length > 0)
             {
                 Manager.HashChecked &= await DiskManager.CheckFileExistsAsync(file);
             }
         }
     }
 }
        async Task VerifyHashState()
        {
            // If we do not have metadata or the torrent needs a hash check, fast exit.
            if (!Manager.HasMetadata || !Manager.HashChecked)
            {
                return;
            }

            // FIXME: I should really just ensure that zero length files always exist on disk. If the first file is
            // a zero length file and someone deletes it after the first piece has been written to disk, it will
            // never be recreated. If the downloaded data requires this file to exist, we have an issue.
            foreach (ITorrentManagerFile file in Manager.Files)
            {
                if (!file.BitField.AllFalse && file.Length > 0)
                {
                    if (!await DiskManager.CheckFileExistsAsync(file))
                    {
                        Manager.SetNeedsHashCheck();
                        break;
                    }
                }
            }
        }