/* ==============================================================================
* 功能描述:CompressArgs
* 创 建 者:Garrett
* 创建日期:2019/2/13 17:51:10
* ==============================================================================*/
/* ==============================================================================
* 功能描述:压缩请求
* 创 建 者:SAGACLOUD
* 创建日期:2017/9/17
* ==============================================================================*/
using System;
namespace PackageUploader.Compress
{
///
/// CompressArgs
///
public class CompressArgs : EventArgs
{
public CompressArgs(long incrementTransferred, long transferred, long total,Action action)
{
this.IncrementTransferred = incrementTransferred;
this.TransferredBytes = transferred;
this.TotalBytes = total;
m_IncrementChangeAction = action;
}
public long IncrementTransferred {
set
{
TransferredBytes += value;
m_IncrementChangeAction?.Invoke(this.ToString());
} }
public long TransferredBytes { get; set; }
public long TotalBytes { get; }
public override string ToString()
{
return $"CompressCallback - TotalBytes:{TotalBytes/1024/1024}M, CompressedBytes:{TransferredBytes/1024/1024}M,CompressedPercent:{Math.Round(100d* TransferredBytes / TotalBytes, 3)}%";
}
private Action m_IncrementChangeAction;
}
}