\r
using System.Text;\r
\r
-namespace ICSharpCode.SharpZipLib.Zip {\r
+namespace ICSharpCode.SharpZipLib.Zip \r
+{\r
\r
/// <summary>\r
/// This class contains constants used for zip.\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
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 = 0x06064b50;\r
+ public const int CENSIG64 = 'P' | ('K' << 8) | (6 << 16) | (6 << 24);\r
\r
public const int CENHDR = 46;\r
\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
public const int ENDOFF = 16;\r
public const int ENDCOM = 20;\r
\r
- /* Using the codepage 1252 doesn't solve the 8bit ASCII problem :/\r
- any help would be appreciated.\r
- \r
- // get encoding for latin characters (like ö, ü, ß or ô)\r
- static Encoding ecp1252 = Encoding.GetEncoding(1252);\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
- \r
- return Encoding.ASCII.GetString(data);\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