ReaderProgress.cs 637 B

123456789101112131415161718192021222324
  1. 
  2. using System;
  3. using SharpCompress.Common;
  4. namespace SharpCompress.Readers
  5. {
  6. public class ReaderProgress
  7. {
  8. private readonly IEntry _entry;
  9. public long BytesTransferred { get; }
  10. public int Iterations { get; }
  11. public int PercentageRead => (int)Math.Round(PercentageReadExact);
  12. public double PercentageReadExact => (float)BytesTransferred / _entry.Size * 100;
  13. public ReaderProgress(IEntry entry, long bytesTransferred, int iterations)
  14. {
  15. _entry = entry;
  16. BytesTransferred = bytesTransferred;
  17. Iterations = iterations;
  18. }
  19. }
  20. }