ContainerFile.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Fire;
  7. namespace System.Fire.Container {
  8. public class ContainerFile {
  9. private long _size; // 8
  10. private DateTime _uploadDate; // 8
  11. private bool bDeleted; // 1
  12. private Mime.eMediaType _mediaType = Mime.eMediaType.Unknown; // 8
  13. private long _fileInfoPos; // 8
  14. private long _chunkPos; // 8
  15. private int _chunkLen; // 4
  16. //---------------------------
  17. // 41 bytes
  18. public void getInfoFromFile(string path) {
  19. this._mediaType = Mime.getMediaType(path);
  20. }
  21. public Mime.eMediaType MediaType {
  22. get {
  23. return this._mediaType;
  24. }
  25. set {
  26. this._mediaType = value;
  27. }
  28. }
  29. public long FileInfoPos {
  30. get {
  31. return this._fileInfoPos;
  32. }
  33. set {
  34. this._fileInfoPos = value;
  35. }
  36. }
  37. public long ChunkPos {
  38. get {
  39. return this._chunkPos;
  40. }
  41. set {
  42. this._chunkPos = value;
  43. }
  44. }
  45. public int ChunkLen {
  46. get {
  47. return this._chunkLen;
  48. }
  49. set {
  50. this._chunkLen = value;
  51. }
  52. }
  53. public long Size {
  54. get {
  55. return this._size;
  56. }
  57. set {
  58. this._size = value;
  59. }
  60. }
  61. public DateTime UploadDate {
  62. get {
  63. return this._uploadDate;
  64. }
  65. set {
  66. this._uploadDate = value;
  67. }
  68. }
  69. public bool Deleted {
  70. get {
  71. return this.bDeleted;
  72. }
  73. set {
  74. this.bDeleted = value;
  75. }
  76. }
  77. public int NumChunks {
  78. get {
  79. return this._chunkLen / 4;
  80. }
  81. }
  82. public override string ToString() {
  83. string s = "{";
  84. s += "\"size\":" + this._size + ",";
  85. s += "\"uploadDate\":" + this._uploadDate.Ticks + ",";
  86. s += "\"bDeleted\":" + (this.bDeleted?"true":"false") + ",";
  87. s += "\"mediaType\":" + ((byte)this.MediaType) + ",";
  88. s += "\"fileInfoPos\":" + this._fileInfoPos + ",";
  89. s += "\"chunkPos\":" + this._chunkPos + ",";
  90. s += "\"chunkLen\":" + this._chunkLen;
  91. s += "}";
  92. return s;
  93. }
  94. }
  95. }