Permalink
Browse files

initial commit

Signed-off-by: Dominik Pich <Dominik@pich.info>
  • Loading branch information...
1 parent ef137db commit ee9f909fd61c0f4528197c55262cba40bde80a21 @Daij-Djan committed Aug 8, 2012
Showing with 11,842 additions and 3 deletions.
  1. BIN .DS_Store
  2. BIN DDMinizip/.DS_Store
  3. +36 −0 DDMinizip/LICENSE.rtf
  4. +51 −0 DDMinizip/README.md
  5. +132 −0 DDMinizip/other/crypt.h
  6. +177 −0 DDMinizip/other/ioapi.c
  7. +75 −0 DDMinizip/other/ioapi.h
  8. +282 −0 DDMinizip/other/mztools.c
  9. +31 −0 DDMinizip/other/mztools.h
  10. +1,599 −0 DDMinizip/other/unzip.c
  11. +354 −0 DDMinizip/other/unzip.h
  12. +1,220 −0 DDMinizip/other/zip.c
  13. +235 −0 DDMinizip/other/zip.h
  14. +32 −0 DDMinizip/src/DDZipReader.h
  15. +209 −0 DDMinizip/src/DDZipReader.m
  16. +19 −0 DDMinizip/src/DDZipWriter.h
  17. +92 −0 DDMinizip/src/DDZipWriter.m
  18. +38 −0 DDMinizip/src/DDZippedFileInfo.h
  19. +70 −0 DDMinizip/src/DDZippedFileInfo.m
  20. BIN Icon.png
  21. +22 −0 LICENSE.txt
  22. +858 −0 MountainNotifier.xcodeproj/project.pbxproj
  23. BIN MountainNotifier/.DS_Store
  24. +27 −0 MountainNotifier/DDEmbeddedDataReader.h
  25. +416 −0 MountainNotifier/DDEmbeddedDataReader.m
  26. +8 −0 MountainNotifier/Info.plist
  27. +241 −0 MountainNotifier/main.m
  28. BIN MountainNotifierTemplate/.DS_Store
  29. +12 −0 MountainNotifierTemplate/DDAppDelegate.h
  30. +96 −0 MountainNotifierTemplate/DDAppDelegate.m
  31. BIN MountainNotifierTemplate/Icon.icns
  32. +38 −0 MountainNotifierTemplate/Info.plist
  33. +7 −0 MountainNotifierTemplate/Prefix.pch
  34. +29 −0 MountainNotifierTemplate/en.lproj/Credits.rtf
  35. +2 −0 MountainNotifierTemplate/en.lproj/InfoPlist.strings
  36. +122 −0 MountainNotifierTemplate/en.lproj/MainMenu.xib
  37. +14 −0 MountainNotifierTemplate/main.m
  38. +10 −0 MountainNotifierTemplate/zipHelper.sh
  39. BIN MountianGrowlPlugin/.DS_Store
  40. +17 −0 MountianGrowlPlugin/GrowlMountainNotifierDisplay.h
  41. +101 −0 MountianGrowlPlugin/GrowlMountainNotifierDisplay.m
  42. +14 −0 MountianGrowlPlugin/GrowlMountainNotifierPrefs.h
  43. +21 −0 MountianGrowlPlugin/GrowlMountainNotifierPrefs.m
  44. +30 −0 MountianGrowlPlugin/MountianGrowlPlugin-Info.plist
  45. +9 −0 MountianGrowlPlugin/MountianGrowlPlugin-Prefix.pch
  46. +279 −0 MountianGrowlPlugin/cs.lproj/GrowlMountainNotifierPrefs.xib
  47. +279 −0 MountianGrowlPlugin/da.lproj/GrowlMountainNotifierPrefs.xib
  48. +279 −0 MountianGrowlPlugin/de.lproj/GrowlMountainNotifierPrefs.xib
  49. +279 −0 MountianGrowlPlugin/el.lproj/GrowlMountainNotifierPrefs.xib
  50. +279 −0 MountianGrowlPlugin/en.lproj/GrowlMountainNotifierPrefs.xib
  51. +279 −0 MountianGrowlPlugin/es.lproj/GrowlMountainNotifierPrefs.xib
  52. +348 −0 MountianGrowlPlugin/fr.lproj/GrowlMountainNotifierPrefs.xib
  53. BIN MountianGrowlPlugin/growl-1.3-headers/.DS_Store
  54. +341 −0 MountianGrowlPlugin/growl-1.3-headers/GrowlDefines.h
  55. +416 −0 MountianGrowlPlugin/growl-1.3-headers/GrowlDefinesInternal.h
  56. +67 −0 MountianGrowlPlugin/growl-1.3-headers/GrowlDisplayPlugin.h
  57. +79 −0 MountianGrowlPlugin/growl-1.3-headers/GrowlNotification.h
  58. +103 −0 MountianGrowlPlugin/growl-1.3-headers/GrowlPlugin.h
  59. +28 −0 MountianGrowlPlugin/growl-1.3-headers/NSStringAdditions.h
  60. +279 −0 MountianGrowlPlugin/it.lproj/GrowlMountainNotifierPrefs.xib
  61. +279 −0 MountianGrowlPlugin/ja.lproj/GrowlMountainNotifierPrefs.xib
  62. +280 −0 MountianGrowlPlugin/ko.lproj/GrowlMountainNotifierPrefs.xib
  63. +279 −0 MountianGrowlPlugin/lv.lproj/GrowlMountainNotifierPrefs.xib
  64. +279 −0 MountianGrowlPlugin/nb.lproj/GrowlMountainNotifierPrefs.xib
  65. +279 −0 MountianGrowlPlugin/nl.lproj/GrowlMountainNotifierPrefs.xib
  66. +348 −0 MountianGrowlPlugin/pt-PT.lproj/GrowlMountainNotifierPrefs.xib
  67. +17 −3 README.md
  68. BIN __DIST__/.DS_Store
  69. BIN __DIST__/MountainNotifier
  70. BIN __DIST__/MountianGrowlPlugin.growlView.zip
View
BIN .DS_Store
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1,36 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320
+{\fonttbl\f0\fmodern\fcharset0 Courier;\f1\froman\fcharset0 Times-Roman;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720
+
+\f0\fs26 \cf0 /* zlib.h -- interface of the 'zlib' general purpose compression library\
+ version 1.2.7, May 2nd, 2012\
+\
+ Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler\
+\
+ This software is provided 'as-is', without any express or implied\
+ warranty. In no event will the authors be held liable for any damages\
+ arising from the use of this software.\
+\
+ Permission is granted to anyone to use this software for any purpose,\
+ including commercial applications, and to alter it and redistribute it\
+ freely, subject to the following restrictions:\
+\
+ 1. The origin of this software must not be misrepresented; you must not\
+ claim that you wrote the original software. If you use this software\
+ in a product, an acknowledgment in the product documentation would be\
+ appreciated but is not required.\
+ 2. Altered source versions must be plainly marked as such, and must not be\
+ misrepresented as being the original software.\
+ 3. This notice may not be removed or altered from any source distribution.\
+\
+ Jean-loup Gailly Mark Adler\
+ jloup@gzip.org madler@alumni.caltech.edu\
+\
+*/\
+\pard\pardeftab720
+
+\f1\fs32 \cf0 \
+}
View
@@ -0,0 +1,51 @@
+#About
+this project providers a wrapper around libz for iOS5 and OSX.
+
+Based on code from acsolu@gmail.com for iOS I expanded and modified it to work as a 'drop-in' static library for OSX 10.7 and IOS 5. You have to link against libzib dylib still.
+
+I split the code into a Writer and a Reader, added a proper Delegate that gets asked about what to extract and and made the original framework compile as a separate lib and use ARC.
+
+#example usage
+there is a simple CLI tool included, that shows the usage of DDZipWriter and DDZipReader.
+
+apart from that, below you find info on how to use the classes in your app as well as info on the available unzip delegate that enables you to determine what files to extract
+
+##zip
+ DDZipWriter *w = [[DDZipWriter alloc] init];
+ [w newZipFile:@"testfile.zip"];
+ for(NSString *file in files) {
+ BOOL res = [w addFileToZip:file newname:[NSString stringWithFormat:@"modified_%@", file]];
+
+ if(res) {
+ NSString *n = [file lastPathComponent];
+ NSLog(@"added file to zip: %@", n);
+ }
+ }
+ [w closeZipFile];
+
+##unzip
+ DDZipReader *z = [[DDZipReader alloc] init];
+ z.delegate = self;
+ for(NSString *zip in zips) {
+ [z openZipFile:zip];
+ BOOL res = [z unzipFileTo:path flattenStructure:NO];
+ [z closeZipFile];
+
+ if(res) {
+ NSString *n = [zip lastPathComponent];
+ NSLog(@"Extracted zip file: %@", n);
+ }
+ }
+ ...
+ - (BOOL)zipArchive:(DDZipReader *)zip shouldExtractFile:(NSString *)file {
+ return ([file rangeOfString:@"__MACOSX"].location==NSNotFound);
+ }
+
+ - (BOOL)zipArchive:(DDZipReader *)zip shouldOverwriteFile:(NSString *)file {
+ id fileDate = [[[NSFileManager defaultManager] attributesOfItemAtPath:file error:nil] fileModificationDate];
+ id fileInfoDate = fileInfo.date;
+
+ return ([fileDate compare:fileInfoDate]==NSOrderedAscending);
+ }
+
+#DDMinizip is available under the original libz license
View
@@ -0,0 +1,132 @@
+/* crypt.h -- base code for crypt/uncrypt ZIPfile
+
+
+ Version 1.01e, February 12th, 2005
+
+ Copyright (C) 1998-2005 Gilles Vollant
+
+ This code is a modified version of crypting code in Infozip distribution
+
+ The encryption/decryption parts of this source code (as opposed to the
+ non-echoing password parts) were originally written in Europe. The
+ whole source package can be freely distributed, including from the USA.
+ (Prior to January 2000, re-export from the US was a violation of US law.)
+
+ This encryption code is a direct transcription of the algorithm from
+ Roger Schlafly, described by Phil Katz in the file appnote.txt. This
+ file (appnote.txt) is distributed with the PKZIP program (even in the
+ version without encryption capabilities).
+
+ If you don't need crypting in your application, just define symbols
+ NOCRYPT and NOUNCRYPT.
+
+ This code support the "Traditional PKWARE Encryption".
+
+ The new AES encryption added on Zip format by Winzip (see the page
+ http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
+ Encryption is not supported.
+*/
+
+#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
+
+/***********************************************************************
+ * Return the next byte in the pseudo-random sequence
+ */
+static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
+{
+ unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
+ * unpredictable manner on 16-bit systems; not a problem
+ * with any known compiler so far, though */
+
+ temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
+ return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
+}
+
+/***********************************************************************
+ * Update the encryption keys with the next byte of plain text
+ */
+static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
+{
+ (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
+ (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
+ (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
+ {
+ register int keyshift = (int)((*(pkeys+1)) >> 24);
+ (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
+ }
+ return c;
+}
+
+
+/***********************************************************************
+ * Initialize the encryption keys and the random header according to
+ * the given password.
+ */
+static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
+{
+ *(pkeys+0) = 305419896L;
+ *(pkeys+1) = 591751049L;
+ *(pkeys+2) = 878082192L;
+ while (*passwd != '\0') {
+ update_keys(pkeys,pcrc_32_tab,(int)*passwd);
+ passwd++;
+ }
+}
+
+#define zdecode(pkeys,pcrc_32_tab,c) \
+ (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
+
+#define zencode(pkeys,pcrc_32_tab,c,t) \
+ (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
+
+#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
+
+#define RAND_HEAD_LEN 12
+ /* "last resort" source for second part of crypt seed pattern */
+# ifndef ZCR_SEED2
+# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
+# endif
+
+static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
+ const char *passwd; /* password string */
+ unsigned char *buf; /* where to write header */
+ int bufSize;
+ unsigned long* pkeys;
+ const unsigned long* pcrc_32_tab;
+ unsigned long crcForCrypting;
+{
+ int n; /* index in random header */
+ int t; /* temporary */
+ int c; /* random byte */
+ unsigned char header[RAND_HEAD_LEN-2]; /* random header */
+ static unsigned calls = 0; /* ensure different random header each time */
+
+ if (bufSize<RAND_HEAD_LEN)
+ return 0;
+
+ /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
+ * output of rand() to get less predictability, since rand() is
+ * often poorly implemented.
+ */
+ if (++calls == 1)
+ {
+ srand((unsigned)(time(NULL) ^ ZCR_SEED2));
+ }
+ init_keys(passwd, pkeys, pcrc_32_tab);
+ for (n = 0; n < RAND_HEAD_LEN-2; n++)
+ {
+ c = (rand() >> 7) & 0xff;
+ header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
+ }
+ /* Encrypt random header (last two bytes is high word of crc) */
+ init_keys(passwd, pkeys, pcrc_32_tab);
+ for (n = 0; n < RAND_HEAD_LEN-2; n++)
+ {
+ buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
+ }
+ buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
+ buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
+ return n;
+}
+
+#endif
Oops, something went wrong.

0 comments on commit ee9f909

Please sign in to comment.