12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /* ==============================================================================
- * 功能描述:CompressArgs
- * 创 建 者:Garrett
- * 创建日期:2019/2/13 17:51:10
- * ==============================================================================*/
- /* ==============================================================================
- * 功能描述:压缩请求
- * 创 建 者:SAGACLOUD
- * 创建日期:2017/9/17
- * ==============================================================================*/
- using System;
- namespace PackageUploader.Compress
- {
- /// <summary>
- /// CompressArgs
- /// </summary>
- public class CompressArgs : EventArgs
- {
- public CompressArgs(long incrementTransferred, long transferred, long total,Action<string> 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<string> m_IncrementChangeAction;
- }
- }
|