DownloadAgentHelperUpdateLengthEventArgs.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 loyalsoft. All rights reserved.
  4. // Homepage: http://www.game7000.com/
  5. // Feedback: http://www.game7000.com/
  6. //------------------------------------------------------------
  7. namespace GameFramework.Download
  8. {
  9. /// <summary>
  10. /// 下载代理辅助器更新数据大小事件。
  11. /// </summary>
  12. public sealed class DownloadAgentHelperUpdateLengthEventArgs : GameFrameworkEventArgs
  13. {
  14. /// <summary>
  15. /// 初始化下载代理辅助器更新数据大小事件的新实例。
  16. /// </summary>
  17. public DownloadAgentHelperUpdateLengthEventArgs()
  18. {
  19. DeltaLength = 0;
  20. }
  21. /// <summary>
  22. /// 获取下载的增量数据大小。
  23. /// </summary>
  24. public int DeltaLength
  25. {
  26. get;
  27. private set;
  28. }
  29. /// <summary>
  30. /// 创建下载代理辅助器更新数据大小事件。
  31. /// </summary>
  32. /// <param name="deltaLength">下载的增量数据大小。</param>
  33. /// <returns>创建的下载代理辅助器更新数据大小事件。</returns>
  34. public static DownloadAgentHelperUpdateLengthEventArgs Create(int deltaLength)
  35. {
  36. if (deltaLength <= 0)
  37. {
  38. throw new GameFrameworkException("Delta length is invalid.");
  39. }
  40. DownloadAgentHelperUpdateLengthEventArgs downloadAgentHelperUpdateLengthEventArgs = ReferencePool.Acquire<DownloadAgentHelperUpdateLengthEventArgs>();
  41. downloadAgentHelperUpdateLengthEventArgs.DeltaLength = deltaLength;
  42. return downloadAgentHelperUpdateLengthEventArgs;
  43. }
  44. /// <summary>
  45. /// 清理下载代理辅助器更新数据大小事件。
  46. /// </summary>
  47. public override void Clear()
  48. {
  49. DeltaLength = 0;
  50. }
  51. }
  52. }