| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | namespace ICSharpCode.SharpZipLib.Zip.Compression |
| | | 4 | | { |
| | | 5 | | /// <summary> |
| | | 6 | | /// This class contains constants used for deflation. |
| | | 7 | | /// </summary> |
| | | 8 | | public static class DeflaterConstants |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Set to true to enable debugging |
| | | 12 | | /// </summary> |
| | | 13 | | public const bool DEBUGGING = false; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Written to Zip file to identify a stored block |
| | | 17 | | /// </summary> |
| | | 18 | | public const int STORED_BLOCK = 0; |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Identifies static tree in Zip file |
| | | 22 | | /// </summary> |
| | | 23 | | public const int STATIC_TREES = 1; |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Identifies dynamic tree in Zip file |
| | | 27 | | /// </summary> |
| | | 28 | | public const int DYN_TREES = 2; |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Header flag indicating a preset dictionary for deflation |
| | | 32 | | /// </summary> |
| | | 33 | | public const int PRESET_DICT = 0x20; |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Sets internal buffer sizes for Huffman encoding |
| | | 37 | | /// </summary> |
| | | 38 | | public const int DEFAULT_MEM_LEVEL = 8; |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Internal compression engine constant |
| | | 42 | | /// </summary> |
| | | 43 | | public const int MAX_MATCH = 258; |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Internal compression engine constant |
| | | 47 | | /// </summary> |
| | | 48 | | public const int MIN_MATCH = 3; |
| | | 49 | | |
| | | 50 | | /// <summary> |
| | | 51 | | /// Internal compression engine constant |
| | | 52 | | /// </summary> |
| | | 53 | | public const int MAX_WBITS = 15; |
| | | 54 | | |
| | | 55 | | /// <summary> |
| | | 56 | | /// Internal compression engine constant |
| | | 57 | | /// </summary> |
| | | 58 | | public const int WSIZE = 1 << MAX_WBITS; |
| | | 59 | | |
| | | 60 | | /// <summary> |
| | | 61 | | /// Internal compression engine constant |
| | | 62 | | /// </summary> |
| | | 63 | | public const int WMASK = WSIZE - 1; |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// Internal compression engine constant |
| | | 67 | | /// </summary> |
| | | 68 | | public const int HASH_BITS = DEFAULT_MEM_LEVEL + 7; |
| | | 69 | | |
| | | 70 | | /// <summary> |
| | | 71 | | /// Internal compression engine constant |
| | | 72 | | /// </summary> |
| | | 73 | | public const int HASH_SIZE = 1 << HASH_BITS; |
| | | 74 | | |
| | | 75 | | /// <summary> |
| | | 76 | | /// Internal compression engine constant |
| | | 77 | | /// </summary> |
| | | 78 | | public const int HASH_MASK = HASH_SIZE - 1; |
| | | 79 | | |
| | | 80 | | /// <summary> |
| | | 81 | | /// Internal compression engine constant |
| | | 82 | | /// </summary> |
| | | 83 | | public const int HASH_SHIFT = (HASH_BITS + MIN_MATCH - 1) / MIN_MATCH; |
| | | 84 | | |
| | | 85 | | /// <summary> |
| | | 86 | | /// Internal compression engine constant |
| | | 87 | | /// </summary> |
| | | 88 | | public const int MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1; |
| | | 89 | | |
| | | 90 | | /// <summary> |
| | | 91 | | /// Internal compression engine constant |
| | | 92 | | /// </summary> |
| | | 93 | | public const int MAX_DIST = WSIZE - MIN_LOOKAHEAD; |
| | | 94 | | |
| | | 95 | | /// <summary> |
| | | 96 | | /// Internal compression engine constant |
| | | 97 | | /// </summary> |
| | | 98 | | public const int PENDING_BUF_SIZE = 1 << (DEFAULT_MEM_LEVEL + 8); |
| | | 99 | | |
| | | 100 | | /// <summary> |
| | | 101 | | /// Internal compression engine constant |
| | | 102 | | /// </summary> |
| | 1 | 103 | | public static int MAX_BLOCK_SIZE = Math.Min(65535, PENDING_BUF_SIZE - 5); |
| | | 104 | | |
| | | 105 | | /// <summary> |
| | | 106 | | /// Internal compression engine constant |
| | | 107 | | /// </summary> |
| | | 108 | | public const int DEFLATE_STORED = 0; |
| | | 109 | | |
| | | 110 | | /// <summary> |
| | | 111 | | /// Internal compression engine constant |
| | | 112 | | /// </summary> |
| | | 113 | | public const int DEFLATE_FAST = 1; |
| | | 114 | | |
| | | 115 | | /// <summary> |
| | | 116 | | /// Internal compression engine constant |
| | | 117 | | /// </summary> |
| | | 118 | | public const int DEFLATE_SLOW = 2; |
| | | 119 | | |
| | | 120 | | /// <summary> |
| | | 121 | | /// Internal compression engine constant |
| | | 122 | | /// </summary> |
| | 1 | 123 | | public static int[] GOOD_LENGTH = { 0, 4, 4, 4, 4, 8, 8, 8, 32, 32 }; |
| | | 124 | | |
| | | 125 | | /// <summary> |
| | | 126 | | /// Internal compression engine constant |
| | | 127 | | /// </summary> |
| | 1 | 128 | | public static int[] MAX_LAZY = { 0, 4, 5, 6, 4, 16, 16, 32, 128, 258 }; |
| | | 129 | | |
| | | 130 | | /// <summary> |
| | | 131 | | /// Internal compression engine constant |
| | | 132 | | /// </summary> |
| | 1 | 133 | | public static int[] NICE_LENGTH = { 0, 8, 16, 32, 16, 32, 128, 128, 258, 258 }; |
| | | 134 | | |
| | | 135 | | /// <summary> |
| | | 136 | | /// Internal compression engine constant |
| | | 137 | | /// </summary> |
| | 1 | 138 | | public static int[] MAX_CHAIN = { 0, 4, 8, 32, 16, 32, 128, 256, 1024, 4096 }; |
| | | 139 | | |
| | | 140 | | /// <summary> |
| | | 141 | | /// Internal compression engine constant |
| | | 142 | | /// </summary> |
| | 1 | 143 | | public static int[] COMPR_FUNC = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2 }; |
| | | 144 | | |
| | | 145 | | } |
| | | 146 | | } |