+++ /dev/null
-// ZipConstants.cs\r
-// Copyright (C) 2001 Mike Krueger\r
-//\r
-// This file was translated from java, it was part of the GNU Classpath\r
-// Copyright (C) 2001 Free Software Foundation, Inc.\r
-//\r
-// This program is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU General Public License\r
-// as published by the Free Software Foundation; either version 2\r
-// of the License, or (at your option) any later version.\r
-//\r
-// This program is distributed in the hope that it will be useful,\r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-// GNU General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, write to the Free Software\r
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
-//\r
-// Linking this library statically or dynamically with other modules is\r
-// making a combined work based on this library. Thus, the terms and\r
-// conditions of the GNU General Public License cover the whole\r
-// combination.\r
-// \r
-// As a special exception, the copyright holders of this library give you\r
-// permission to link this library with independent modules to produce an\r
-// executable, regardless of the license terms of these independent\r
-// modules, and to copy and distribute the resulting executable under\r
-// terms of your choice, provided that you also meet, for each linked\r
-// independent module, the terms and conditions of the license of that\r
-// module. An independent module is a module which is not derived from\r
-// or based on this library. If you modify this library, you may extend\r
-// this exception to your version of the library, but you are not\r
-// obligated to do so. If you do not wish to do so, delete this\r
-// exception statement from your version.\r
-\r
-using System.Text;\r
-\r
-namespace ICSharpCode.SharpZipLib.Zip \r
-{\r
- \r
- /// <summary>\r
- /// This class contains constants used for zip.\r
- /// </summary>\r
- public sealed class ZipConstants\r
- {\r
- /* The local file header */\r
- public const int LOCHDR = 30;\r
- public const int LOCSIG = 'P' | ('K' << 8) | (3 << 16) | (4 << 24);\r
- \r
- public const int LOCVER = 4;\r
- public const int LOCFLG = 6;\r
- public const int LOCHOW = 8;\r
- public const int LOCTIM = 10;\r
- public const int LOCCRC = 14;\r
- public const int LOCSIZ = 18;\r
- public const int LOCLEN = 22;\r
- public const int LOCNAM = 26;\r
- public const int LOCEXT = 28;\r
- \r
- public const int SPANNINGSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24);\r
- public const int SPANTEMPSIG = 'P' | ('K' << 8) | ('0' << 16) | ('0' << 24);\r
- \r
- /* The Data descriptor */\r
- public const int EXTSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24);\r
- public const int EXTHDR = 16;\r
- \r
- public const int EXTCRC = 4;\r
- public const int EXTSIZ = 8;\r
- public const int EXTLEN = 12;\r
- \r
- /* The central directory file header */\r
- public const int CENSIG = 'P' | ('K' << 8) | (1 << 16) | (2 << 24);\r
- \r
- /* The central directory file header for 64bit ZIP*/\r
- public const int CENSIG64 = 'P' | ('K' << 8) | (6 << 16) | (6 << 24);\r
- \r
- public const int CENHDR = 46;\r
- \r
- public const int CENVEM = 4;\r
- public const int CENVER = 6;\r
- public const int CENFLG = 8;\r
- public const int CENHOW = 10;\r
- public const int CENTIM = 12;\r
- public const int CENCRC = 16;\r
- public const int CENSIZ = 20;\r
- public const int CENLEN = 24;\r
- public const int CENNAM = 28;\r
- public const int CENEXT = 30;\r
- public const int CENCOM = 32;\r
- public const int CENDSK = 34;\r
- public const int CENATT = 36;\r
- public const int CENATX = 38;\r
- public const int CENOFF = 42;\r
- \r
- /* The entries in the end of central directory */\r
- public const int ENDSIG = 'P' | ('K' << 8) | (5 << 16) | (6 << 24);\r
- public const int ENDHDR = 22;\r
- \r
- public const int HDRDIGITALSIG = 'P' | ('K' << 8) | (5 << 16) | (5 << 24);\r
- public const int CENDIGITALSIG = 'P' | ('K' << 8) | (5 << 16) | (5 << 24);\r
- \r
- /* The following two fields are missing in SUN JDK */\r
- public const int ENDNRD = 4;\r
- public const int ENDDCD = 6;\r
- \r
- public const int ENDSUB = 8;\r
- public const int ENDTOT = 10;\r
- public const int ENDSIZ = 12;\r
- public const int ENDOFF = 16;\r
- public const int ENDCOM = 20;\r
- \r
- \r
- static int defaultCodePage = 0; // 0 gives default code page, set it to whatever you like or alternatively alter it via property at runtime for more flexibility\r
- // Some care for compatability purposes is required as you can specify unicode code pages here.... if this way of working seems ok\r
- // then some protection may be added to make the interface a bit more robust perhaps.\r
- \r
- public static int DefaultCodePage {\r
- get {\r
- return defaultCodePage; \r
- }\r
- set {\r
- defaultCodePage = value; \r
- }\r
- }\r
- \r
- public static string ConvertToString(byte[] data)\r
- {\r
-#if COMACT_FRAMEWORK \r
- return Encoding.ASCII.GetString(data,0, data.Length);\r
-#else\r
- return Encoding.GetEncoding(DefaultCodePage).GetString(data, 0, data.Length);\r
-#endif\r
- }\r
- \r
- public static byte[] ConvertToArray(string str)\r
- {\r
-#if COMACT_FRAMEWORK \r
- return Encoding.ASCII.GetBytes(str);\r
-#else\r
- return Encoding.GetEncoding(DefaultCodePage).GetBytes(str);\r
-#endif\r
- }\r
- }\r
-}\r