DownloadDataEntity.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using Game.Config;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEngine.Networking;
  7. [Serializable]
  8. public class DownloadDataEntity : GameData<DownloadDataEntity>
  9. {
  10. public string FullName;
  11. public string MD5;
  12. public ulong Size;
  13. //public string Version;
  14. public DownloadTaskState State;
  15. public int DownloadErrCount;
  16. public string Url;
  17. public Action<DownloadTask> Callback;
  18. public Action<DownloadTask> UpDateCallback;
  19. public override string FlieName()
  20. {
  21. return "mainfest";
  22. }
  23. public override bool SetFields(string fieldname, string value)
  24. {
  25. bool ret = base.SetFields(fieldname, value);
  26. if (!ret)
  27. {
  28. switch (fieldname)
  29. {
  30. case "FullName":
  31. {
  32. FullName = value;
  33. ret = true;
  34. }
  35. ; break;
  36. case "MD5":
  37. {
  38. MD5 = value;
  39. ret = true;
  40. }
  41. ; break;
  42. case "Size":
  43. {
  44. Size = ulong.Parse(value);
  45. ret = true;
  46. }
  47. ; break;
  48. }
  49. }
  50. return ret;
  51. }
  52. public override string GetFieldValue(string fieldname)
  53. {
  54. string ret = "";
  55. switch (fieldname)
  56. {
  57. case "ID":
  58. {
  59. ret = ID.ToString();
  60. }
  61. ; break;
  62. case "FullName":
  63. {
  64. ret = FullName;
  65. }
  66. ; break;
  67. case "MD5":
  68. {
  69. ret = MD5;
  70. }
  71. ; break;
  72. case "Size":
  73. {
  74. ret = Size.ToString();
  75. }
  76. ; break;
  77. }
  78. return ret;
  79. }
  80. public DownloadDataEntity()
  81. {
  82. FullName = "";
  83. MD5 = "";
  84. Size = 0;
  85. Url = "";
  86. // Version = "";
  87. DownloadErrCount = 0;
  88. State = DownloadTaskState.None;
  89. }
  90. public static void OnCsvLoad(CsvReader csvReader)
  91. {
  92. DownloadDataEntity.Onload_SetField(csvReader);
  93. }
  94. }
  95. public class DownLoadUrlCfg : GameData<DownLoadUrlCfg>
  96. {
  97. public string Platform;
  98. public string BaseUrl;
  99. public string ServerUrl;
  100. public string Param1;
  101. public string DownloadPath;
  102. public bool IsOPen;
  103. public override string FlieName()
  104. {
  105. return "DownLoadUrlCfg";
  106. }
  107. public DownLoadUrlCfg()
  108. {
  109. }
  110. public static void OnCsvLoad(CsvReader csvReader)
  111. {
  112. DownLoadUrlCfg.Onload(csvReader);
  113. }
  114. }