LargeFileProgressEventArgs
using System;
namespace Relativity.Transfer
{
public class LargeFileProgressEventArgs : EventArgs
{
public TransferPath Path { get; }
public int ChunkNumber { get; }
public double Progress { get; }
public long TotalBytes { get; }
public int TotalChunks { get; }
public long TotalTransferredBytes { get; }
public LargeFileProgressEventArgs(TransferPath path, long totalTransferredBytes, long totalBytes, double progress)
{
if (path == (TransferPath)null)
throw new ArgumentNullException("path");
Path = path;
TotalBytes = totalBytes;
TotalTransferredBytes = totalTransferredBytes;
Progress = progress;
}
public LargeFileProgressEventArgs(TransferPath path, long totalTransferredBytes, long totalBytes, int chunkNumber, int totalChunks)
{
if (path == (TransferPath)null)
throw new ArgumentNullException("path");
Path = path;
ChunkNumber = chunkNumber;
TotalChunks = totalChunks;
TotalTransferredBytes = totalTransferredBytes;
TotalBytes = totalBytes;
if (TotalChunks == 0)
Progress = 0;
else if (TotalTransferredBytes > 0 && TotalBytes > 0) {
Progress = TransferHelper.CalculateByteLevelProgress(TotalBytes, TotalTransferredBytes);
} else {
Progress = TransferHelper.CalculateByteLevelProgress(TotalChunks, ChunkNumber);
}
}
}
}