Mes documents/Visual Studio 2005/Projects/TES4ModTranslator/TES4ModTranslator/Zip/ZipConstants.cs

Go to the documentation of this file.
00001 // ZipConstants.cs
00002 //
00003 // Copyright (C) 2001 Mike Krueger
00004 // Copyright (C) 2004 John Reilly
00005 //
00006 // This file was translated from java, it was part of the GNU Classpath
00007 // Copyright (C) 2001 Free Software Foundation, Inc.
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with this program; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 //
00023 // Linking this library statically or dynamically with other modules is
00024 // making a combined work based on this library.  Thus, the terms and
00025 // conditions of the GNU General Public License cover the whole
00026 // combination.
00027 // 
00028 // As a special exception, the copyright holders of this library give you
00029 // permission to link this library with independent modules to produce an
00030 // executable, regardless of the license terms of these independent
00031 // modules, and to copy and distribute the resulting executable under
00032 // terms of your choice, provided that you also meet, for each linked
00033 // independent module, the terms and conditions of the license of that
00034 // module.  An independent module is a module which is not derived from
00035 // or based on this library.  If you modify this library, you may extend
00036 // this exception to your version of the library, but you are not
00037 // obligated to do so.  If you do not wish to do so, delete this
00038 // exception statement from your version.
00039 
00040 using System;
00041 using System.Text;
00042 
00043 namespace ICSharpCode.SharpZipLib.Zip 
00044 {
00045         
00049         public enum CompressionMethod
00050         {
00054                 Stored     = 0,
00055                 
00060                 Deflated   = 8,
00061                 
00065                 Deflate64  = 9,
00066                 
00070                 BZip2      = 11,
00071                 
00075                 WinZipAES  = 99,
00076                 
00077         }
00078         
00082         [Flags]
00083         enum GeneralBitFlags : int
00084         {
00088                 Encrypted         = 0x0001,
00092                 Method            = 0x0006,
00096                 Descriptor        = 0x0008,
00097                 Reserved          = 0x0010,
00101                 Patched           = 0x0020,
00105                 StrongEncryption  = 0x0040,
00109                 EnhancedCompress  = 0x1000,
00117                 HeaderMasked      = 0x2000
00118         }
00119         
00123         public sealed class ZipConstants
00124         {
00132                 public const int VERSION_MADE_BY = 20;
00133                 
00137                 public const int VERSION_STRONG_ENCRYPTION = 50;
00138                 
00139                 // The local entry header
00140                 
00144                 public const int LOCHDR = 30;
00145                 
00149                 public const int LOCSIG = 'P' | ('K' << 8) | (3 << 16) | (4 << 24);
00150 
00154                 public const int LOCVER =  4;
00155                 
00159                 public const int LOCFLG =  6;
00160                 
00164                 public const int LOCHOW =  8;
00165                 
00169                 public const int LOCTIM = 10;
00170                 
00174                 public const int LOCCRC = 14;
00175                 
00179                 public const int LOCSIZ = 18;
00180                 
00184                 public const int LOCLEN = 22;
00185                 
00189                 public const int LOCNAM = 26;
00190                 
00194                 public const int LOCEXT = 28;
00195 
00196                 
00200                 public const int SPANNINGSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24);
00201                 
00205                 public const int SPANTEMPSIG = 'P' | ('K' << 8) | ('0' << 16) | ('0' << 24);
00206                 
00216                 public const int EXTSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24);
00217                 
00221                 public const int EXTHDR = 16;
00222                 
00226                 public const int EXTCRC =  4;
00227                 
00231                 public const int EXTSIZ =  8;
00232                 
00236                 public const int EXTLEN = 12;
00237                 
00238                 
00242                 public const int CENSIG = 'P' | ('K' << 8) | (1 << 16) | (2 << 24);
00243                 
00247                 public const int CENHDR = 46;
00248                 
00252                 public const int CENVEM =  4;
00253                 
00257                 public const int CENVER =  6;
00258                 
00262                 public const int CENFLG =  8;
00263                 
00267                 public const int CENHOW = 10;
00268                 
00272                 public const int CENTIM = 12;
00273                 
00277                 public const int CENCRC = 16;
00278                 
00282                 public const int CENSIZ = 20;
00283                 
00287                 public const int CENLEN = 24;
00288                 
00292                 public const int CENNAM = 28;
00293                 
00297                 public const int CENEXT = 30;
00298                 
00302                 public const int CENCOM = 32;
00303                 
00307                 public const int CENDSK = 34;
00308                 
00312                 public const int CENATT = 36;
00313                 
00317                 public const int CENATX = 38;
00318                 
00322                 public const int CENOFF = 42;
00323                 
00324                 
00328                 public const int CENSIG64 = 'P' | ('K' << 8) | (6 << 16) | (6 << 24);
00329                 
00330                 
00331                 
00335                 public const int CENDIGITALSIG = 'P' | ('K' << 8) | (5 << 16) | (5 << 24);
00336                 
00337                 
00338                 // The entries at the end of central directory
00339                 
00343                 public const int ENDSIG = 'P' | ('K' << 8) | (5 << 16) | (6 << 24);
00344                 
00348                 public const int ENDHDR = 22;
00349                 
00350                 // The following two fields are missing in SUN JDK
00351                 
00355                 public const int ENDNRD =  4;
00356                 
00360                 public const int ENDDCD =  6;
00361                 
00365                 public const int ENDSUB =  8;
00366                 
00370                 public const int ENDTOT = 10;
00371                 
00375                 public const int ENDSIZ = 12;
00376                 
00380                 public const int ENDOFF = 16;
00381                 
00385                 public const int ENDCOM = 20;
00386                 
00390                 public const int CRYPTO_HEADER_SIZE = 12;
00391 
00392                 
00393 #if !COMPACT_FRAMEWORK
00394 
00395                 static int defaultCodePage = 0;
00396                 
00404                 public static int DefaultCodePage {
00405                         get {
00406                                 return defaultCodePage; 
00407                         }
00408                         set {
00409                                 defaultCodePage = value; 
00410                         }
00411                 }
00412 #endif
00413 
00426                 public static string ConvertToString(byte[] data, int length)
00427                 {
00428 #if COMPACT_FRAMEWORK
00429                         return Encoding.ASCII.GetString(data, 0, length);
00430 #else
00431                         return Encoding.GetEncoding(DefaultCodePage).GetString(data, 0, length);
00432 #endif
00433                 }
00434         
00444                 public static string ConvertToString(byte[] data)
00445                 {
00446                         return ConvertToString(data, data.Length);
00447                 }
00448 
00456                 public static byte[] ConvertToArray(string str)
00457                 {
00458 #if COMPACT_FRAMEWORK
00459                         return Encoding.ASCII.GetBytes(str);
00460 #else
00461                         return Encoding.GetEncoding(DefaultCodePage).GetBytes(str);
00462 #endif
00463                 }
00464         }
00465 }

Generated on Fri Jun 23 21:50:05 2006 for OblivionModTranslator by  doxygen 1.4.6-NO