星火直播PC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System.Collections.Generic;
  2. namespace Common.Model
  3. {
  4. /// <summary>
  5. /// 下载模型
  6. /// 创建人:赵耀
  7. /// 创建时间:2018年10月30日
  8. /// </summary>
  9. public class DownloadInfoModel
  10. {
  11. /// <summary>
  12. /// 子线程数量
  13. /// </summary>
  14. private int _taskCount = 1;
  15. /// <summary>
  16. /// 子线程数量
  17. /// </summary>
  18. public int taskCount
  19. {
  20. get => _taskCount;
  21. set => _taskCount = value;
  22. }
  23. /// <summary>
  24. /// 保存的临时文件名
  25. /// </summary>
  26. public string tempFileName { get; set; }
  27. /// <summary>
  28. /// 是否是新任务,如果不是新任务则通过配置去分配线程
  29. /// 一开始要设为true,在初始化完成后会被设为true,此时可以对这个 DownloadInfo 进行序列化后保存,进而实现退出程序加载配置继续下载。
  30. /// </summary>
  31. private bool _isNewTask = true;
  32. /// <summary>
  33. /// 是否是新任务,如果不是新任务则通过配置去分配线程
  34. /// 一开始要设为true,在初始化完成后会被设为true,此时可以对这个 DownloadInfo 进行序列化后保存,进而实现退出程序加载配置继续下载。
  35. /// </summary>
  36. public bool isNewTask
  37. {
  38. get => _isNewTask;
  39. set => _isNewTask = value;
  40. }
  41. /// <summary>
  42. /// 是否重新下载
  43. /// </summary>
  44. private bool _isReStart = false;
  45. /// <summary>
  46. /// 是否重新下载
  47. /// </summary>
  48. public bool isReStart
  49. {
  50. get => _isReStart;
  51. set => _isReStart = value;
  52. }
  53. /// <summary>
  54. /// 任务总大小
  55. /// </summary>
  56. public long count { get; set; }
  57. /// <summary>
  58. /// 保存的目录
  59. /// </summary>
  60. public string saveDir { get; set; }
  61. /// <summary>
  62. /// 请求方法
  63. /// </summary>
  64. private string _method = "get";
  65. /// <summary>
  66. /// 请求方法
  67. /// </summary>
  68. public string method
  69. {
  70. get => _method;
  71. set => _method = value;
  72. }
  73. /// <summary>
  74. /// 文件名
  75. /// </summary>
  76. public string fileName { get; set; }
  77. public List<string> _downloadUrlList;
  78. /// <summary>
  79. /// 下载地址,
  80. /// 这里是列表形式,如果同一个文件有不同来源则可以通过不同来源取数据
  81. /// 来源的有消息需另外判断
  82. /// </summary>
  83. public List<string> downloadUrlList
  84. {
  85. get => _downloadUrlList;
  86. set
  87. {
  88. List<string> UTF8ValueList = new List<string>();
  89. foreach (string val in value)
  90. {
  91. string path = val.Substring(0, val.LastIndexOf("/") + 1);
  92. string name = val.Substring(val.LastIndexOf("/") + 1);
  93. string UTF8Name = System.Web.HttpUtility.UrlEncode(name);
  94. string UTF8Url = path + UTF8Name;
  95. UTF8ValueList.Add(UTF8Url);
  96. _downloadUrlList = UTF8ValueList;
  97. }
  98. ;
  99. }
  100. }
  101. /// <summary>
  102. /// 是否支持断点续传
  103. /// 在任务开始后,如果需要暂停,应先通过这个判断是否支持
  104. /// 默认设为false
  105. /// </summary>
  106. private bool _IsSupportMultiThreading = false;
  107. /// <summary>
  108. /// 是否支持断点续传
  109. /// 在任务开始后,如果需要暂停,应先通过这个判断是否支持
  110. /// 默认设为false
  111. /// </summary>
  112. public bool IsSupportMultiThreading
  113. {
  114. get => _IsSupportMultiThreading;
  115. set => _IsSupportMultiThreading = value;
  116. }
  117. /// <summary>
  118. /// 线程任务列表
  119. /// </summary>
  120. public List<TaskInfoModel> TaskInfoList { get; set; }
  121. /// <summary>
  122. /// 保存文件名
  123. /// </summary>
  124. public string saveFileName { get; set; }
  125. }
  126. /// <summary>
  127. /// 任务模型
  128. /// </summary>
  129. public class TaskInfoModel
  130. {
  131. /// <summary>
  132. /// 请求方法
  133. /// </summary>
  134. public string method { get; set; }
  135. public string downloadUrl { get; set; }
  136. public string filePath { get; set; }
  137. /// <summary>
  138. /// 分片起点
  139. /// </summary>
  140. public long fromIndex { get; set; }
  141. /// <summary>
  142. /// 分片终点
  143. /// </summary>
  144. public long toIndex { get; set; }
  145. /// <summary>
  146. /// 分片的总大小
  147. /// </summary>
  148. public long count => toIndex - fromIndex + 1;
  149. }
  150. /// <summary>
  151. /// 解压书模型
  152. /// </summary>
  153. public class BookDecompressionModel
  154. {
  155. /// <summary>
  156. /// 书的文件名
  157. /// </summary>
  158. public string BookFileName { get; set; }
  159. /// <summary>
  160. /// 解压书籍的控件
  161. /// </summary>
  162. public object UcBookCover { get; set; }
  163. }
  164. }