| 1: | // ZipConstants.cs | |
| 2: | // Copyright (C) 2001 Mike Krueger | |
| 3: | // | |
| 4: | // This file was translated from java, it was part of the GNU Classpath | |
| 5: | // Copyright (C) 2001 Free Software Foundation, Inc. | |
| 6: | // | |
| 7: | // This program is free software; you can redistribute it and/or | |
| 8: | // modify it under the terms of the GNU General Public License | |
| 9: | // as published by the Free Software Foundation; either version 2 | |
| 10: | // of the License, or (at your option) any later version. | |
| 11: | // | |
| 12: | // This program is distributed in the hope that it will be useful, | |
| 13: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15: | // GNU General Public License for more details. | |
| 16: | // | |
| 17: | // You should have received a copy of the GNU General Public License | |
| 18: | // along with this program; if not, write to the Free Software | |
| 19: | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 20: | // | |
| 21: | // Linking this library statically or dynamically with other modules is | |
| 22: | // making a combined work based on this library. Thus, the terms and | |
| 23: | // conditions of the GNU General Public License cover the whole | |
| 24: | // combination. | |
| 25: | // | |
| 26: | // As a special exception, the copyright holders of this library give you | |
| 27: | // permission to link this library with independent modules to produce an | |
| 28: | // executable, regardless of the license terms of these independent | |
| 29: | // modules, and to copy and distribute the resulting executable under | |
| 30: | // terms of your choice, provided that you also meet, for each linked | |
| 31: | // independent module, the terms and conditions of the license of that | |
| 32: | // module. An independent module is a module which is not derived from | |
| 33: | // or based on this library. If you modify this library, you may extend | |
| 34: | // this exception to your version of the library, but you are not | |
| 35: | // obligated to do so. If you do not wish to do so, delete this | |
| 36: | // exception statement from your version. | |
| 37: | ||
| 38: | using System.Text; | |
| 39: | ||
| 40: | namespace ICSharpCode.SharpZipLib.Zip { | |
| 41: | ||
| 42: | /// <summary> | |
| 43: | /// This class contains constants used for zip. | |
| 44: | /// </summary> | |
| 45: | public sealed class ZipConstants | |
| 46: | { | |
| 47: | /* The local file header */ | |
| 48: | public const int LOCHDR = 30; | |
| 49: | public const int LOCSIG = 'P' | ('K' << 8) | (3 << 16) | (4 << 24); | |
| 50: | ||
| 51: | public const int LOCVER = 4; | |
| 52: | public const int LOCFLG = 6; | |
| 53: | public const int LOCHOW = 8; | |
| 54: | public const int LOCTIM = 10; | |
| 55: | public const int LOCCRC = 14; | |
| 56: | public const int LOCSIZ = 18; | |
| 57: | public const int LOCLEN = 22; | |
| 58: | public const int LOCNAM = 26; | |
| 59: | public const int LOCEXT = 28; | |
| 60: | ||
| 61: | /* The Data descriptor */ | |
| 62: | public const int EXTSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24); | |
| 63: | public const int EXTHDR = 16; | |
| 64: | ||
| 65: | public const int EXTCRC = 4; | |
| 66: | public const int EXTSIZ = 8; | |
| 67: | public const int EXTLEN = 12; | |
| 68: | ||
| 69: | /* The central directory file header */ | |
| 70: | public const int CENSIG = 'P' | ('K' << 8) | (1 << 16) | (2 << 24); | |
| 71: | ||
| 72: | /* The central directory file header for 64bit ZIP*/ | |
| 73: | public const int CENSIG64 = 0x06064b50; | |
| 74: | ||
| 75: | public const int CENHDR = 46; | |
| 76: | ||
| 77: | public const int CENVEM = 4; | |
| 78: | public const int CENVER = 6; | |
| 79: | public const int CENFLG = 8; | |
| 80: | public const int CENHOW = 10; | |
| 81: | public const int CENTIM = 12; | |
| 82: | public const int CENCRC = 16; | |
| 83: | public const int CENSIZ = 20; | |
| 84: | public const int CENLEN = 24; | |
| 85: | public const int CENNAM = 28; | |
| 86: | public const int CENEXT = 30; | |
| 87: | public const int CENCOM = 32; | |
| 88: | public const int CENDSK = 34; | |
| 89: | public const int CENATT = 36; | |
| 90: | public const int CENATX = 38; | |
| 91: | public const int CENOFF = 42; | |
| 92: | ||
| 93: | /* The entries in the end of central directory */ | |
| 94: | public const int ENDSIG = 'P' | ('K' << 8) | (5 << 16) | (6 << 24); | |
| 95: | public const int ENDHDR = 22; | |
| 96: | ||
| 97: | /* The following two fields are missing in SUN JDK */ | |
| 98: | public const int ENDNRD = 4; | |
| 99: | public const int ENDDCD = 6; | |
| 100: | ||
| 101: | public const int ENDSUB = 8; | |
| 102: | public const int ENDTOT = 10; | |
| 103: | public const int ENDSIZ = 12; | |
| 104: | public const int ENDOFF = 16; | |
| 105: | public const int ENDCOM = 20; | |
| 106: | ||
| 107: | /* Using the codepage 1252 doesn't solve the 8bit ASCII problem :/ | |
| 108: | any help would be appreciated. | |
| 109: | ||
| 110: | // get encoding for latin characters (like ö, ü, ß or ô) | |
| 111: | static Encoding ecp1252 = Encoding.GetEncoding(1252); | |
| 112: | */ | |
| 113: | public static string ConvertToString(byte[] data) | |
| 114: | { | |
| 115: | ||
| 116: | return Encoding.ASCII.GetString(data); | |
| 117: | } | |
| 118: | ||
| 119: | public static byte[] ConvertToArray(string str) | |
| 120: | { | |
| 121: | return Encoding.ASCII.GetBytes(str); | |
| 122: | } | |
| 123: | } | |
| 124: | } |
This page was automatically generated by SharpDevelop.