import .6
[mono.git] / mcs / class / ICSharpCode.SharpZipLib / ICSharpCode.SharpZipLib / Zip / ZipConstants.cs
index 7bad3d66ea333ecb56af491b696cd389d465fac8..8a56d71d7083a8d45d498f3078f9301f9485311a 100644 (file)
@@ -37,7 +37,8 @@
 \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
@@ -58,6 +59,9 @@ namespace ICSharpCode.SharpZipLib.Zip {
                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
@@ -70,7 +74,7 @@ namespace ICSharpCode.SharpZipLib.Zip {
                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
@@ -94,6 +98,9 @@ namespace ICSharpCode.SharpZipLib.Zip {
                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
@@ -104,21 +111,36 @@ namespace ICSharpCode.SharpZipLib.Zip {
                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