您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->X3BLOG 单用户1.0 build80707(ACCESS)源代码>>SharpZipLib/Zip/ZipConstants.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:X3BLOG 单用户1.0 build80707(ACCESS)源代码


当前文件路径:x3blogAccessBuild80707/SharpZipLib/Zip/ZipConstants.cs 文件类型
普通视图
		            
1// ZipConstants.cs 2// 3// Copyright (C) 2001 Mike Krueger 4// Copyright (C) 2004 John Reilly 5// 6// This file was translated from java, it was part of the GNU Classpath 7// Copyright (C) 2001 Free Software Foundation, Inc. 8// 9// This program is free software; you can redistribute it and/or 10// modify it under the terms of the GNU General Public License 11// as published by the Free Software Foundation; either version 2 12// of the License, or (at your option) any later version. 13// 14// This program is distributed in the hope that it will be useful, 15// but WITHOUT ANY WARRANTY; without even the implied warranty of 16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17// GNU General Public License for more details. 18// 19// You should have received a copy of the GNU General Public License 20// along with this program; if not, write to the Free Software 21// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22// 23// Linking this library statically or dynamically with other modules is 24// making a combined work based on this library. Thus, the terms and 25// conditions of the GNU General Public License cover the whole 26// combination. 27// 28// As a special exception, the copyright holders of this library give you 29// permission to link this library with independent modules to produce an 30// executable, regardless of the license terms of these independent 31// modules, and to copy and distribute the resulting executable under 32// terms of your choice, provided that you also meet, for each linked 33// independent module, the terms and conditions of the license of that 34// module. An independent module is a module which is not derived from 35// or based on this library. If you modify this library, you may extend 36// this exception to your version of the library, but you are not 37// obligated to do so. If you do not wish to do so, delete this 38// exception statement from your version. 39 40using System; 41using System.Text; 42 43namespace ICSharpCode.SharpZipLib.Zip 44{ 45 46 /// <summary> 47 /// The kind of compression used for an entry in an archive 48 /// </summary> 49 public enum CompressionMethod 50 { 51 /// <summary> 52 /// A direct copy of the file contents is held in the archive 53 /// </summary> 54 Stored = 0, 55 56 /// <summary> 57 /// Common Zip compression method using a sliding dictionary 58 /// of up to 32KB and secondary compression from Huffman/Shannon-Fano trees 59 /// </summary> 60 Deflated = 8, 61 62 /// <summary> 63 /// An extension to deflate with a 64KB window. Not supported by #Zip 64 /// </summary> 65 Deflate64 = 9, 66 67 /// <summary> 68 /// Not supported by #Zip 69 /// </summary> 70 BZip2 = 11, 71 72 /// <summary> 73 /// WinZip special for AES encryption, Not supported by #Zip 74 /// </summary> 75 WinZipAES = 99, 76 77 } 78 79 /// <summary> 80 /// Defines the contents of the general bit flags field for an archive entry. 81 /// </summary> 82 [Flags] 83 enum GeneralBitFlags : int 84 { 85 /// <summary> 86 /// If set indicates that the file is encrypted 87 /// </summary> 88 Encrypted = 0x0001, 89 /// <summary> 90 /// Two bits defining the compression method (only for Method 6 Imploding and 8,9 Deflating) 91 /// </summary> 92 Method = 0x0006, 93 /// <summary> 94 /// If set a trailing data desciptor is appended to the entry data 95 /// </summary> 96 Descriptor = 0x0008, 97 Reserved = 0x0010, 98 /// <summary> 99 /// If set indicates the file contains Pkzip compressed patched data. 100 /// </summary> 101 Patched = 0x0020, 102 /// <summary> 103 /// If set strong encryption has been used for this entry. 104 /// </summary> 105 StrongEncryption = 0x0040, 106 /// <summary> 107 /// Reserved by PKWare for enhanced compression. 108 /// </summary> 109 EnhancedCompress = 0x1000, 110 /// <summary> 111 /// If set indicates that values in the local header are masked to hide 112 /// their actual values. 113 /// </summary> 114 /// <remarks> 115 /// Used when encrypting ht ecentral directory contents. 116 /// </remarks> 117 HeaderMasked = 0x2000 118 } 119 120 /// <summary> 121 /// This class contains constants used for Zip format files 122 /// </summary> 123 public sealed class ZipConstants 124 { 125 /// <summary> 126 /// The version made by field for entries in the central header when created by this library 127 /// </summary> 128 /// <remarks> 129 /// This is also the Zip version for the library when comparing against the version required to extract 130 /// for an entry. See <see cref="ZipInputStream.CanDecompressEntry">ZipInputStream.CanDecompressEntry</see>. 131 /// </remarks> 132 public const int VERSION_MADE_BY = 20; 133 134 /// <summary> 135 /// The minimum version required to support strong encryption 136 /// </summary> 137 public const int VERSION_STRONG_ENCRYPTION = 50; 138 139 // The local entry header 140 141 /// <summary> 142 /// Size of local entry header (excluding variable length fields at end) 143 /// </summary> 144 public const int LOCHDR = 30; 145 146 /// <summary> 147 /// Signature for local entry header 148 /// </summary> 149 public const int LOCSIG = 'P' | ('K' << 8) | (3 << 16) | (4 << 24); 150 151 /// <summary> 152 /// Offset of version to extract in local entry header 153 /// </summary> 154 public const int LOCVER = 4; 155 156 /// <summary> 157 /// Offset of general purpose flags in local entry header 158 /// </summary> 159 public const int LOCFLG = 6; 160 161 /// <summary> 162 /// Offset of compression method in local entry header 163 /// </summary> 164 public const int LOCHOW = 8; 165 166 /// <summary> 167 /// Offset of last mod file time + date in local entry header 168 /// </summary> 169 public const int LOCTIM = 10; 170 171 /// <summary> 172 /// Offset of crc-32 in local entry header 173 /// </summary> 174 public const int LOCCRC = 14; 175 176 /// <summary> 177 /// Offset of compressed size in local entry header 178 /// </summary> 179 public const int LOCSIZ = 18; 180 181 /// <summary> 182 /// Offset of uncompressed size in local entry header 183 /// </summary> 184 public const int LOCLEN = 22; 185 186 /// <summary> 187 /// Offset of file name length in local entry header 188 /// </summary> 189 public const int LOCNAM = 26; 190 191 /// <summary> 192 /// Offset of extra field length in local entry header 193 /// </summary> 194 public const int LOCEXT = 28; 195 196 197 /// <summary> 198 /// Signature for spanning entry 199 /// </summary> 200 public const int SPANNINGSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24); 201 202 /// <summary> 203 /// Signature for temporary spanning entry 204 /// </summary> 205 public const int SPANTEMPSIG = 'P' | ('K' << 8) | ('0' << 16) | ('0' << 24); 206 207 /// <summary> 208 /// Signature for data descriptor 209 /// </summary> 210 /// <remarks> 211 /// This is only used where the length, Crc, or compressed size isnt known when the 212 /// entry is created and the output stream doesnt support seeking. 213 /// The local entry cannot be 'patched' with the correct values in this case 214 /// so the values are recorded after the data prefixed by this header, as well as in the central directory. 215 /// </remarks> 216 public const int EXTSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24); 217 218 /// <summary> 219 /// Size of data descriptor 220 /// </summary> 221 public const int EXTHDR = 16; 222 223 /// <summary> 224 /// Offset of crc-32 in data descriptor 225 /// </summary> 226 public const int EXTCRC = 4; 227 228 /// <summary> 229 /// Offset of compressed size in data descriptor 230 /// </summary> 231 public const int EXTSIZ = 8; 232 233 /// <summary> 234 /// Offset of uncompressed length in data descriptor 235 /// </summary> 236 public const int EXTLEN = 12; 237 238 239 /// <summary> 240 /// Signature for central header 241 /// </summary> 242 public const int CENSIG = 'P' | ('K' << 8) | (1 << 16) | (2 << 24); 243 244 /// <summary> 245 /// Size of central header entry 246 /// </summary> 247 public const int CENHDR = 46; 248 249 /// <summary> 250 /// Offset of version made by in central file header 251 /// </summary> 252 public const int CENVEM = 4; 253 254 /// <summary> 255 /// Offset of version needed to extract in central file header 256 /// </summary> 257 public const int CENVER = 6; 258 259 /// <summary> 260 /// Offset of general purpose bit flag in central file header 261 /// </summary> 262 public const int CENFLG = 8; 263 264