OctoTorrent.Client.DiskManager.QueueFlush C# (CSharp) Method

QueueFlush() private method

private QueueFlush ( TorrentManager manager, int index ) : void
manager TorrentManager
index int
return void
        internal void QueueFlush(TorrentManager manager, int index)
        {
            IOLoop.Queue(() =>
                             {
                                 try
                                 {
                                     foreach (var file in manager.Torrent.Files.Where(file => file.StartPieceIndex >= index && file.EndPieceIndex <= index))
                                         _writer.Flush(file);
                                 }
                                 catch (Exception ex)
                                 {
                                     SetError(manager, Reason.WriteFailure, ex);
                                 }
                             });
        }

Usage Example

示例#1
0
 private void PieceHashed(object sender, PieceHashedEventArgs e)
 {
     if (e.TorrentManager.State != TorrentState.Hashing)
     {
         diskManager.QueueFlush(e.TorrentManager, e.PieceIndex);
     }
 }