Пример #1
0
        public ActivePiece(PieceInfo piece, int pieceByteSize)
        {
            pieceInfo = piece;
            this.pieceByteSize = pieceByteSize;
            blocksCount = ExchUtils.BlockCount(pieceByteSize);

            blocks = new List<BlockStatus>(blocksCount);

            Reset();
        }
Пример #2
0
 private bool CheckPieceData(TransferJob job, PieceInfo piece)
 {
     string path = fileModule._context.MainPath.ToFull(piece.RelFilePath);
     // TODO: to jest zle na razie (stala wielkosc)
     byte[] data = _dataManager.ReadPiece(path, ExchUtils.GetInFilePosition(piece),
                                          ExchUtils.StandardPieceSize);
     return job.CheckData(piece, data, ExchUtils.StandardPieceSize);
 }
Пример #3
0
 public static long GetInFilePosition(PieceInfo piece)
 {
     return (long) piece.Index << StandardPieceSize;
 }
Пример #4
0
 public bool Equals(PieceInfo other)
 {
     return Equals(other.relFilePath, relFilePath) && other.index == index;
 }