DownloadSuccessEventArgs.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 DownloadSuccessEventArgs : GameFrameworkEventArgs
  13. {
  14. /// <summary>
  15. /// 初始化下载成功事件的新实例。
  16. /// </summary>
  17. public DownloadSuccessEventArgs()
  18. {
  19. SerialId = 0;
  20. DownloadPath = null;
  21. DownloadUri = null;
  22. CurrentLength = 0L;
  23. UserData = null;
  24. }
  25. /// <summary>
  26. /// 获取下载任务的序列编号。
  27. /// </summary>
  28. public int SerialId
  29. {
  30. get;
  31. private set;
  32. }
  33. /// <summary>
  34. /// 获取下载后存放路径。
  35. /// </summary>
  36. public string DownloadPath
  37. {
  38. get;
  39. private set;
  40. }
  41. /// <summary>
  42. /// 获取下载地址。
  43. /// </summary>
  44. public string DownloadUri
  45. {
  46. get;
  47. private set;
  48. }
  49. /// <summary>
  50. /// 获取当前大小。
  51. /// </summary>
  52. public long CurrentLength
  53. {
  54. get;
  55. private set;
  56. }
  57. /// <summary>
  58. /// 获取用户自定义数据。
  59. /// </summary>
  60. public object UserData
  61. {
  62. get;
  63. private set;
  64. }
  65. /// <summary>
  66. /// 创建下载成功事件。
  67. /// </summary>
  68. /// <param name="serialId">下载任务的序列编号。</param>
  69. /// <param name="downloadPath">下载后存放路径。</param>
  70. /// <param name="downloadUri">下载地址。</param>
  71. /// <param name="currentLength">当前大小。</param>
  72. /// <param name="userData">用户自定义数据。</param>
  73. /// <returns>创建的下载成功事件。</returns>
  74. public static DownloadSuccessEventArgs Create(int serialId, string downloadPath, string downloadUri, long currentLength, object userData)
  75. {
  76. DownloadSuccessEventArgs downloadSuccessEventArgs = ReferencePool.Acquire<DownloadSuccessEventArgs>();
  77. downloadSuccessEventArgs.SerialId = serialId;
  78. downloadSuccessEventArgs.DownloadPath = downloadPath;
  79. downloadSuccessEventArgs.DownloadUri = downloadUri;
  80. downloadSuccessEventArgs.CurrentLength = currentLength;
  81. downloadSuccessEventArgs.UserData = userData;
  82. return downloadSuccessEventArgs;
  83. }
  84. /// <summary>
  85. /// 清理下载成功事件。
  86. /// </summary>
  87. public override void Clear()
  88. {
  89. SerialId = 0;
  90. DownloadPath = null;
  91. DownloadUri = null;
  92. CurrentLength = 0L;
  93. UserData = null;
  94. }
  95. }
  96. }