Flags.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. namespace SharpCompress.Common.Rar.Headers
  2. {
  3. internal enum HeaderType : byte
  4. {
  5. Null,
  6. Mark,
  7. Archive,
  8. File,
  9. Service,
  10. Comment,
  11. Av,
  12. Protect,
  13. Sign,
  14. NewSub,
  15. EndArchive,
  16. Crypt
  17. }
  18. internal static class HeaderCodeV
  19. {
  20. public const byte RAR4_MARK_HEADER = 0x72;
  21. public const byte RAR4_ARCHIVE_HEADER = 0x73;
  22. public const byte RAR4_FILE_HEADER = 0x74;
  23. public const byte RAR4_COMMENT_HEADER = 0x75;
  24. public const byte RAR4_AV_HEADER = 0x76;
  25. public const byte RAR4_SUB_HEADER = 0x77;
  26. public const byte RAR4_PROTECT_HEADER = 0x78;
  27. public const byte RAR4_SIGN_HEADER = 0x79;
  28. public const byte RAR4_NEW_SUB_HEADER = 0x7a;
  29. public const byte RAR4_END_ARCHIVE_HEADER = 0x7b;
  30. public const byte RAR5_ARCHIVE_HEADER = 0x01;
  31. public const byte RAR5_FILE_HEADER = 0x02;
  32. public const byte RAR5_SERVICE_HEADER = 0x03;
  33. public const byte RAR5_ARCHIVE_ENCRYPTION_HEADER = 0x04;
  34. public const byte RAR5_END_ARCHIVE_HEADER = 0x05;
  35. }
  36. internal static class HeaderFlagsV4
  37. {
  38. public const ushort HAS_DATA = 0x8000;
  39. }
  40. internal static class EncryptionFlagsV5
  41. {
  42. // RAR 5.0 archive encryption header specific flags.
  43. public const uint CHFL_CRYPT_PSWCHECK = 0x01; // Password check data is present.
  44. public const uint FHEXTRA_CRYPT_PSWCHECK = 0x01; // Password check data is present.
  45. public const uint FHEXTRA_CRYPT_HASHMAC = 0x02;
  46. }
  47. internal static class HeaderFlagsV5
  48. {
  49. public const ushort HAS_EXTRA = 0x0001;
  50. public const ushort HAS_DATA = 0x0002;
  51. public const ushort KEEP = 0x0004; // block must be kept during an update
  52. public const ushort SPLIT_BEFORE = 0x0008;
  53. public const ushort SPLIT_AFTER = 0x0010;
  54. public const ushort CHILD = 0x0020; // ??? Block depends on preceding file block.
  55. public const ushort PRESERVE_CHILD = 0x0040; // ???? Preserve a child block if host block is modified
  56. }
  57. internal static class ArchiveFlagsV4
  58. {
  59. public const ushort VOLUME = 0x0001;
  60. public const ushort COMMENT = 0x0002;
  61. public const ushort LOCK = 0x0004;
  62. public const ushort SOLID = 0x0008;
  63. public const ushort NEW_NUMBERING = 0x0010;
  64. public const ushort AV = 0x0020;
  65. public const ushort PROTECT = 0x0040;
  66. public const ushort PASSWORD = 0x0080;
  67. public const ushort FIRST_VOLUME = 0x0100;
  68. public const ushort ENCRYPT_VER = 0x0200;
  69. }
  70. internal static class ArchiveFlagsV5
  71. {
  72. public const ushort VOLUME = 0x0001;
  73. public const ushort HAS_VOLUME_NUMBER = 0x0002;
  74. public const ushort SOLID = 0x0004;
  75. public const ushort PROTECT = 0x0008;
  76. public const ushort LOCK = 0x0010;
  77. }
  78. internal static class HostOsV4
  79. {
  80. public const byte MS_DOS = 0;
  81. public const byte OS2 = 1;
  82. public const byte WIN32 = 2;
  83. public const byte UNIX = 3;
  84. public const byte MAC_OS = 4;
  85. public const byte BE_OS = 5;
  86. }
  87. internal static class HostOsV5
  88. {
  89. public const byte WINDOWS = 0;
  90. public const byte UNIX = 1;
  91. }
  92. internal static class FileFlagsV4
  93. {
  94. public const ushort SPLIT_BEFORE = 0x0001;
  95. public const ushort SPLIT_AFTER = 0x0002;
  96. public const ushort PASSWORD = 0x0004;
  97. public const ushort COMMENT = 0x0008;
  98. public const ushort SOLID = 0x0010;
  99. public const ushort WINDOW_MASK = 0x00e0;
  100. public const ushort WINDOW64 = 0x0000;
  101. public const ushort WINDOW128 = 0x0020;
  102. public const ushort WINDOW256 = 0x0040;
  103. public const ushort WINDOW512 = 0x0060;
  104. public const ushort WINDOW1024 = 0x0080;
  105. public const ushort WINDOW2048 = 0x00a0;
  106. public const ushort WINDOW4096 = 0x00c0;
  107. public const ushort DIRECTORY = 0x00e0;
  108. public const ushort LARGE = 0x0100;
  109. public const ushort UNICODE = 0x0200;
  110. public const ushort SALT = 0x0400;
  111. public const ushort VERSION = 0x0800;
  112. public const ushort EXT_TIME = 0x1000;
  113. public const ushort EXT_FLAGS = 0x2000;
  114. }
  115. internal static class FileFlagsV5
  116. {
  117. public const ushort DIRECTORY = 0x0001;
  118. public const ushort HAS_MOD_TIME = 0x0002;
  119. public const ushort HAS_CRC32 = 0x0004;
  120. public const ushort UNPACKED_SIZE_UNKNOWN = 0x0008;
  121. }
  122. internal static class EndArchiveFlagsV4
  123. {
  124. public const ushort NEXT_VOLUME = 0x0001;
  125. public const ushort DATA_CRC = 0x0002;
  126. public const ushort REV_SPACE = 0x0004;
  127. public const ushort VOLUME_NUMBER = 0x0008;
  128. }
  129. internal static class EndArchiveFlagsV5
  130. {
  131. public const ushort HAS_NEXT_VOLUME = 0x0001;
  132. }
  133. }