private void ProcessOutcomingTransfer(OutcomingFileTransfer oft)
        {
            if (oft.Reader.Eof)
            {
                // waiting for verification result - skip
                return;
            }
            var lastBlock    = oft.Reader.CurrentBlock == oft.Reader.BlockCount - 1;
            var tmpBlockSize = oft.BlockSize;

            if (lastBlock)
            {
                tmpBlockSize -= oft.Reader.Padding;
            }
            var msg = new CsFileTransferData
            {
                SessionId = oft.Id,
                Data      = new byte[tmpBlockSize]
            };

            oft.Reader.Read(msg.Data);
            oft.BytesDone += tmpBlockSize;
            oft.BlocksDone = oft.Reader.CurrentBlock;
            client.Send(msg);
            OnDataSent(oft);
        }
        public IOutcomingFileTransfer Add(string receiver, string fileName)
        {
            var token = lastToken++;
            var fi    = new FileInfo(fileName);
            var hash  = ComputeHash(fileName);
            var info  = new OutcomingFileTransferInfo
            {
                Token         = token,
                Receiver      = receiver,
                Name          = fileName,
                Size          = fi.Length,
                Hash          = hash,
                InitBlockSize = blockSize
            };
            var ft = new OutcomingFileTransfer(this, info);

            newPendingFts.Enqueue(ft);
            Root.Log(LogLevel.Info, "FileTransferManager: created outcoming session [file='{0}', token={1}]",
                     fileName, info.Token);
            return(ft);
        }