FilePackageModel.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //************************************************************************
  2. // author: yuzhengyang
  3. // date: 2018.3.27 - 2018.6.3
  4. // desc: 工具描述
  5. // Copyright (c) yuzhengyang. All rights reserved.
  6. //************************************************************************
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. namespace Azylee.Core.IOUtils.FileUtils
  12. {
  13. class FilePackageModel
  14. {
  15. public string Name { get; set; }
  16. public string Path { get; set; }
  17. public string MD5 { get; set; }
  18. public long Size { get; set; }
  19. public byte[] NameByte { get { return Encoding.Default.GetBytes(Name); } }
  20. public byte[] PathByte { get { return Encoding.Default.GetBytes(Path); } }
  21. public byte[] MD5Byte { get { return Encoding.Default.GetBytes(MD5); } }
  22. public byte[] SizeByte { get { return BitConverter.GetBytes(Size); } }
  23. public byte[] NameLengthByte { get { return BitConverter.GetBytes(NameByte.Length); } }
  24. public byte[] PathLengthByte { get { return BitConverter.GetBytes(PathByte.Length); } }
  25. public byte[] MD5LengthByte { get { return BitConverter.GetBytes(MD5Byte.Length); } }
  26. public byte[] SizeLengthByte { get { return BitConverter.GetBytes(SizeByte.Length); } }
  27. public int AllByteLength
  28. {
  29. get
  30. {
  31. return NameByte.Length + PathByte.Length +
  32. MD5Byte.Length + SizeByte.Length +
  33. NameLengthByte.Length + PathLengthByte.Length +
  34. MD5LengthByte.Length + SizeLengthByte.Length;
  35. }
  36. }
  37. }
  38. }