VerifyElement.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System.IO;
  2. namespace YooAsset
  3. {
  4. /// <summary>
  5. /// 缓存文件验证元素
  6. /// </summary>
  7. internal class VerifyCacheElement
  8. {
  9. public string PackageName { private set; get; }
  10. public string CacheGUID { private set; get; }
  11. public string FileRootPath { private set; get; }
  12. public string DataFilePath { private set; get; }
  13. public string InfoFilePath { private set; get; }
  14. public EVerifyResult Result;
  15. public string DataFileCRC;
  16. public long DataFileSize;
  17. public VerifyCacheElement(string packageName, string cacheGUID, string fileRootPath, string dataFilePath, string infoFilePath)
  18. {
  19. PackageName = packageName;
  20. CacheGUID = cacheGUID;
  21. FileRootPath = fileRootPath;
  22. DataFilePath = dataFilePath;
  23. InfoFilePath = infoFilePath;
  24. }
  25. public void DeleteFiles()
  26. {
  27. if (File.Exists(DataFilePath))
  28. {
  29. File.Delete(DataFilePath);
  30. }
  31. if (File.Exists(InfoFilePath))
  32. {
  33. File.Delete(InfoFilePath);
  34. }
  35. }
  36. }
  37. /// <summary>
  38. /// 下载文件验证元素
  39. /// </summary>
  40. internal class VerifyTempElement
  41. {
  42. public string TempDataFilePath { private set; get; }
  43. public string FileCRC { private set; get; }
  44. public long FileSize { private set; get; }
  45. public int Result = 0; // 注意:原子操作对象
  46. public VerifyTempElement(string tempDataFilePath, string fileCRC, long fileSize)
  47. {
  48. TempDataFilePath = tempDataFilePath;
  49. FileCRC = fileCRC;
  50. FileSize = fileSize;
  51. }
  52. }
  53. }