├── .gitignore ├── DDMinizip ├── LICENSE.rtf ├── README.md ├── other │ ├── crypt.h │ ├── ioapi.c │ ├── ioapi.h │ ├── mztools.c │ ├── mztools.h │ ├── unzip.c │ ├── unzip.h │ ├── zip.c │ └── zip.h └── src │ ├── DDZipReader.h │ ├── DDZipReader.m │ ├── DDZipWriter.h │ ├── DDZipWriter.m │ ├── DDZippedFileInfo.h │ └── DDZippedFileInfo.m ├── Icon.png ├── LICENSE.txt ├── MountainNotifier.xcodeproj └── project.pbxproj ├── MountainNotifier ├── DDEmbeddedDataReader.h ├── DDEmbeddedDataReader.m ├── Info.plist └── main.m ├── MountainNotifierTemplate ├── DDAppDelegate.h ├── DDAppDelegate.m ├── Icon.icns ├── Info.plist ├── Prefix.pch ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib ├── main.m └── zipHelper.sh ├── MountianGrowlPlugin ├── GrowlMountainNotifierDisplay.h ├── GrowlMountainNotifierDisplay.m ├── GrowlMountainNotifierPrefs.h ├── GrowlMountainNotifierPrefs.m ├── MountianGrowlPlugin-Info.plist ├── MountianGrowlPlugin-Prefix.pch ├── cs.lproj │ └── GrowlMountainNotifierPrefs.xib ├── da.lproj │ └── GrowlMountainNotifierPrefs.xib ├── de.lproj │ └── GrowlMountainNotifierPrefs.xib ├── el.lproj │ └── GrowlMountainNotifierPrefs.xib ├── en.lproj │ └── GrowlMountainNotifierPrefs.xib ├── es.lproj │ └── GrowlMountainNotifierPrefs.xib ├── fr.lproj │ └── GrowlMountainNotifierPrefs.xib ├── growl-1.3-headers │ ├── GrowlAbstractSingletonObject.h │ ├── GrowlApplicationTicket.h │ ├── GrowlDefines.h │ ├── GrowlDefinesInternal.h │ ├── GrowlDisplayPlugin.h │ ├── GrowlNotification.h │ ├── GrowlPlugin.h │ ├── GrowlTicketController.h │ └── NSStringAdditions.h ├── it.lproj │ └── GrowlMountainNotifierPrefs.xib ├── ja.lproj │ └── GrowlMountainNotifierPrefs.xib ├── ko.lproj │ └── GrowlMountainNotifierPrefs.xib ├── lv.lproj │ └── GrowlMountainNotifierPrefs.xib ├── nb.lproj │ └── GrowlMountainNotifierPrefs.xib ├── nl.lproj │ └── GrowlMountainNotifierPrefs.xib └── pt-PT.lproj │ └── GrowlMountainNotifierPrefs.xib ├── README.md └── __DIST__ ├── MountainGrowlPlugin.growlView.zip ├── MountainNotifier 0.9 OLD.zip ├── MountainNotifier.zip ├── MountianGrowlPlugin.growlView 0.5 OLD.zip └── MountianGrowlPlugin.growlView 0.7.zip /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build/* 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | 17 | .DS_Store -------------------------------------------------------------------------------- /DDMinizip/LICENSE.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320 2 | {\fonttbl\f0\fmodern\fcharset0 Courier;\f1\froman\fcharset0 Times-Roman;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 5 | \deftab720 6 | \pard\pardeftab720 7 | 8 | \f0\fs26 \cf0 /* zlib.h -- interface of the 'zlib' general purpose compression library\ 9 | version 1.2.7, May 2nd, 2012\ 10 | \ 11 | Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler\ 12 | \ 13 | This software is provided 'as-is', without any express or implied\ 14 | warranty. In no event will the authors be held liable for any damages\ 15 | arising from the use of this software.\ 16 | \ 17 | Permission is granted to anyone to use this software for any purpose,\ 18 | including commercial applications, and to alter it and redistribute it\ 19 | freely, subject to the following restrictions:\ 20 | \ 21 | 1. The origin of this software must not be misrepresented; you must not\ 22 | claim that you wrote the original software. If you use this software\ 23 | in a product, an acknowledgment in the product documentation would be\ 24 | appreciated but is not required.\ 25 | 2. Altered source versions must be plainly marked as such, and must not be\ 26 | misrepresented as being the original software.\ 27 | 3. This notice may not be removed or altered from any source distribution.\ 28 | \ 29 | Jean-loup Gailly Mark Adler\ 30 | jloup@gzip.org madler@alumni.caltech.edu\ 31 | \ 32 | */\ 33 | \pard\pardeftab720 34 | 35 | \f1\fs32 \cf0 \ 36 | } -------------------------------------------------------------------------------- /DDMinizip/README.md: -------------------------------------------------------------------------------- 1 | #About 2 | this project providers a wrapper around libz for iOS5 and OSX. 3 | 4 | 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. 5 | 6 | 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. 7 | 8 | #example usage 9 | there is a simple CLI tool included, that shows the usage of DDZipWriter and DDZipReader. 10 | 11 | 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 12 | 13 | ##zip 14 | DDZipWriter *w = [[DDZipWriter alloc] init]; 15 | [w newZipFile:@"testfile.zip"]; 16 | for(NSString *file in files) { 17 | BOOL res = [w addFileToZip:file newname:[NSString stringWithFormat:@"modified_%@", file]]; 18 | 19 | if(res) { 20 | NSString *n = [file lastPathComponent]; 21 | NSLog(@"added file to zip: %@", n); 22 | } 23 | } 24 | [w closeZipFile]; 25 | 26 | ##unzip 27 | DDZipReader *z = [[DDZipReader alloc] init]; 28 | z.delegate = self; 29 | for(NSString *zip in zips) { 30 | [z openZipFile:zip]; 31 | BOOL res = [z unzipFileTo:path flattenStructure:NO]; 32 | [z closeZipFile]; 33 | 34 | if(res) { 35 | NSString *n = [zip lastPathComponent]; 36 | NSLog(@"Extracted zip file: %@", n); 37 | } 38 | } 39 | ... 40 | - (BOOL)zipArchive:(DDZipReader *)zip shouldExtractFile:(NSString *)file { 41 | return ([file rangeOfString:@"__MACOSX"].location==NSNotFound); 42 | } 43 | 44 | - (BOOL)zipArchive:(DDZipReader *)zip shouldOverwriteFile:(NSString *)file { 45 | id fileDate = [[[NSFileManager defaultManager] attributesOfItemAtPath:file error:nil] fileModificationDate]; 46 | id fileInfoDate = fileInfo.date; 47 | 48 | return ([fileDate compare:fileInfoDate]==NSOrderedAscending); 49 | } 50 | 51 | #DDMinizip is available under the original libz license -------------------------------------------------------------------------------- /DDMinizip/other/crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile 2 | 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | 8 | This code is a modified version of crypting code in Infozip distribution 9 | 10 | The encryption/decryption parts of this source code (as opposed to the 11 | non-echoing password parts) were originally written in Europe. The 12 | whole source package can be freely distributed, including from the USA. 13 | (Prior to January 2000, re-export from the US was a violation of US law.) 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | 23 | This code support the "Traditional PKWARE Encryption". 24 | 25 | The new AES encryption added on Zip format by Winzip (see the page 26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 27 | Encryption is not supported. 28 | */ 29 | 30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 31 | 32 | /*********************************************************************** 33 | * Return the next byte in the pseudo-random sequence 34 | */ 35 | static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) 36 | { 37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 38 | * unpredictable manner on 16-bit systems; not a problem 39 | * with any known compiler so far, though */ 40 | 41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 43 | } 44 | 45 | /*********************************************************************** 46 | * Update the encryption keys with the next byte of plain text 47 | */ 48 | static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) 49 | { 50 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 51 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 52 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 53 | { 54 | register int keyshift = (int)((*(pkeys+1)) >> 24); 55 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 56 | } 57 | return c; 58 | } 59 | 60 | 61 | /*********************************************************************** 62 | * Initialize the encryption keys and the random header according to 63 | * the given password. 64 | */ 65 | static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) 66 | { 67 | *(pkeys+0) = 305419896L; 68 | *(pkeys+1) = 591751049L; 69 | *(pkeys+2) = 878082192L; 70 | while (*passwd != '\0') { 71 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); 72 | passwd++; 73 | } 74 | } 75 | 76 | #define zdecode(pkeys,pcrc_32_tab,c) \ 77 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 78 | 79 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 80 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 81 | 82 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 83 | 84 | #define RAND_HEAD_LEN 12 85 | /* "last resort" source for second part of crypt seed pattern */ 86 | # ifndef ZCR_SEED2 87 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 88 | # endif 89 | 90 | static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) 91 | const char *passwd; /* password string */ 92 | unsigned char *buf; /* where to write header */ 93 | int bufSize; 94 | unsigned long* pkeys; 95 | const unsigned long* pcrc_32_tab; 96 | unsigned long crcForCrypting; 97 | { 98 | int n; /* index in random header */ 99 | int t; /* temporary */ 100 | int c; /* random byte */ 101 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 102 | static unsigned calls = 0; /* ensure different random header each time */ 103 | 104 | if (bufSize> 7) & 0xff; 119 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 120 | } 121 | /* Encrypt random header (last two bytes is high word of crc) */ 122 | init_keys(passwd, pkeys, pcrc_32_tab); 123 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 124 | { 125 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 126 | } 127 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 128 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 129 | return n; 130 | } 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /DDMinizip/other/ioapi.c: -------------------------------------------------------------------------------- 1 | /* ioapi.c -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "zlib.h" 14 | #include "ioapi.h" 15 | 16 | 17 | 18 | /* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ 19 | 20 | #ifndef SEEK_CUR 21 | #define SEEK_CUR 1 22 | #endif 23 | 24 | #ifndef SEEK_END 25 | #define SEEK_END 2 26 | #endif 27 | 28 | #ifndef SEEK_SET 29 | #define SEEK_SET 0 30 | #endif 31 | 32 | voidpf ZCALLBACK fopen_file_func OF(( 33 | voidpf opaque, 34 | const char* filename, 35 | int mode)); 36 | 37 | uLong ZCALLBACK fread_file_func OF(( 38 | voidpf opaque, 39 | voidpf stream, 40 | void* buf, 41 | uLong size)); 42 | 43 | uLong ZCALLBACK fwrite_file_func OF(( 44 | voidpf opaque, 45 | voidpf stream, 46 | const void* buf, 47 | uLong size)); 48 | 49 | long ZCALLBACK ftell_file_func OF(( 50 | voidpf opaque, 51 | voidpf stream)); 52 | 53 | long ZCALLBACK fseek_file_func OF(( 54 | voidpf opaque, 55 | voidpf stream, 56 | uLong offset, 57 | int origin)); 58 | 59 | int ZCALLBACK fclose_file_func OF(( 60 | voidpf opaque, 61 | voidpf stream)); 62 | 63 | int ZCALLBACK ferror_file_func OF(( 64 | voidpf opaque, 65 | voidpf stream)); 66 | 67 | 68 | voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) 69 | voidpf opaque; 70 | const char* filename; 71 | int mode; 72 | { 73 | FILE* file = NULL; 74 | const char* mode_fopen = NULL; 75 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 76 | mode_fopen = "rb"; 77 | else 78 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 79 | mode_fopen = "r+b"; 80 | else 81 | if (mode & ZLIB_FILEFUNC_MODE_CREATE) 82 | mode_fopen = "wb"; 83 | 84 | if ((filename!=NULL) && (mode_fopen != NULL)) 85 | file = fopen(filename, mode_fopen); 86 | return file; 87 | } 88 | 89 | 90 | uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) 91 | voidpf opaque; 92 | voidpf stream; 93 | void* buf; 94 | uLong size; 95 | { 96 | uLong ret; 97 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); 98 | return ret; 99 | } 100 | 101 | 102 | uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) 103 | voidpf opaque; 104 | voidpf stream; 105 | const void* buf; 106 | uLong size; 107 | { 108 | uLong ret; 109 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); 110 | return ret; 111 | } 112 | 113 | long ZCALLBACK ftell_file_func (opaque, stream) 114 | voidpf opaque; 115 | voidpf stream; 116 | { 117 | long ret; 118 | ret = ftell((FILE *)stream); 119 | return ret; 120 | } 121 | 122 | long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) 123 | voidpf opaque; 124 | voidpf stream; 125 | uLong offset; 126 | int origin; 127 | { 128 | int fseek_origin=0; 129 | long ret; 130 | switch (origin) 131 | { 132 | case ZLIB_FILEFUNC_SEEK_CUR : 133 | fseek_origin = SEEK_CUR; 134 | break; 135 | case ZLIB_FILEFUNC_SEEK_END : 136 | fseek_origin = SEEK_END; 137 | break; 138 | case ZLIB_FILEFUNC_SEEK_SET : 139 | fseek_origin = SEEK_SET; 140 | break; 141 | default: return -1; 142 | } 143 | ret = 0; 144 | fseek((FILE *)stream, offset, fseek_origin); 145 | return ret; 146 | } 147 | 148 | int ZCALLBACK fclose_file_func (opaque, stream) 149 | voidpf opaque; 150 | voidpf stream; 151 | { 152 | int ret; 153 | ret = fclose((FILE *)stream); 154 | return ret; 155 | } 156 | 157 | int ZCALLBACK ferror_file_func (opaque, stream) 158 | voidpf opaque; 159 | voidpf stream; 160 | { 161 | int ret; 162 | ret = ferror((FILE *)stream); 163 | return ret; 164 | } 165 | 166 | void fill_fopen_filefunc (pzlib_filefunc_def) 167 | zlib_filefunc_def* pzlib_filefunc_def; 168 | { 169 | pzlib_filefunc_def->zopen_file = fopen_file_func; 170 | pzlib_filefunc_def->zread_file = fread_file_func; 171 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; 172 | pzlib_filefunc_def->ztell_file = ftell_file_func; 173 | pzlib_filefunc_def->zseek_file = fseek_file_func; 174 | pzlib_filefunc_def->zclose_file = fclose_file_func; 175 | pzlib_filefunc_def->zerror_file = ferror_file_func; 176 | pzlib_filefunc_def->opaque = NULL; 177 | } 178 | -------------------------------------------------------------------------------- /DDMinizip/other/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #ifndef _ZLIBIOAPI_H 10 | #define _ZLIBIOAPI_H 11 | 12 | 13 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 14 | #define ZLIB_FILEFUNC_SEEK_END (2) 15 | #define ZLIB_FILEFUNC_SEEK_SET (0) 16 | 17 | #define ZLIB_FILEFUNC_MODE_READ (1) 18 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 19 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 20 | 21 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 22 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 23 | 24 | 25 | #ifndef ZCALLBACK 26 | 27 | #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 28 | #define ZCALLBACK CALLBACK 29 | #else 30 | #define ZCALLBACK 31 | #endif 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 39 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 40 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 41 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 42 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 43 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 44 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 45 | 46 | typedef struct zlib_filefunc_def_s 47 | { 48 | open_file_func zopen_file; 49 | read_file_func zread_file; 50 | write_file_func zwrite_file; 51 | tell_file_func ztell_file; 52 | seek_file_func zseek_file; 53 | close_file_func zclose_file; 54 | testerror_file_func zerror_file; 55 | voidpf opaque; 56 | } zlib_filefunc_def; 57 | 58 | 59 | 60 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 61 | 62 | #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 63 | #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 64 | #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 65 | #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 66 | #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 67 | #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 68 | 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /DDMinizip/other/mztools.c: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | /* Code */ 8 | #include 9 | #include 10 | #include 11 | #include "zlib.h" 12 | #include "unzip.h" 13 | 14 | #define READ_8(adr) ((unsigned char)*(adr)) 15 | #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) 16 | #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) 17 | 18 | #define WRITE_8(buff, n) do { \ 19 | *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ 20 | } while(0) 21 | #define WRITE_16(buff, n) do { \ 22 | WRITE_8((unsigned char*)(buff), n); \ 23 | WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \ 24 | } while(0) 25 | #define WRITE_32(buff, n) do { \ 26 | WRITE_16((unsigned char*)(buff), (n) & 0xffff); \ 27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ 28 | } while(0) 29 | 30 | 31 | extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) 32 | const char* file; 33 | const char* fileOut; 34 | const char* fileOutTmp; 35 | uLong* nRecovered; 36 | uLong* bytesRecovered; 37 | { 38 | int err = Z_OK; 39 | FILE* fpZip = fopen(file, "rb"); 40 | FILE* fpOut = fopen(fileOut, "wb"); 41 | FILE* fpOutCD = fopen(fileOutTmp, "wb"); 42 | if (fpZip != NULL && fpOut != NULL) { 43 | int entries = 0; 44 | uLong totalBytes = 0; 45 | char header[30]; 46 | char filename[256]; 47 | char extra[1024]; 48 | int offset = 0; 49 | int offsetCD = 0; 50 | while ( fread(header, 1, 30, fpZip) == 30 ) { 51 | int currentOffset = offset; 52 | 53 | /* File entry */ 54 | if (READ_32(header) == 0x04034b50) { 55 | unsigned int version = READ_16(header + 4); 56 | unsigned int gpflag = READ_16(header + 6); 57 | unsigned int method = READ_16(header + 8); 58 | unsigned int filetime = READ_16(header + 10); 59 | unsigned int filedate = READ_16(header + 12); 60 | unsigned int crc = READ_32(header + 14); /* crc */ 61 | unsigned int cpsize = READ_32(header + 18); /* compressed size */ 62 | unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */ 63 | unsigned int fnsize = READ_16(header + 26); /* file name length */ 64 | unsigned int extsize = READ_16(header + 28); /* extra field length */ 65 | filename[0] = extra[0] = '\0'; 66 | 67 | /* Header */ 68 | if (fwrite(header, 1, 30, fpOut) == 30) { 69 | offset += 30; 70 | } else { 71 | err = Z_ERRNO; 72 | break; 73 | } 74 | 75 | /* Filename */ 76 | if (fnsize > 0) { 77 | if (fread(filename, 1, fnsize, fpZip) == fnsize) { 78 | if (fwrite(filename, 1, fnsize, fpOut) == fnsize) { 79 | offset += fnsize; 80 | } else { 81 | err = Z_ERRNO; 82 | break; 83 | } 84 | } else { 85 | err = Z_ERRNO; 86 | break; 87 | } 88 | } else { 89 | err = Z_STREAM_ERROR; 90 | break; 91 | } 92 | 93 | /* Extra field */ 94 | if (extsize > 0) { 95 | if (fread(extra, 1, extsize, fpZip) == extsize) { 96 | if (fwrite(extra, 1, extsize, fpOut) == extsize) { 97 | offset += extsize; 98 | } else { 99 | err = Z_ERRNO; 100 | break; 101 | } 102 | } else { 103 | err = Z_ERRNO; 104 | break; 105 | } 106 | } 107 | 108 | /* Data */ 109 | { 110 | int dataSize = cpsize; 111 | if (dataSize == 0) { 112 | dataSize = uncpsize; 113 | } 114 | if (dataSize > 0) { 115 | char* data = malloc(dataSize); 116 | if (data != NULL) { 117 | if ((int)fread(data, 1, dataSize, fpZip) == dataSize) { 118 | if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) { 119 | offset += dataSize; 120 | totalBytes += dataSize; 121 | } else { 122 | err = Z_ERRNO; 123 | } 124 | } else { 125 | err = Z_ERRNO; 126 | } 127 | free(data); 128 | if (err != Z_OK) { 129 | break; 130 | } 131 | } else { 132 | err = Z_MEM_ERROR; 133 | break; 134 | } 135 | } 136 | } 137 | 138 | /* Central directory entry */ 139 | { 140 | char header[46]; 141 | char* comment = ""; 142 | int comsize = (int) strlen(comment); 143 | WRITE_32(header, 0x02014b50); 144 | WRITE_16(header + 4, version); 145 | WRITE_16(header + 6, version); 146 | WRITE_16(header + 8, gpflag); 147 | WRITE_16(header + 10, method); 148 | WRITE_16(header + 12, filetime); 149 | WRITE_16(header + 14, filedate); 150 | WRITE_32(header + 16, crc); 151 | WRITE_32(header + 20, cpsize); 152 | WRITE_32(header + 24, uncpsize); 153 | WRITE_16(header + 28, fnsize); 154 | WRITE_16(header + 30, extsize); 155 | WRITE_16(header + 32, comsize); 156 | WRITE_16(header + 34, 0); /* disk # */ 157 | WRITE_16(header + 36, 0); /* int attrb */ 158 | WRITE_32(header + 38, 0); /* ext attrb */ 159 | WRITE_32(header + 42, currentOffset); 160 | /* Header */ 161 | if (fwrite(header, 1, 46, fpOutCD) == 46) { 162 | offsetCD += 46; 163 | 164 | /* Filename */ 165 | if (fnsize > 0) { 166 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { 167 | offsetCD += fnsize; 168 | } else { 169 | err = Z_ERRNO; 170 | break; 171 | } 172 | } else { 173 | err = Z_STREAM_ERROR; 174 | break; 175 | } 176 | 177 | /* Extra field */ 178 | if (extsize > 0) { 179 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { 180 | offsetCD += extsize; 181 | } else { 182 | err = Z_ERRNO; 183 | break; 184 | } 185 | } 186 | 187 | /* Comment field */ 188 | if (comsize > 0) { 189 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { 190 | offsetCD += comsize; 191 | } else { 192 | err = Z_ERRNO; 193 | break; 194 | } 195 | } 196 | 197 | 198 | } else { 199 | err = Z_ERRNO; 200 | break; 201 | } 202 | } 203 | 204 | /* Success */ 205 | entries++; 206 | 207 | } else { 208 | break; 209 | } 210 | } 211 | 212 | /* Final central directory */ 213 | { 214 | int entriesZip = entries; 215 | char header[22]; 216 | char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; 217 | int comsize = (int) strlen(comment); 218 | if (entriesZip > 0xffff) { 219 | entriesZip = 0xffff; 220 | } 221 | WRITE_32(header, 0x06054b50); 222 | WRITE_16(header + 4, 0); /* disk # */ 223 | WRITE_16(header + 6, 0); /* disk # */ 224 | WRITE_16(header + 8, entriesZip); /* hack */ 225 | WRITE_16(header + 10, entriesZip); /* hack */ 226 | WRITE_32(header + 12, offsetCD); /* size of CD */ 227 | WRITE_32(header + 16, offset); /* offset to CD */ 228 | WRITE_16(header + 20, comsize); /* comment */ 229 | 230 | /* Header */ 231 | if (fwrite(header, 1, 22, fpOutCD) == 22) { 232 | 233 | /* Comment field */ 234 | if (comsize > 0) { 235 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { 236 | err = Z_ERRNO; 237 | } 238 | } 239 | 240 | } else { 241 | err = Z_ERRNO; 242 | } 243 | } 244 | 245 | /* Final merge (file + central directory) */ 246 | fclose(fpOutCD); 247 | if (err == Z_OK) { 248 | fpOutCD = fopen(fileOutTmp, "rb"); 249 | if (fpOutCD != NULL) { 250 | int nRead; 251 | char buffer[8192]; 252 | while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) { 253 | if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) { 254 | err = Z_ERRNO; 255 | break; 256 | } 257 | } 258 | fclose(fpOutCD); 259 | } 260 | } 261 | 262 | /* Close */ 263 | fclose(fpZip); 264 | fclose(fpOut); 265 | 266 | /* Wipe temporary file */ 267 | (void)remove(fileOutTmp); 268 | 269 | /* Number of recovered entries */ 270 | if (err == Z_OK) { 271 | if (nRecovered != NULL) { 272 | *nRecovered = entries; 273 | } 274 | if (bytesRecovered != NULL) { 275 | *bytesRecovered = totalBytes; 276 | } 277 | } 278 | } else { 279 | err = Z_STREAM_ERROR; 280 | } 281 | return err; 282 | } 283 | -------------------------------------------------------------------------------- /DDMinizip/other/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /DDMinizip/other/unzip.h: -------------------------------------------------------------------------------- 1 | /* unzip.h -- IO for uncompress .zip files using zlib 2 | Version 1.01e, February 12th, 2005 3 | 4 | Copyright (C) 1998-2005 Gilles Vollant 5 | 6 | This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g 7 | WinZip, InfoZip tools and compatible. 8 | 9 | Multi volume ZipFile (span) are not supported. 10 | Encryption compatible with pkzip 2.04g only supported 11 | Old compressions used by old PKZip 1.x are not supported 12 | 13 | 14 | I WAIT FEEDBACK at mail info@winimage.com 15 | Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution 16 | 17 | Condition of use and distribution are the same than zlib : 18 | 19 | This software is provided 'as-is', without any express or implied 20 | warranty. In no event will the authors be held liable for any damages 21 | arising from the use of this software. 22 | 23 | Permission is granted to anyone to use this software for any purpose, 24 | including commercial applications, and to alter it and redistribute it 25 | freely, subject to the following restrictions: 26 | 27 | 1. The origin of this software must not be misrepresented; you must not 28 | claim that you wrote the original software. If you use this software 29 | in a product, an acknowledgment in the product documentation would be 30 | appreciated but is not required. 31 | 2. Altered source versions must be plainly marked as such, and must not be 32 | misrepresented as being the original software. 33 | 3. This notice may not be removed or altered from any source distribution. 34 | 35 | 36 | */ 37 | 38 | /* for more info about .ZIP format, see 39 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip 40 | http://www.info-zip.org/pub/infozip/doc/ 41 | PkWare has also a specification at : 42 | ftp://ftp.pkware.com/probdesc.zip 43 | */ 44 | 45 | #ifndef _unz_H 46 | #define _unz_H 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | #ifndef _ZLIB_H 53 | #include "zlib.h" 54 | #endif 55 | 56 | #ifndef _ZLIBIOAPI_H 57 | #include "ioapi.h" 58 | #endif 59 | 60 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) 61 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 62 | from (void*) without cast */ 63 | typedef struct TagunzFile__ { int unused; } unzFile__; 64 | typedef unzFile__ *unzFile; 65 | #else 66 | typedef voidp unzFile; 67 | #endif 68 | 69 | 70 | #define UNZ_OK (0) 71 | #define UNZ_END_OF_LIST_OF_FILE (-100) 72 | #define UNZ_ERRNO (Z_ERRNO) 73 | #define UNZ_EOF (0) 74 | #define UNZ_PARAMERROR (-102) 75 | #define UNZ_BADZIPFILE (-103) 76 | #define UNZ_INTERNALERROR (-104) 77 | #define UNZ_CRCERROR (-105) 78 | 79 | /* tm_unz contain date/time info */ 80 | typedef struct tm_unz_s 81 | { 82 | uInt tm_sec; /* seconds after the minute - [0,59] */ 83 | uInt tm_min; /* minutes after the hour - [0,59] */ 84 | uInt tm_hour; /* hours since midnight - [0,23] */ 85 | uInt tm_mday; /* day of the month - [1,31] */ 86 | uInt tm_mon; /* months since January - [0,11] */ 87 | uInt tm_year; /* years - [1980..2044] */ 88 | } tm_unz; 89 | 90 | /* unz_global_info structure contain global data about the ZIPfile 91 | These data comes from the end of central dir */ 92 | typedef struct unz_global_info_s 93 | { 94 | uLong number_entry; /* total number of entries in 95 | the central dir on this disk */ 96 | uLong size_comment; /* size of the global comment of the zipfile */ 97 | } unz_global_info; 98 | 99 | 100 | /* unz_file_info contain information about a file in the zipfile */ 101 | typedef struct unz_file_info_s 102 | { 103 | uLong version; /* version made by 2 bytes */ 104 | uLong version_needed; /* version needed to extract 2 bytes */ 105 | uLong flag; /* general purpose bit flag 2 bytes */ 106 | uLong compression_method; /* compression method 2 bytes */ 107 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 108 | uLong crc; /* crc-32 4 bytes */ 109 | uLong compressed_size; /* compressed size 4 bytes */ 110 | uLong uncompressed_size; /* uncompressed size 4 bytes */ 111 | uLong size_filename; /* filename length 2 bytes */ 112 | uLong size_file_extra; /* extra field length 2 bytes */ 113 | uLong size_file_comment; /* file comment length 2 bytes */ 114 | 115 | uLong disk_num_start; /* disk number start 2 bytes */ 116 | uLong internal_fa; /* internal file attributes 2 bytes */ 117 | uLong external_fa; /* external file attributes 4 bytes */ 118 | 119 | tm_unz tmu_date; 120 | } unz_file_info; 121 | 122 | extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, 123 | const char* fileName2, 124 | int iCaseSensitivity)); 125 | /* 126 | Compare two filename (fileName1,fileName2). 127 | If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) 128 | If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi 129 | or strcasecmp) 130 | If iCaseSenisivity = 0, case sensitivity is defaut of your operating system 131 | (like 1 on Unix, 2 on Windows) 132 | */ 133 | 134 | 135 | extern unzFile ZEXPORT unzOpen OF((const char *path)); 136 | /* 137 | Open a Zip file. path contain the full pathname (by example, 138 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer 139 | "zlib/zlib113.zip". 140 | If the zipfile cannot be opened (file don't exist or in not valid), the 141 | return value is NULL. 142 | Else, the return value is a unzFile Handle, usable with other function 143 | of this unzip package. 144 | */ 145 | 146 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, 147 | zlib_filefunc_def* pzlib_filefunc_def)); 148 | /* 149 | Open a Zip file, like unzOpen, but provide a set of file low level API 150 | for read/write the zip file (see ioapi.h) 151 | */ 152 | 153 | extern int ZEXPORT unzClose OF((unzFile file)); 154 | /* 155 | Close a ZipFile opened with unzipOpen. 156 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), 157 | these files MUST be closed with unzipCloseCurrentFile before call unzipClose. 158 | return UNZ_OK if there is no problem. */ 159 | 160 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, 161 | unz_global_info *pglobal_info)); 162 | /* 163 | Write info about the ZipFile in the *pglobal_info structure. 164 | No preparation of the structure is needed 165 | return UNZ_OK if there is no problem. */ 166 | 167 | 168 | extern int ZEXPORT unzGetGlobalComment OF((unzFile file, 169 | char *szComment, 170 | uLong uSizeBuf)); 171 | /* 172 | Get the global comment string of the ZipFile, in the szComment buffer. 173 | uSizeBuf is the size of the szComment buffer. 174 | return the number of byte copied or an error code <0 175 | */ 176 | 177 | 178 | /***************************************************************************/ 179 | /* Unzip package allow you browse the directory of the zipfile */ 180 | 181 | extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); 182 | /* 183 | Set the current file of the zipfile to the first file. 184 | return UNZ_OK if there is no problem 185 | */ 186 | 187 | extern int ZEXPORT unzGoToNextFile OF((unzFile file)); 188 | /* 189 | Set the current file of the zipfile to the next file. 190 | return UNZ_OK if there is no problem 191 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 192 | */ 193 | 194 | extern int ZEXPORT unzLocateFile OF((unzFile file, 195 | const char *szFileName, 196 | int iCaseSensitivity)); 197 | /* 198 | Try locate the file szFileName in the zipfile. 199 | For the iCaseSensitivity signification, see unzStringFileNameCompare 200 | 201 | return value : 202 | UNZ_OK if the file is found. It becomes the current file. 203 | UNZ_END_OF_LIST_OF_FILE if the file is not found 204 | */ 205 | 206 | 207 | /* ****************************************** */ 208 | /* Ryan supplied functions */ 209 | /* unz_file_info contain information about a file in the zipfile */ 210 | typedef struct unz_file_pos_s 211 | { 212 | uLong pos_in_zip_directory; /* offset in zip file directory */ 213 | uLong num_of_file; /* # of file */ 214 | } unz_file_pos; 215 | 216 | extern int ZEXPORT unzGetFilePos( 217 | unzFile file, 218 | unz_file_pos* file_pos); 219 | 220 | extern int ZEXPORT unzGoToFilePos( 221 | unzFile file, 222 | unz_file_pos* file_pos); 223 | 224 | /* ****************************************** */ 225 | 226 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, 227 | unz_file_info *pfile_info, 228 | char *szFileName, 229 | uLong fileNameBufferSize, 230 | void *extraField, 231 | uLong extraFieldBufferSize, 232 | char *szComment, 233 | uLong commentBufferSize)); 234 | /* 235 | Get Info about the current file 236 | if pfile_info!=NULL, the *pfile_info structure will contain somes info about 237 | the current file 238 | if szFileName!=NULL, the filemane string will be copied in szFileName 239 | (fileNameBufferSize is the size of the buffer) 240 | if extraField!=NULL, the extra field information will be copied in extraField 241 | (extraFieldBufferSize is the size of the buffer). 242 | This is the Central-header version of the extra field 243 | if szComment!=NULL, the comment string of the file will be copied in szComment 244 | (commentBufferSize is the size of the buffer) 245 | */ 246 | 247 | /***************************************************************************/ 248 | /* for reading the content of the current zipfile, you can open it, read data 249 | from it, and close it (you can close it before reading all the file) 250 | */ 251 | 252 | extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); 253 | /* 254 | Open for reading data the current file in the zipfile. 255 | If there is no error, the return value is UNZ_OK. 256 | */ 257 | 258 | extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, 259 | const char* password)); 260 | /* 261 | Open for reading data the current file in the zipfile. 262 | password is a crypting password 263 | If there is no error, the return value is UNZ_OK. 264 | */ 265 | 266 | extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, 267 | int* method, 268 | int* level, 269 | int raw)); 270 | /* 271 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 272 | if raw==1 273 | *method will receive method of compression, *level will receive level of 274 | compression 275 | note : you can set level parameter as NULL (if you did not want known level, 276 | but you CANNOT set method parameter as NULL 277 | */ 278 | 279 | extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, 280 | int* method, 281 | int* level, 282 | int raw, 283 | const char* password)); 284 | /* 285 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 286 | if raw==1 287 | *method will receive method of compression, *level will receive level of 288 | compression 289 | note : you can set level parameter as NULL (if you did not want known level, 290 | but you CANNOT set method parameter as NULL 291 | */ 292 | 293 | 294 | extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); 295 | /* 296 | Close the file in zip opened with unzOpenCurrentFile 297 | Return UNZ_CRCERROR if all the file was read but the CRC is not good 298 | */ 299 | 300 | extern int ZEXPORT unzReadCurrentFile OF((unzFile file, 301 | voidp buf, 302 | unsigned len)); 303 | /* 304 | Read bytes from the current file (opened by unzOpenCurrentFile) 305 | buf contain buffer where data must be copied 306 | len the size of buf. 307 | 308 | return the number of byte copied if somes bytes are copied 309 | return 0 if the end of file was reached 310 | return <0 with error code if there is an error 311 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) 312 | */ 313 | 314 | extern z_off_t ZEXPORT unztell OF((unzFile file)); 315 | /* 316 | Give the current position in uncompressed data 317 | */ 318 | 319 | extern int ZEXPORT unzeof OF((unzFile file)); 320 | /* 321 | return 1 if the end of file was reached, 0 elsewhere 322 | */ 323 | 324 | extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, 325 | voidp buf, 326 | unsigned len)); 327 | /* 328 | Read extra field from the current file (opened by unzOpenCurrentFile) 329 | This is the local-header version of the extra field (sometimes, there is 330 | more info in the local-header version than in the central-header) 331 | 332 | if buf==NULL, it return the size of the local extra field 333 | 334 | if buf!=NULL, len is the size of the buffer, the extra header is copied in 335 | buf. 336 | the return value is the number of bytes copied in buf, or (if <0) 337 | the error code 338 | */ 339 | 340 | /***************************************************************************/ 341 | 342 | /* Get the current file offset */ 343 | extern uLong ZEXPORT unzGetOffset (unzFile file); 344 | 345 | /* Set the current file offset */ 346 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); 347 | 348 | 349 | 350 | #ifdef __cplusplus 351 | } 352 | #endif 353 | 354 | #endif /* _unz_H */ 355 | -------------------------------------------------------------------------------- /DDMinizip/other/zip.h: -------------------------------------------------------------------------------- 1 | /* zip.h -- IO for compress .zip files using zlib 2 | Version 1.01e, February 12th, 2005 3 | 4 | Copyright (C) 1998-2005 Gilles Vollant 5 | 6 | This unzip package allow creates .ZIP file, compatible with PKZip 2.04g 7 | WinZip, InfoZip tools and compatible. 8 | Multi volume ZipFile (span) are not supported. 9 | Encryption compatible with pkzip 2.04g only supported 10 | Old compressions used by old PKZip 1.x are not supported 11 | 12 | For uncompress .zip file, look at unzip.h 13 | 14 | 15 | I WAIT FEEDBACK at mail info@winimage.com 16 | Visit also http://www.winimage.com/zLibDll/unzip.html for evolution 17 | 18 | Condition of use and distribution are the same than zlib : 19 | 20 | This software is provided 'as-is', without any express or implied 21 | warranty. In no event will the authors be held liable for any damages 22 | arising from the use of this software. 23 | 24 | Permission is granted to anyone to use this software for any purpose, 25 | including commercial applications, and to alter it and redistribute it 26 | freely, subject to the following restrictions: 27 | 28 | 1. The origin of this software must not be misrepresented; you must not 29 | claim that you wrote the original software. If you use this software 30 | in a product, an acknowledgment in the product documentation would be 31 | appreciated but is not required. 32 | 2. Altered source versions must be plainly marked as such, and must not be 33 | misrepresented as being the original software. 34 | 3. This notice may not be removed or altered from any source distribution. 35 | 36 | 37 | */ 38 | 39 | /* for more info about .ZIP format, see 40 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip 41 | http://www.info-zip.org/pub/infozip/doc/ 42 | PkWare has also a specification at : 43 | ftp://ftp.pkware.com/probdesc.zip 44 | */ 45 | 46 | #ifndef _zip_H 47 | #define _zip_H 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | #ifndef _ZLIB_H 54 | #include "zlib.h" 55 | #endif 56 | 57 | #ifndef _ZLIBIOAPI_H 58 | #include "ioapi.h" 59 | #endif 60 | 61 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) 62 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 63 | from (void*) without cast */ 64 | typedef struct TagzipFile__ { int unused; } zipFile__; 65 | typedef zipFile__ *zipFile; 66 | #else 67 | typedef voidp zipFile; 68 | #endif 69 | 70 | #define ZIP_OK (0) 71 | #define ZIP_EOF (0) 72 | #define ZIP_ERRNO (Z_ERRNO) 73 | #define ZIP_PARAMERROR (-102) 74 | #define ZIP_BADZIPFILE (-103) 75 | #define ZIP_INTERNALERROR (-104) 76 | 77 | #ifndef DEF_MEM_LEVEL 78 | # if MAX_MEM_LEVEL >= 8 79 | # define DEF_MEM_LEVEL 8 80 | # else 81 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL 82 | # endif 83 | #endif 84 | /* default memLevel */ 85 | 86 | /* tm_zip contain date/time info */ 87 | typedef struct tm_zip_s 88 | { 89 | uInt tm_sec; /* seconds after the minute - [0,59] */ 90 | uInt tm_min; /* minutes after the hour - [0,59] */ 91 | uInt tm_hour; /* hours since midnight - [0,23] */ 92 | uInt tm_mday; /* day of the month - [1,31] */ 93 | uInt tm_mon; /* months since January - [0,11] */ 94 | uInt tm_year; /* years - [1980..2044] */ 95 | } tm_zip; 96 | 97 | typedef struct 98 | { 99 | tm_zip tmz_date; /* date in understandable format */ 100 | uLong dosDate; /* if dos_date == 0, tmu_date is used */ 101 | /* uLong flag; */ /* general purpose bit flag 2 bytes */ 102 | 103 | uLong internal_fa; /* internal file attributes 2 bytes */ 104 | uLong external_fa; /* external file attributes 4 bytes */ 105 | } zip_fileinfo; 106 | 107 | typedef const char* zipcharpc; 108 | 109 | 110 | #define APPEND_STATUS_CREATE (0) 111 | #define APPEND_STATUS_CREATEAFTER (1) 112 | #define APPEND_STATUS_ADDINZIP (2) 113 | 114 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); 115 | /* 116 | Create a zipfile. 117 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on 118 | an Unix computer "zlib/zlib113.zip". 119 | if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip 120 | will be created at the end of the file. 121 | (useful if the file contain a self extractor code) 122 | if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will 123 | add files in existing zip (be sure you don't add file that doesn't exist) 124 | If the zipfile cannot be opened, the return value is NULL. 125 | Else, the return value is a zipFile Handle, usable with other function 126 | of this zip package. 127 | */ 128 | 129 | /* Note : there is no delete function into a zipfile. 130 | If you want delete file into a zipfile, you must open a zipfile, and create another 131 | Of couse, you can use RAW reading and writing to copy the file you did not want delte 132 | */ 133 | 134 | extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, 135 | int append, 136 | zipcharpc* globalcomment, 137 | zlib_filefunc_def* pzlib_filefunc_def)); 138 | 139 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, 140 | const char* filename, 141 | const zip_fileinfo* zipfi, 142 | const void* extrafield_local, 143 | uInt size_extrafield_local, 144 | const void* extrafield_global, 145 | uInt size_extrafield_global, 146 | const char* comment, 147 | int method, 148 | int level)); 149 | /* 150 | Open a file in the ZIP for writing. 151 | filename : the filename in zip (if NULL, '-' without quote will be used 152 | *zipfi contain supplemental information 153 | if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local 154 | contains the extrafield data the the local header 155 | if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global 156 | contains the extrafield data the the local header 157 | if comment != NULL, comment contain the comment string 158 | method contain the compression method (0 for store, Z_DEFLATED for deflate) 159 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION) 160 | */ 161 | 162 | 163 | extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, 164 | const char* filename, 165 | const zip_fileinfo* zipfi, 166 | const void* extrafield_local, 167 | uInt size_extrafield_local, 168 | const void* extrafield_global, 169 | uInt size_extrafield_global, 170 | const char* comment, 171 | int method, 172 | int level, 173 | int raw)); 174 | 175 | /* 176 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file 177 | */ 178 | 179 | extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, 180 | const char* filename, 181 | const zip_fileinfo* zipfi, 182 | const void* extrafield_local, 183 | uInt size_extrafield_local, 184 | const void* extrafield_global, 185 | uInt size_extrafield_global, 186 | const char* comment, 187 | int method, 188 | int level, 189 | int raw, 190 | int windowBits, 191 | int memLevel, 192 | int strategy, 193 | const char* password, 194 | uLong crcForCtypting)); 195 | 196 | /* 197 | Same than zipOpenNewFileInZip2, except 198 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 199 | password : crypting password (NULL for no crypting) 200 | crcForCtypting : crc of file to compress (needed for crypting) 201 | */ 202 | 203 | 204 | extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, 205 | const void* buf, 206 | unsigned len)); 207 | /* 208 | Write data in the zipfile 209 | */ 210 | 211 | extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); 212 | /* 213 | Close the current file in the zipfile 214 | */ 215 | 216 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, 217 | uLong uncompressed_size, 218 | uLong crc32)); 219 | /* 220 | Close the current file in the zipfile, for fiel opened with 221 | parameter raw=1 in zipOpenNewFileInZip2 222 | uncompressed_size and crc32 are value for the uncompressed size 223 | */ 224 | 225 | extern int ZEXPORT zipClose OF((zipFile file, 226 | const char* global_comment)); 227 | /* 228 | Close the zipfile 229 | */ 230 | 231 | #ifdef __cplusplus 232 | } 233 | #endif 234 | 235 | #endif /* _zip_H */ 236 | -------------------------------------------------------------------------------- /DDMinizip/src/DDZipReader.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDZipReader.h 3 | // updated 2011, Dominik Pich 4 | // 5 | 6 | #import 7 | #include "unzip.h" 8 | #import "DDZippedFileInfo.h" 9 | 10 | @class DDZipReader; 11 | 12 | @protocol DDZipReaderDelegate 13 | @optional 14 | -(BOOL) zipArchive:(DDZipReader*)zip shouldExtractFile:(NSString*)file; 15 | -(void) zipArchive:(DDZipReader*)zip errorMessage:(NSString*) msg; 16 | -(BOOL) zipArchive:(DDZipReader*)zip shouldOverwriteFile:(NSString*)file withZippedFile:(DDZippedFileInfo*)fileInfo; 17 | 18 | @end 19 | 20 | @interface DDZipReader : NSObject { 21 | @private 22 | unzFile _unzFile; 23 | } 24 | 25 | @property (nonatomic, unsafe_unretained) id delegate; 26 | 27 | -(BOOL) openZipFile:(NSString*) zipFile; 28 | -(NSInteger) unzipFileTo:(NSString*) path 29 | flattenStructure: (BOOL)flatten; 30 | -(BOOL) closeZipFile; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DDMinizip/src/DDZipReader.m: -------------------------------------------------------------------------------- 1 | // 2 | // DDZipReader.mm 3 | // updated 2011, Dominik Pich 4 | // 5 | 6 | #import "DDZipReader.h" 7 | #import "zlib.h" 8 | #import "zconf.h" 9 | 10 | @implementation DDZipReader 11 | 12 | @synthesize delegate = _delegate; 13 | 14 | -(id) init 15 | { 16 | if( (self=[super init]) != nil ) 17 | { 18 | _unzFile = NULL; 19 | } 20 | return self; 21 | } 22 | 23 | -(void) dealloc 24 | { 25 | [self closeZipFile]; 26 | } 27 | 28 | #pragma mark - unzipping 29 | 30 | -(BOOL)openZipFile:(NSString *)zipFile 31 | { 32 | _unzFile = unzOpen( (const char*)[zipFile UTF8String] ); 33 | if( _unzFile ) 34 | { 35 | unz_global_info globalInfo = {0}; 36 | unzGetGlobalInfo(_unzFile, &globalInfo ); 37 | /*if( ==UNZ_OK ) 38 | { 39 | //Log(@"%d entries in the zip file",globalInfo.number_entry); 40 | } 41 | */ 42 | } 43 | return _unzFile!=NULL; 44 | } 45 | 46 | -(NSInteger) unzipFileTo:(NSString *)path flattenStructure:(BOOL)flatten 47 | { 48 | NSInteger cFiles = 0; 49 | BOOL success = YES; 50 | int ret = unzGoToFirstFile( _unzFile ); 51 | unsigned char buffer[4096] = {0}; 52 | NSFileManager* fman = [NSFileManager defaultManager]; 53 | if( ret!=UNZ_OK ) 54 | { 55 | [self outputErrorMessage:@"Failed"]; 56 | } 57 | 58 | do{ 59 | ret = unzOpenCurrentFile( _unzFile ); 60 | if( ret!=UNZ_OK ) 61 | { 62 | [self outputErrorMessage:@"Error occurs"]; 63 | success = NO; 64 | break; 65 | } 66 | // reading data and write to file 67 | int read ; 68 | unz_file_info fileInfo ={0}; 69 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); 70 | if( ret!=UNZ_OK ) 71 | { 72 | [self outputErrorMessage:@"Error occurs while getting file info"]; 73 | success = NO; 74 | unzCloseCurrentFile( _unzFile ); 75 | break; 76 | } 77 | char* filename = (char*) malloc( fileInfo.size_filename +1 ); 78 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); 79 | filename[fileInfo.size_filename] = '\0'; 80 | 81 | //get zipped path 82 | NSString * strPath = [NSString stringWithUTF8String:filename]; 83 | BOOL isDirectory = NO; 84 | if(flatten) { 85 | strPath = [strPath lastPathComponent]; 86 | } 87 | else { 88 | if( filename[fileInfo.size_filename-1]=='/' || filename[fileInfo.size_filename-1]=='\\') { 89 | isDirectory = YES; 90 | } 91 | } 92 | free( filename ); 93 | 94 | //convert to / 95 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound ) { 96 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; 97 | } 98 | 99 | //ask delegate if he wants to proceed 100 | if( ![self shouldExtractFile:strPath] ) 101 | { 102 | unzCloseCurrentFile( _unzFile ); 103 | ret = unzGoToNextFile( _unzFile ); 104 | continue; 105 | } 106 | 107 | //get full target path 108 | NSString* fullPath = [path stringByAppendingPathComponent:strPath]; 109 | 110 | //create target dir 111 | if( isDirectory ) 112 | [fman createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:nil error:nil]; 113 | else 114 | [fman createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil]; 115 | 116 | //ask delegate for overwrite 117 | if( [fman fileExistsAtPath:fullPath] && !isDirectory ) 118 | { 119 | if( ![self shouldOverwrite:fullPath withName:strPath andFileInfo:fileInfo] ) 120 | { 121 | unzCloseCurrentFile( _unzFile ); 122 | ret = unzGoToNextFile( _unzFile ); 123 | continue; 124 | } 125 | } 126 | 127 | //write file 128 | FILE* fp = fopen( (const char*)[fullPath UTF8String], "wb"); 129 | while( fp ) 130 | { 131 | read=unzReadCurrentFile(_unzFile, buffer, 4096); 132 | if( read > 0 ) 133 | { 134 | fwrite(buffer, read, 1, fp ); 135 | } 136 | else if( read<0 ) 137 | { 138 | [self outputErrorMessage:@"Failed to reading zip file"]; 139 | break; 140 | } 141 | else 142 | break; 143 | } 144 | if( fp ) 145 | { 146 | fclose( fp ); 147 | // set the orignal datetime property 148 | if( fileInfo.dosDate!=0 ) 149 | { 150 | NSDate* orgDate = [DDZippedFileInfo dateWithTimeIntervalSince1980:(NSTimeInterval)fileInfo.dosDate]; 151 | 152 | NSDictionary* attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate]; //[[NSFileManager defaultManager] fileAttributesAtPath:fullPath traverseLink:YES]; 153 | if( attr ) 154 | { 155 | // [attr setValue:orgDate forKey:NSFileCreationDate]; 156 | if( ![[NSFileManager defaultManager] setAttributes:attr ofItemAtPath:fullPath error:nil] ) 157 | { 158 | // cann't set attributes 159 | //Log(@"Failed to set attributes"); 160 | } 161 | 162 | } 163 | // [orgDate release]; 164 | orgDate = nil; 165 | } 166 | 167 | cFiles++; 168 | 169 | } 170 | unzCloseCurrentFile( _unzFile ); 171 | ret = unzGoToNextFile( _unzFile ); 172 | }while( ret==UNZ_OK && UNZ_OK!=UNZ_END_OF_LIST_OF_FILE ); 173 | return success ? cFiles : -1; 174 | } 175 | 176 | -(BOOL) closeZipFile 177 | { 178 | if( _unzFile ) { 179 | BOOL br = unzClose( _unzFile )==UNZ_OK; 180 | _unzFile = NULL; 181 | return br; 182 | } 183 | return YES; 184 | } 185 | 186 | #pragma mark wrapper for delegate 187 | 188 | - (BOOL)shouldExtractFile:(NSString*)file { 189 | if( _delegate && [_delegate respondsToSelector:@selector(zipArchive:shouldExtractFile:)] ) 190 | return [_delegate zipArchive:self shouldExtractFile:file]; 191 | return YES; 192 | } 193 | 194 | -(void) outputErrorMessage:(NSString*) msg 195 | { 196 | if( _delegate && [_delegate respondsToSelector:@selector(zipArchive:errorMessage:)] ) 197 | [_delegate zipArchive:self errorMessage:msg]; 198 | } 199 | 200 | -(BOOL) shouldOverwrite:(NSString*)file withName:(NSString*)name andFileInfo:(unz_file_info)fileInfo 201 | { 202 | if( _delegate && [_delegate respondsToSelector:@selector(zipArchive:shouldOverwriteFile:withZippedFile:)] ) { 203 | DDZippedFileInfo *info = [[DDZippedFileInfo alloc] initWithName:name andNativeInfo:fileInfo]; 204 | return [_delegate zipArchive:self shouldOverwriteFile:file withZippedFile:info]; 205 | } 206 | return NO; 207 | } 208 | 209 | @end 210 | -------------------------------------------------------------------------------- /DDMinizip/src/DDZipWriter.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDZipWriter.h 3 | // updated 2011, Dominik Pich 4 | // 5 | 6 | #import 7 | #include "zip.h" 8 | 9 | @interface DDZipWriter : NSObject { 10 | @private 11 | zipFile _zipFile; 12 | } 13 | 14 | -(BOOL) newZipFile:(NSString*) zipFile; 15 | -(BOOL) addFileToZip:(NSString*) file 16 | newname:(NSString*) newname; 17 | -(BOOL) closeZipFile; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DDMinizip/src/DDZipWriter.m: -------------------------------------------------------------------------------- 1 | // 2 | // DDZipWriter.mm 3 | // updated 2011, Dominik Pich 4 | // 5 | 6 | #import "DDZipWriter.h" 7 | #import "zlib.h" 8 | #import "zconf.h" 9 | #import "DDZippedFileInfo.h" 10 | 11 | @implementation DDZipWriter 12 | 13 | -(id) init 14 | { 15 | if( (self=[super init]) != nil ) 16 | { 17 | _zipFile = NULL ; 18 | } 19 | return self; 20 | } 21 | 22 | -(void) dealloc 23 | { 24 | [self closeZipFile]; 25 | } 26 | 27 | #pragma mark - zipping 28 | 29 | -(BOOL) newZipFile:(NSString *)zipFile 30 | { 31 | _zipFile = zipOpen( (const char*)[zipFile UTF8String], 0 ); 32 | if( !_zipFile ) 33 | return NO; 34 | return YES; 35 | } 36 | 37 | -(BOOL) addFileToZip:(NSString *)file newname:(NSString *)newname 38 | { 39 | if( !_zipFile ) 40 | return NO; 41 | time_t current; 42 | time( ¤t ); 43 | 44 | zip_fileinfo zipInfo = {0}; 45 | zipInfo.dosDate = (unsigned long) current; 46 | 47 | NSDictionary* attr = [[NSFileManager defaultManager] attributesOfItemAtPath:file error:nil]; 48 | if( attr ) 49 | { 50 | NSDate* fileDate = (NSDate*)[attr objectForKey:NSFileModificationDate]; 51 | if( fileDate ) 52 | { 53 | zipInfo.dosDate = [fileDate timeIntervalSinceDate:[DDZippedFileInfo dateWithTimeIntervalSince1980:0]]; 54 | } 55 | } 56 | 57 | int ret = zipOpenNewFileInZip( _zipFile, 58 | (const char*) [newname UTF8String], 59 | &zipInfo, 60 | NULL,0, 61 | NULL,0, 62 | NULL,//comment 63 | Z_DEFLATED, 64 | Z_DEFAULT_COMPRESSION ); 65 | if( ret!=Z_OK ) 66 | { 67 | return NO; 68 | } 69 | NSData* data = [ NSData dataWithContentsOfFile:file]; 70 | unsigned int dataLen = (unsigned int)[data length]; 71 | ret = zipWriteInFileInZip( _zipFile, (const void*)[data bytes], dataLen); 72 | if( ret!=Z_OK ) 73 | { 74 | return NO; 75 | } 76 | ret = zipCloseFileInZip( _zipFile ); 77 | if( ret!=Z_OK ) 78 | return NO; 79 | return YES; 80 | } 81 | 82 | -(BOOL) closeZipFile 83 | { 84 | if( _zipFile==NULL ) 85 | return NO; 86 | BOOL ret = zipClose( _zipFile,NULL )==Z_OK?YES:NO; 87 | _zipFile = NULL; 88 | return ret; 89 | } 90 | 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /DDMinizip/src/DDZippedFileInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDZippedFileInfo.h 3 | // DDMinizip 4 | // 5 | // Created by Dominik Pich on 07.06.12. 6 | // Copyright (c) 2012 medicus42. All rights reserved. 7 | // 8 | 9 | #import 10 | #include "unzip.h" 11 | 12 | typedef enum { 13 | DDZippedFileInfoCompressionLevelDefault= -1, 14 | DDZippedFileInfoCompressionLevelNone= 0, 15 | DDZippedFileInfoCompressionLevelFastest= 1, 16 | DDZippedFileInfoCompressionLevelBest= 9 17 | } DDZippedFileInfoCompressionLevel; 18 | 19 | @interface DDZippedFileInfo : NSObject 20 | 21 | @property (nonatomic, readonly) NSString *name; 22 | @property (nonatomic, readonly) NSUInteger size; 23 | @property (nonatomic, readonly) DDZippedFileInfoCompressionLevel level; 24 | @property (nonatomic, readonly) BOOL crypted; 25 | @property (nonatomic, readonly) NSUInteger zippedSize; 26 | @property (nonatomic, readonly) NSDate *date; 27 | @property (nonatomic, readonly) NSUInteger crc32; 28 | 29 | - (id) initWithName:(NSString*)aName andNativeInfo:(unz_file_info)info; 30 | 31 | /** 32 | * get NSDate object with timeinterval since 1980-01-01 (dos) 33 | * @param interval seconds since 1980 34 | * @return the NSDate object 35 | */ 36 | +(NSDate*) dateWithTimeIntervalSince1980:(NSTimeInterval)interval; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /DDMinizip/src/DDZippedFileInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // DDZippedFileInfo.m 3 | // DDMinizip 4 | // 5 | // Created by Dominik Pich on 07.06.12. 6 | // Copyright (c) 2012 medicus42. All rights reserved. 7 | // 8 | 9 | #import "DDZippedFileInfo.h" 10 | 11 | @implementation DDZippedFileInfo 12 | 13 | @synthesize name; 14 | @synthesize size; 15 | @synthesize level; 16 | @synthesize crypted; 17 | @synthesize zippedSize; 18 | @synthesize date; 19 | @synthesize crc32; 20 | 21 | - (id) initWithName:(NSString*)aName andNativeInfo:(unz_file_info)info { 22 | self=[super init]; 23 | if(self) { 24 | name = [aName copy]; 25 | size = info.uncompressed_size; 26 | 27 | level = DDZippedFileInfoCompressionLevelNone; 28 | if (info.compression_method != 0) { 29 | switch ((info.flag & 0x6) / 2) { 30 | case 0: 31 | level = DDZippedFileInfoCompressionLevelDefault; 32 | break; 33 | 34 | case 1: 35 | level = DDZippedFileInfoCompressionLevelBest; 36 | break; 37 | 38 | default: 39 | level = DDZippedFileInfoCompressionLevelFastest; 40 | break; 41 | } 42 | } 43 | 44 | crypted = ((info.flag & 1) != 0); 45 | zippedSize = info.compressed_size; 46 | date = [[self class] dateWithTimeIntervalSince1980:(NSTimeInterval)info.dosDate]; 47 | crc32 = info.crc; 48 | } 49 | return self; 50 | } 51 | 52 | 53 | #pragma mark get NSDate object for 1980-01-01 54 | 55 | +(NSDate*) dateWithTimeIntervalSince1980:(NSTimeInterval)interval 56 | { 57 | NSDateComponents *comps = [[NSDateComponents alloc] init]; 58 | [comps setDay:1]; 59 | [comps setMonth:1]; 60 | [comps setYear:1980]; 61 | NSCalendar *gregorian = [[NSCalendar alloc] 62 | initWithCalendarIdentifier:NSGregorianCalendar]; 63 | NSDate *date = [gregorian dateFromComponents:comps]; 64 | 65 | // [comps release]; 66 | // [gregorian release]; 67 | return date; 68 | } 69 | 70 | @end -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/Icon.png -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Dominik Pich 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /MountainNotifier/DDEmbeddedDataReader.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDEmbeddedDataReader.h 3 | // cocoa-interpreter 4 | // 5 | // Created by Dominik Pich on 7/15/12. 6 | // Copyright (c) 2012 info.pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DDEmbeddedDataReader : NSObject 12 | 13 | //"?", "?" 14 | + (NSData*)dataFromSegment:(NSString*)segment inSection:(NSString*)section ofExecutableAtURL:(NSURL*)url error:(NSError**)error; 15 | + (NSData*)dataFromSegment:(NSString*)segment inSection:(NSString*)section ofExecutableAtPath:(NSString*)path error:(NSError**)error; 16 | + (NSData*)embeddedDataFromSegment:(NSString*)segment inSection:(NSString*)section error:(NSError**)error; 17 | 18 | //"__TEXT", "?" 19 | + (NSData*)dataFromSection:(NSString*)section ofExecutableAtURL:(NSURL*)url error:(NSError**)error; 20 | + (NSData*)dataFromSection:(NSString*)section ofExecutableAtPath:(NSString*)path error:(NSError**)error; 21 | + (NSData*)embeddedDataFromSection:(NSString*)section error:(NSError**)error; 22 | 23 | //"__TEXT", "__info_plist" 24 | + (id)defaultPlistOfExecutableAtURL:(NSURL*)url error:(NSError**)error; 25 | + (id)defaultPlistOfExecutableAtPath:(NSString*)path error:(NSError**)error; 26 | + (id)defaultEmbeddedPlist:(NSError**)error; 27 | @end 28 | -------------------------------------------------------------------------------- /MountainNotifier/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | mountainNotifier 7 | CFBundleVersion 8 | 2 9 | CFBundleShortVersionString 10 | 1.0.1 11 | 12 | 13 | -------------------------------------------------------------------------------- /MountainNotifier/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MountainNotifier 4 | // 5 | // Created by Dominik Pich on 17.06.12. 6 | // Copyright (c) 2012 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DDEmbeddedDataReader.h" 11 | #import "DDZipReader.h" 12 | #import 13 | 14 | #pragma mark call tool 15 | 16 | int sendNotificationViaHelper(NSString *bundlePath, NSUserNotification *note ) { 17 | @try { 18 | id path = [bundlePath stringByAppendingPathComponent:@"Contents/MacOS/MountainNotifierTemplate"]; 19 | NSTask *t = [NSTask launchedTaskWithLaunchPath:path arguments:@[ note.title, note.subtitle, note.informativeText ]]; 20 | [t waitUntilExit]; 21 | return [t terminationStatus]; 22 | } 23 | @catch (NSException *exception) { 24 | return EXIT_FAILURE; 25 | } 26 | } 27 | 28 | #pragma mark write tool 29 | 30 | NSString *toolApplicationSupportPath(NSString *name) { 31 | id l = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex:0]; 32 | l = [l stringByAppendingPathComponent:name]; 33 | 34 | //make library 35 | if(![[NSFileManager defaultManager] createDirectoryAtPath:l 36 | withIntermediateDirectories:YES 37 | attributes:0 38 | error:nil]) { 39 | l = nil; 40 | } 41 | 42 | return l; 43 | } 44 | 45 | BOOL writeIcon(NSImage *icon, NSURL *url) { 46 | [[NSFileManager defaultManager] removeItemAtURL:url error:nil]; 47 | 48 | CGImageDestinationRef ref = CGImageDestinationCreateWithURL((__bridge CFURLRef)url, kUTTypeAppleICNS, 4, nil); 49 | NSRect r = NSMakeRect(0, 0, 32, 32); 50 | CGImageDestinationAddImage(ref, [icon CGImageForProposedRect:&r context:nil hints:nil], nil); 51 | r = NSMakeRect(0, 0, 64, 64); 52 | CGImageDestinationAddImage(ref, [icon CGImageForProposedRect:&r context:nil hints:nil], nil); 53 | r = NSMakeRect(0, 0, 256, 256); 54 | CGImageDestinationAddImage(ref, [icon CGImageForProposedRect:&r context:nil hints:nil], nil); 55 | r = NSMakeRect(0, 0, 512, 512); 56 | CGImageDestinationAddImage(ref, [icon CGImageForProposedRect:&r context:nil hints:nil], nil); 57 | CGImageDestinationFinalize(ref); 58 | CFRelease(ref); 59 | 60 | return [[NSFileManager defaultManager] fileExistsAtPath:url.path]; 61 | } 62 | 63 | BOOL updateInfoPlistAndFixBundle(NSString *target, NSString *name, NSString *callerKey) { 64 | NSString *path = [target stringByAppendingPathComponent:@"Contents/Info.plist"]; 65 | NSMutableDictionary *infoPlist = [NSMutableDictionary dictionaryWithContentsOfFile:path]; 66 | [infoPlist setObject:callerKey forKey:@"DDCallerKey"]; 67 | [infoPlist setObject:name forKey:@"CFBundleName"]; 68 | [infoPlist setObject:[@"NOTIFIER." stringByAppendingString:callerKey] forKey:@"CFBundleIdentifier"]; 69 | BOOL br = [infoPlist writeToFile:path atomically:NO]; 70 | 71 | if(br) { 72 | //correct file rights because minizip doesnt handle that at all 73 | NSString *exeFileName = [infoPlist objectForKey:@"CFBundleExecutable"]; 74 | path = [[target stringByAppendingPathComponent:@"Contents/MacOS"] stringByAppendingPathComponent:exeFileName]; 75 | chmod(path.UTF8String, S_IRWXU | S_IRWXG | S_IXOTH); 76 | } 77 | 78 | return br; 79 | } 80 | 81 | BOOL cloneTemplate(NSString *path, NSString *path2) { 82 | [[NSFileManager defaultManager] removeItemAtPath:path2 error:nil]; 83 | return [[NSFileManager defaultManager] copyItemAtPath:path toPath:path2 error:nil]; 84 | } 85 | 86 | BOOL unzipTemplate(NSString *zip, NSString *root) { 87 | DDZipReader* r = [DDZipReader new]; 88 | [r openZipFile:zip]; 89 | NSUInteger files = [r unzipFileTo:root flattenStructure:NO]; 90 | [r closeZipFile]; 91 | return files>0; 92 | } 93 | 94 | NSString *writeHelperIfNeeded(NSString *cwd, NSString *root, NSString *name, NSString *callerKey, NSImage *icon ) { 95 | NSString *target = [[root stringByAppendingPathComponent:name] stringByAppendingPathExtension:@"app"]; 96 | 97 | if(![[NSFileManager defaultManager] fileExistsAtPath:target]) { 98 | NSString *template = [root stringByAppendingPathComponent:@"MountainNotifierTemplate.app"]; 99 | 100 | //unzip if needed 101 | if(![[NSFileManager defaultManager] fileExistsAtPath:template]) { 102 | NSData *data = [DDEmbeddedDataReader embeddedDataFromSegment:@"__ZIP" inSection:@"__data" error:nil]; 103 | 104 | NSString *zip = [root stringByAppendingPathComponent:@"MountainNotifierTemplate.zip"]; 105 | 106 | //write, extract, delete 107 | [data writeToFile:zip atomically:NO]; 108 | BOOL bUnzip = unzipTemplate(zip, root); 109 | [[NSFileManager defaultManager] removeItemAtPath:zip error:nil]; 110 | 111 | if(!bUnzip) { 112 | return nil; 113 | } 114 | 115 | } 116 | 117 | //clone it 118 | if(!cloneTemplate(template, target)) { 119 | target = nil; 120 | } 121 | } 122 | 123 | //update by rewriting icon & plist 124 | if(target) { 125 | NSBundle *bundle = [NSBundle bundleWithPath:target]; 126 | NSURL *url = [bundle URLForResource:@"Icon" withExtension:@"icns"]; 127 | if(icon && !writeIcon(icon, url)) { 128 | target = nil; 129 | } 130 | if(!updateInfoPlistAndFixBundle(target, name, callerKey)) { 131 | target = nil; 132 | } 133 | } 134 | 135 | return target; 136 | } 137 | 138 | NSImage *readIcon(NSString *callerKey, NSString *n) { 139 | //use api 140 | NSImage *icon = [NSImage imageNamed:n]; 141 | if(!icon) { 142 | //read file 143 | icon = [[NSImage alloc] initWithContentsOfFile:n]; 144 | if(!icon) { 145 | //use workspace if n IS a file/folder 146 | if([[NSFileManager defaultManager] fileExistsAtPath:n]) { 147 | icon = [[NSWorkspace sharedWorkspace] iconForFile:n]; 148 | } 149 | if(!icon) { 150 | ///fallback to url mode 151 | NSURL *url = [NSURL URLWithString:n]; 152 | if(url) { 153 | icon = [[NSImage alloc] initWithContentsOfURL:url]; 154 | } 155 | } 156 | } 157 | } 158 | 159 | //final fallback 160 | if(!icon) { 161 | //use callerkey -- which could be a bundle 162 | NSURL* url = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:callerKey]; 163 | if(url) 164 | icon = [[NSWorkspace sharedWorkspace] iconForFile:url.path]; 165 | } 166 | 167 | return icon; 168 | } 169 | #pragma mark entry 170 | 171 | int main(int argc, const char * argv[]) 172 | { 173 | //get all args 174 | NSMutableArray *args = [NSMutableArray arrayWithCapacity:argc]; 175 | for(int i=0; i=3) { 181 | //callerKey and name 182 | NSString* callerKey = args[1]; 183 | NSString* name = nil; 184 | NSURL *url = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:callerKey]; 185 | if(url) { 186 | name = [[NSFileManager defaultManager] displayNameAtPath:url.path]; 187 | } 188 | else { 189 | url = [NSURL URLWithString:callerKey]; 190 | if(url) 191 | name = [[NSFileManager defaultManager] displayNameAtPath:url.path]; 192 | 193 | if(!name) 194 | name = [[NSFileManager defaultManager] displayNameAtPath:callerKey]; 195 | } 196 | 197 | //note 198 | NSUserNotification *note = [NSUserNotification new]; 199 | note.title = args[2]; 200 | if(args.count>=4) { 201 | note.subtitle = args[3]; 202 | } 203 | if(args.count>=5) { 204 | note.informativeText = args[4]; 205 | } 206 | 207 | //get icon 208 | NSImage *icon = nil; 209 | if(args.count>=6) { 210 | icon = readIcon(callerKey, args[5]); 211 | } else { 212 | icon = readIcon(callerKey, nil); 213 | } 214 | 215 | #ifdef DEBUG 216 | //log 217 | printf("%s will proxy:\n \ 218 | callerkey: %s\n \ 219 | name: %s\n \ 220 | title: %s\n \ 221 | subtitle: %s\n \ 222 | information: %s\n \ 223 | icon: %s\n", tool.lastPathComponent.UTF8String, callerKey.UTF8String, name.UTF8String, note.title.UTF8String, note.subtitle.UTF8String, note.informativeText.UTF8String, (argc>=6?argv[5] : (icon?"from caller bundle":"none"))); 224 | #endif 225 | 226 | //write & call 227 | id root = toolApplicationSupportPath(tool.lastPathComponent); 228 | if(root) { 229 | id cwd = [tool stringByDeletingLastPathComponent]; 230 | NSString* path = writeHelperIfNeeded(cwd, root, name, callerKey, icon); 231 | if(path) { 232 | #ifdef DEBUG 233 | printf("tool will call newly created helper app at %s\n", path.UTF8String); 234 | #endif 235 | return sendNotificationViaHelper(path, note); 236 | } 237 | } 238 | } 239 | else { 240 | //log 241 | printf("Usage: %s caller(id|path|url) title [subtitle] [information] [icon(name|path|url)]\n", tool.lastPathComponent.UTF8String); 242 | } 243 | 244 | return EXIT_FAILURE; 245 | } -------------------------------------------------------------------------------- /MountainNotifierTemplate/DDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDAppDelegate.h 3 | // bundledNotifier 4 | // 5 | // Created by Dominik Pich on 14.06.12. 6 | // Copyright (c) 2012 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DDAppDelegate : NSObject 12 | @end 13 | -------------------------------------------------------------------------------- /MountainNotifierTemplate/DDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // DDAppDelegate.m 3 | // bundledNotifier 4 | // 5 | // Created by Dominik Pich on 14.06.12. 6 | // Copyright (c) 2012 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import "DDAppDelegate.h" 10 | 11 | @implementation DDAppDelegate 12 | 13 | -(BOOL)sendNotification:(NSUserNotification*)note { 14 | if([note.title isEqualToString:@"-"]) 15 | note.title = nil; 16 | if([note.subtitle isEqualToString:@"-"]) 17 | note.subtitle = nil; 18 | if([note.informativeText isEqualToString:@"-"]) 19 | note.informativeText = nil; 20 | [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:self]; 21 | [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:note]; 22 | return note.presented; 23 | } 24 | 25 | - (void)finishBySendingNote { 26 | NSArray *args = [[NSProcessInfo processInfo] arguments]; 27 | #ifdef DEBUG 28 | NSLog(@"log helper args: %@", args); 29 | #endif 30 | 31 | if(args.count>=2) { 32 | NSUserNotification *note = [NSUserNotification new]; 33 | 34 | id tag = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"DDCallerKey"]; 35 | note.userInfo = @{ @"DDCallerKey" : tag }; 36 | 37 | note.title = args[1]; 38 | if(args.count>=3) { 39 | note.subtitle = args[2]; 40 | } 41 | if(args.count>=4) { 42 | note.informativeText = args[3]; 43 | } 44 | 45 | [self sendNotification:note]; 46 | } 47 | else { 48 | printf("Usage: %s title [subtitle] [information]", [args[0] lastPathComponent].UTF8String); 49 | } 50 | } 51 | 52 | - (void)finishByLaunchingCaller { 53 | NSString* callerKey = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"DDCallerKey"]; 54 | NSURL *url = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:callerKey]; 55 | if(url) { 56 | #ifdef DEBUG 57 | NSLog(@"Launch app at %@", url); 58 | #endif 59 | [[NSWorkspace sharedWorkspace] launchApplicationAtURL:url options:0 configuration:nil error:nil]; 60 | } 61 | else { 62 | BOOL br = NO; 63 | url = [NSURL URLWithString:callerKey]; 64 | if(url) { 65 | #ifdef DEBUG 66 | NSLog(@"Open URL at %@", url); 67 | #endif 68 | br = [[NSWorkspace sharedWorkspace] openURL:url]; 69 | } 70 | 71 | if(!br) { 72 | [[NSWorkspace sharedWorkspace] openFile:callerKey]; 73 | } 74 | } 75 | } 76 | 77 | #pragma mark - NSUserNotificationCenter delegate 78 | 79 | - (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification { 80 | return YES; 81 | } 82 | 83 | - (void)userNotificationCenter:(NSUserNotificationCenter *)center didDeliverNotification:(NSUserNotification *)notification { 84 | } 85 | 86 | #pragma mark - NSApplication delegate 87 | 88 | - (void)applicationDidFinishLaunching:(NSNotification *)notification { 89 | if(notification.userInfo[NSApplicationLaunchUserNotificationKey]) 90 | [self finishByLaunchingCaller]; 91 | else 92 | [self finishBySendingNote]; 93 | [NSApp terminate:nil]; 94 | } 95 | 96 | @end -------------------------------------------------------------------------------- /MountainNotifierTemplate/Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/MountainNotifierTemplate/Icon.icns -------------------------------------------------------------------------------- /MountainNotifierTemplate/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | Icon.icns 11 | CFBundleIdentifier 12 | info.pich.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 2 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | DDCallerKey 28 | info.pich.dummy 29 | NSHumanReadableCopyright 30 | Copyright © 2012 Dominik Pich. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | LSUIElement 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /MountainNotifierTemplate/Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'bundledNotifier' target in the 'bundledNotifier' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /MountainNotifierTemplate/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /MountainNotifierTemplate/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /MountainNotifierTemplate/en.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1080 5 | 12A239 6 | 2541 7 | 1179.1 8 | 620.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2541 12 | 13 | 14 | NSCustomObject 15 | 16 | 17 | com.apple.InterfaceBuilder.CocoaPlugin 18 | 19 | 20 | PluginDependencyRecalculationVersion 21 | 22 | 23 | 24 | 25 | NSApplication 26 | 27 | 28 | FirstResponder 29 | 30 | 31 | NSApplication 32 | 33 | 34 | DDAppDelegate 35 | 36 | 37 | 38 | 39 | 40 | 41 | delegate 42 | 43 | 44 | 45 | 495 46 | 47 | 48 | 49 | 50 | 51 | 0 52 | 53 | 54 | 55 | 56 | 57 | -2 58 | 59 | 60 | File's Owner 61 | 62 | 63 | -1 64 | 65 | 66 | First Responder 67 | 68 | 69 | -3 70 | 71 | 72 | Application 73 | 74 | 75 | 494 76 | 77 | 78 | 79 | 80 | 81 | 82 | com.apple.InterfaceBuilder.CocoaPlugin 83 | com.apple.InterfaceBuilder.CocoaPlugin 84 | com.apple.InterfaceBuilder.CocoaPlugin 85 | com.apple.InterfaceBuilder.CocoaPlugin 86 | 87 | 88 | 89 | 90 | 91 | 535 92 | 93 | 94 | 95 | 96 | DDAppDelegate 97 | NSObject 98 | 99 | window 100 | NSWindow 101 | 102 | 103 | window 104 | 105 | window 106 | NSWindow 107 | 108 | 109 | 110 | IBProjectSource 111 | ./Classes/DDAppDelegate.h 112 | 113 | 114 | 115 | 116 | 0 117 | IBCocoaFramework 118 | YES 119 | 3 120 | YES 121 | 122 | 123 | -------------------------------------------------------------------------------- /MountainNotifierTemplate/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // bundledNotifier 4 | // 5 | // Created by Dominik Pich on 14.06.12. 6 | // Copyright (c) 2012 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /MountainNotifierTemplate/zipHelper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $BUILT_PRODUCTS_DIR 4 | mkdir tmp 5 | cp -R MountainNotifierTemplate.app ./tmp/ 6 | cd tmp 7 | zip -r MountainNotifierTemplate.zip . 8 | mv MountainNotifierTemplate.zip $PROJECT_DIR 9 | cd .. 10 | rm -r tmp -------------------------------------------------------------------------------- /MountianGrowlPlugin/GrowlMountainNotifierDisplay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/MountianGrowlPlugin/GrowlMountainNotifierDisplay.h -------------------------------------------------------------------------------- /MountianGrowlPlugin/GrowlMountainNotifierDisplay.m: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlMountainNotifierDisplay.m 3 | // Growl Display Plugins 4 | // 5 | // Created by Dominik Pich 6 | // Copyright 2005–2011 The Growl Project All rights reserved. 7 | // 8 | #import "GrowlMountainNotifierDisplay.h" 9 | #import "GrowlMountainNotifierPrefs.h" 10 | #import "NSStringAdditions.h" 11 | #import "GrowlDefinesInternal.h" 12 | #import "GrowlNotification.h" 13 | #import "GrowlTicketController.h" 14 | #import "GrowlApplicationTicket.h" 15 | #include 16 | #include 17 | 18 | 19 | @implementation GrowlMountainNotifierDisplay 20 | 21 | - (void) dealloc { 22 | [preferencePane release]; 23 | [super dealloc]; 24 | } 25 | 26 | - (NSPreferencePane *) preferencePane { 27 | if (!preferencePane) 28 | preferencePane = [[GrowlMountainNotifierPrefs alloc] initWithBundle:[NSBundle bundleWithIdentifier:@"com.Growl.MountainNotifier"]]; 29 | return preferencePane; 30 | } 31 | 32 | - (void) displayNotification:(GrowlNotification *)notification { 33 | NSString *path = [[NSBundle bundleWithIdentifier:@"com.Growl.MountainNotifier"] pathForResource:@"MountainNotifier" ofType:nil]; 34 | 35 | //name 36 | NSString *name = notification.applicationName; 37 | if(!name) { 38 | if (notification.name) { 39 | NSLog(@"Fallback to using note name as name"); 40 | name = notification.name; 41 | } 42 | else if(notification.identifier) { 43 | NSLog(@"Fallback to using identifier as name"); 44 | name = notification.identifier; 45 | } 46 | else { 47 | NSLog(@"Fallback to using constant as name"); 48 | name = @"com.Growl.MountainNotifier"; 49 | } 50 | } 51 | 52 | //title 53 | NSString *title = notification.title; 54 | if(!title.length) 55 | title = @"-"; 56 | 57 | //no subtitle 58 | NSString *subtitle = @"-"; 59 | 60 | if(title.length>20) { 61 | subtitle = title; 62 | title = @"-"; 63 | } 64 | 65 | //msg 66 | NSString *message = notification.messageText; 67 | if(!message.length) 68 | message = @"-"; 69 | 70 | //always revert to appicon! 71 | notification.icon = nil; 72 | id data=[notification.auxiliaryDictionary objectForKey:GROWL_APP_ICON_DATA]; 73 | if(!data) 74 | data=[notification.auxiliaryDictionary objectForKey:GROWL_NOTIFICATION_APP_ICON_DATA]; 75 | if(!data) { 76 | NSString *appName = notification.applicationName; 77 | if(appName.length) { 78 | GrowlApplicationTicket *ticket = [[GrowlTicketController sharedController] ticketForApplicationName:appName hostName:nil]; 79 | data = ticket.iconData; 80 | } 81 | } 82 | 83 | if(data) { 84 | notification.icon = [[[NSImage alloc] initWithData:data] autorelease]; 85 | } 86 | 87 | //icon 88 | NSString *iconpath = nil; 89 | if(notification.icon) { 90 | iconpath = [NSTemporaryDirectory() stringByAppendingPathComponent: [[NSProcessInfo processInfo] globallyUniqueString]]; 91 | [[notification.icon TIFFRepresentation] writeToFile:iconpath atomically:NO]; 92 | } 93 | else { 94 | //NO ICON - Fallback 95 | iconpath = [[NSBundle mainBundle] pathForResource:@"Growl" ofType:@"icns"]; 96 | } 97 | 98 | //launch tool 99 | NSTask *tool = [NSTask launchedTaskWithLaunchPath:path arguments:[NSArray arrayWithObjects:name, title, subtitle, message, iconpath, nil]]; 100 | [tool waitUntilExit]; 101 | 102 | //if we wrote an icon, clean up 103 | if(notification.icon) 104 | [[NSFileManager defaultManager] removeItemAtPath:iconpath error:nil]; 105 | } 106 | 107 | - (BOOL) requiresPositioning { 108 | return NO; 109 | } 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/GrowlMountainNotifierPrefs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/MountianGrowlPlugin/GrowlMountainNotifierPrefs.h -------------------------------------------------------------------------------- /MountianGrowlPlugin/GrowlMountainNotifierPrefs.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/MountianGrowlPlugin/GrowlMountainNotifierPrefs.m -------------------------------------------------------------------------------- /MountianGrowlPlugin/MountianGrowlPlugin-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | MountianGrowlPlugin 9 | CFBundleIdentifier 10 | com.Growl.MountainNotifier 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | DISP 15 | CFBundleSignature 16 | GRRR 17 | CFBundleVersion 18 | 0.7 19 | CSResourcesFileMapped 20 | yes 21 | NSPrincipalClass 22 | GrowlMountainNotifierDisplay 23 | CFBundleName 24 | MountainNotifier 25 | GrowlPluginAuthor 26 | Dominik Pich 27 | GrowlPluginDescription 28 | Send notifications to mountain lion notification center 29 | 30 | 31 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/MountianGrowlPlugin-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Display Plugins' target in the 'Display Plugins' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | # import 7 | # import "GrowlDefines.h" 8 | # import "GrowlDefinesInternal.h" 9 | #endif 10 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/cs.lproj/GrowlMountainNotifierPrefs.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1030 5 | 12A269 6 | 2829 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2829 12 | 13 | 14 | YES 15 | NSCustomObject 16 | NSTextField 17 | NSTextFieldCell 18 | NSView 19 | NSWindowTemplate 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.CocoaPlugin 24 | 25 | 26 | PluginDependencyRecalculationVersion 27 | 28 | 29 | 30 | YES 31 | 32 | GrowlMountainNotifierPrefs 33 | 34 | 35 | FirstResponder 36 | 37 | 38 | NSApplication 39 | 40 | 41 | 15 42 | 2 43 | {{118, 400}, {354, 289}} 44 | 1886912512 45 | 46 | Window 47 | 48 | NSWindow 49 | 50 | View 51 | 52 | 53 | {213, 107} 54 | 55 | 56 | 256 57 | 58 | YES 59 | 60 | 61 | 256 62 | {{17, 244}, {310, 25}} 63 | 64 | 65 | 66 | YES 67 | 68 | 67108864 69 | 272629760 70 | Mountain Lion Notifications 71 | 72 | LucidaGrande 73 | 13 74 | 1044 75 | 76 | 77 | 78 | 6 79 | System 80 | controlColor 81 | 82 | 3 83 | MC42NjY2NjY2NjY3AA 84 | 85 | 86 | 87 | 6 88 | System 89 | controlTextColor 90 | 91 | 3 92 | MAA 93 | 94 | 95 | 96 | NO 97 | 98 | 99 | 100 | 256 101 | {{17, 132}, {299, 104}} 102 | 103 | 104 | YES 105 | 106 | 67108864 107 | 272629760 108 | dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp 109 | ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh 110 | YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv 111 | biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp 112 | ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA 113 | 114 | LucidaGrande 115 | 10 116 | 2843 117 | 118 | 119 | 120 | 121 | 122 | NO 123 | 124 | 125 | {354, 289} 126 | 127 | 128 | 129 | 130 | {{0, 0}, {1440, 878}} 131 | {213, 129} 132 | {10000000000000, 10000000000000} 133 | YES 134 | 135 | 136 | 137 | 138 | YES 139 | 140 | 141 | _window 142 | 143 | 144 | 145 | 36 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | 0 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | 160 | -2 161 | 162 | 163 | File's Owner 164 | 165 | 166 | -1 167 | 168 | 169 | First Responder 170 | 171 | 172 | 5 173 | 174 | 175 | YES 176 | 177 | 178 | 179 | Window 180 | 181 | 182 | 6 183 | 184 | 185 | YES 186 | 187 | 188 | 189 | 190 | 191 | 192 | -3 193 | 194 | 195 | Application 196 | 197 | 198 | 117 199 | 200 | 201 | YES 202 | 203 | 204 | 205 | 206 | 207 | 118 208 | 209 | 210 | YES 211 | 212 | 213 | 214 | 215 | 216 | 119 217 | 218 | 219 | 220 | 221 | 120 222 | 223 | 224 | 225 | 226 | 227 | 228 | YES 229 | 230 | YES 231 | -1.IBPluginDependency 232 | -2.IBPluginDependency 233 | -3.IBPluginDependency 234 | 117.IBPluginDependency 235 | 118.IBPluginDependency 236 | 119.IBPluginDependency 237 | 120.IBPluginDependency 238 | 5.IBPluginDependency 239 | 6.IBPluginDependency 240 | 241 | 242 | YES 243 | com.apple.InterfaceBuilder.CocoaPlugin 244 | com.apple.InterfaceBuilder.CocoaPlugin 245 | com.apple.InterfaceBuilder.CocoaPlugin 246 | com.apple.InterfaceBuilder.CocoaPlugin 247 | com.apple.InterfaceBuilder.CocoaPlugin 248 | com.apple.InterfaceBuilder.CocoaPlugin 249 | com.apple.InterfaceBuilder.CocoaPlugin 250 | com.apple.InterfaceBuilder.CocoaPlugin 251 | com.apple.InterfaceBuilder.CocoaPlugin 252 | 253 | 254 | 255 | YES 256 | 257 | 258 | 259 | 260 | 261 | YES 262 | 263 | 264 | 265 | 266 | 120 267 | 268 | 269 | 270 | YES 271 | 272 | GrowlMountainNotifierPrefs 273 | NSPreferencePane 274 | 275 | IBProjectSource 276 | ./Classes/GrowlMountainNotifierPrefs.h 277 | 278 | 279 | 280 | NSPreferencePane 281 | NSObject 282 | 283 | YES 284 | 285 | YES 286 | _firstKeyView 287 | _initialKeyView 288 | _lastKeyView 289 | _window 290 | 291 | 292 | YES 293 | NSView 294 | NSView 295 | NSView 296 | NSWindow 297 | 298 | 299 | 300 | YES 301 | 302 | YES 303 | _firstKeyView 304 | _initialKeyView 305 | _lastKeyView 306 | _window 307 | 308 | 309 | YES 310 | 311 | _firstKeyView 312 | NSView 313 | 314 | 315 | _initialKeyView 316 | NSView 317 | 318 | 319 | _lastKeyView 320 | NSView 321 | 322 | 323 | _window 324 | NSWindow 325 | 326 | 327 | 328 | 329 | IBProjectSource 330 | ./Classes/NSPreferencePane.h 331 | 332 | 333 | 334 | 335 | 0 336 | IBCocoaFramework 337 | 338 | com.apple.InterfaceBuilder.CocoaPlugin.macosx 339 | 340 | 341 | 342 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 343 | 344 | 345 | YES 346 | 3 347 | 348 | 349 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/da.lproj/GrowlMountainNotifierPrefs.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1030 5 | 12A269 6 | 2829 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2829 12 | 13 | 14 | YES 15 | NSCustomObject 16 | NSTextField 17 | NSTextFieldCell 18 | NSView 19 | NSWindowTemplate 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.CocoaPlugin 24 | 25 | 26 | PluginDependencyRecalculationVersion 27 | 28 | 29 | 30 | YES 31 | 32 | GrowlMountainNotifierPrefs 33 | 34 | 35 | FirstResponder 36 | 37 | 38 | NSApplication 39 | 40 | 41 | 15 42 | 2 43 | {{118, 400}, {354, 289}} 44 | 1886912512 45 | 46 | Window 47 | 48 | NSWindow 49 | 50 | View 51 | 52 | 53 | {213, 107} 54 | 55 | 56 | 256 57 | 58 | YES 59 | 60 | 61 | 256 62 | {{17, 244}, {310, 25}} 63 | 64 | 65 | 66 | YES 67 | 68 | 67108864 69 | 272629760 70 | Mountain Lion Notifications 71 | 72 | LucidaGrande 73 | 13 74 | 1044 75 | 76 | 77 | 78 | 6 79 | System 80 | controlColor 81 | 82 | 3 83 | MC42NjY2NjY2NjY3AA 84 | 85 | 86 | 87 | 6 88 | System 89 | controlTextColor 90 | 91 | 3 92 | MAA 93 | 94 | 95 | 96 | NO 97 | 98 | 99 | 100 | 256 101 | {{17, 132}, {299, 104}} 102 | 103 | 104 | YES 105 | 106 | 67108864 107 | 272629760 108 | dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp 109 | ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh 110 | YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv 111 | biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp 112 | ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA 113 | 114 | LucidaGrande 115 | 10 116 | 2843 117 | 118 | 119 | 120 | 121 | 122 | NO 123 | 124 | 125 | {354, 289} 126 | 127 | 128 | 129 | 130 | {{0, 0}, {1440, 878}} 131 | {213, 129} 132 | {10000000000000, 10000000000000} 133 | YES 134 | 135 | 136 | 137 | 138 | YES 139 | 140 | 141 | _window 142 | 143 | 144 | 145 | 36 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | 0 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | 160 | -2 161 | 162 | 163 | File's Owner 164 | 165 | 166 | -1 167 | 168 | 169 | First Responder 170 | 171 | 172 | 5 173 | 174 | 175 | YES 176 | 177 | 178 | 179 | Window 180 | 181 | 182 | 6 183 | 184 | 185 | YES 186 | 187 | 188 | 189 | 190 | 191 | 192 | -3 193 | 194 | 195 | Application 196 | 197 | 198 | 117 199 | 200 | 201 | YES 202 | 203 | 204 | 205 | 206 | 207 | 118 208 | 209 | 210 | YES 211 | 212 | 213 | 214 | 215 | 216 | 119 217 | 218 | 219 | 220 | 221 | 120 222 | 223 | 224 | 225 | 226 | 227 | 228 | YES 229 | 230 | YES 231 | -1.IBPluginDependency 232 | -2.IBPluginDependency 233 | -3.IBPluginDependency 234 | 117.IBPluginDependency 235 | 118.IBPluginDependency 236 | 119.IBPluginDependency 237 | 120.IBPluginDependency 238 | 5.IBPluginDependency 239 | 6.IBPluginDependency 240 | 241 | 242 | YES 243 | com.apple.InterfaceBuilder.CocoaPlugin 244 | com.apple.InterfaceBuilder.CocoaPlugin 245 | com.apple.InterfaceBuilder.CocoaPlugin 246 | com.apple.InterfaceBuilder.CocoaPlugin 247 | com.apple.InterfaceBuilder.CocoaPlugin 248 | com.apple.InterfaceBuilder.CocoaPlugin 249 | com.apple.InterfaceBuilder.CocoaPlugin 250 | com.apple.InterfaceBuilder.CocoaPlugin 251 | com.apple.InterfaceBuilder.CocoaPlugin 252 | 253 | 254 | 255 | YES 256 | 257 | 258 | 259 | 260 | 261 | YES 262 | 263 | 264 | 265 | 266 | 120 267 | 268 | 269 | 270 | YES 271 | 272 | GrowlMountainNotifierPrefs 273 | NSPreferencePane 274 | 275 | IBProjectSource 276 | ./Classes/GrowlMountainNotifierPrefs.h 277 | 278 | 279 | 280 | NSPreferencePane 281 | NSObject 282 | 283 | YES 284 | 285 | YES 286 | _firstKeyView 287 | _initialKeyView 288 | _lastKeyView 289 | _window 290 | 291 | 292 | YES 293 | NSView 294 | NSView 295 | NSView 296 | NSWindow 297 | 298 | 299 | 300 | YES 301 | 302 | YES 303 | _firstKeyView 304 | _initialKeyView 305 | _lastKeyView 306 | _window 307 | 308 | 309 | YES 310 | 311 | _firstKeyView 312 | NSView 313 | 314 | 315 | _initialKeyView 316 | NSView 317 | 318 | 319 | _lastKeyView 320 | NSView 321 | 322 | 323 | _window 324 | NSWindow 325 | 326 | 327 | 328 | 329 | IBProjectSource 330 | ./Classes/NSPreferencePane.h 331 | 332 | 333 | 334 | 335 | 0 336 | IBCocoaFramework 337 | 338 | com.apple.InterfaceBuilder.CocoaPlugin.macosx 339 | 340 | 341 | 342 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 343 | 344 | 345 | YES 346 | 3 347 | 348 | 349 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/de.lproj/GrowlMountainNotifierPrefs.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1030 5 | 12A269 6 | 2829 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2829 12 | 13 | 14 | YES 15 | NSCustomObject 16 | NSTextField 17 | NSTextFieldCell 18 | NSView 19 | NSWindowTemplate 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.CocoaPlugin 24 | 25 | 26 | PluginDependencyRecalculationVersion 27 | 28 | 29 | 30 | YES 31 | 32 | GrowlMountainNotifierPrefs 33 | 34 | 35 | FirstResponder 36 | 37 | 38 | NSApplication 39 | 40 | 41 | 15 42 | 2 43 | {{118, 400}, {354, 289}} 44 | 1886912512 45 | 46 | Window 47 | 48 | NSWindow 49 | 50 | View 51 | 52 | 53 | {213, 107} 54 | 55 | 56 | 256 57 | 58 | YES 59 | 60 | 61 | 256 62 | {{17, 244}, {310, 25}} 63 | 64 | 65 | 66 | YES 67 | 68 | 67108864 69 | 272629760 70 | Mountain Lion Notifications 71 | 72 | LucidaGrande 73 | 13 74 | 1044 75 | 76 | 77 | 78 | 6 79 | System 80 | controlColor 81 | 82 | 3 83 | MC42NjY2NjY2NjY3AA 84 | 85 | 86 | 87 | 6 88 | System 89 | controlTextColor 90 | 91 | 3 92 | MAA 93 | 94 | 95 | 96 | NO 97 | 98 | 99 | 100 | 256 101 | {{17, 132}, {299, 104}} 102 | 103 | 104 | YES 105 | 106 | 67108864 107 | 272629760 108 | dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp 109 | ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh 110 | YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv 111 | biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp 112 | ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA 113 | 114 | LucidaGrande 115 | 10 116 | 2843 117 | 118 | 119 | 120 | 121 | 122 | NO 123 | 124 | 125 | {354, 289} 126 | 127 | 128 | 129 | 130 | {{0, 0}, {1440, 878}} 131 | {213, 129} 132 | {10000000000000, 10000000000000} 133 | YES 134 | 135 | 136 | 137 | 138 | YES 139 | 140 | 141 | _window 142 | 143 | 144 | 145 | 36 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | 0 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | 160 | -2 161 | 162 | 163 | File's Owner 164 | 165 | 166 | -1 167 | 168 | 169 | First Responder 170 | 171 | 172 | 5 173 | 174 | 175 | YES 176 | 177 | 178 | 179 | Window 180 | 181 | 182 | 6 183 | 184 | 185 | YES 186 | 187 | 188 | 189 | 190 | 191 | 192 | -3 193 | 194 | 195 | Application 196 | 197 | 198 | 117 199 | 200 | 201 | YES 202 | 203 | 204 | 205 | 206 | 207 | 118 208 | 209 | 210 | YES 211 | 212 | 213 | 214 | 215 | 216 | 119 217 | 218 | 219 | 220 | 221 | 120 222 | 223 | 224 | 225 | 226 | 227 | 228 | YES 229 | 230 | YES 231 | -1.IBPluginDependency 232 | -2.IBPluginDependency 233 | -3.IBPluginDependency 234 | 117.IBPluginDependency 235 | 118.IBPluginDependency 236 | 119.IBPluginDependency 237 | 120.IBPluginDependency 238 | 5.IBPluginDependency 239 | 6.IBPluginDependency 240 | 241 | 242 | YES 243 | com.apple.InterfaceBuilder.CocoaPlugin 244 | com.apple.InterfaceBuilder.CocoaPlugin 245 | com.apple.InterfaceBuilder.CocoaPlugin 246 | com.apple.InterfaceBuilder.CocoaPlugin 247 | com.apple.InterfaceBuilder.CocoaPlugin 248 | com.apple.InterfaceBuilder.CocoaPlugin 249 | com.apple.InterfaceBuilder.CocoaPlugin 250 | com.apple.InterfaceBuilder.CocoaPlugin 251 | com.apple.InterfaceBuilder.CocoaPlugin 252 | 253 | 254 | 255 | YES 256 | 257 | 258 | 259 | 260 | 261 | YES 262 | 263 | 264 | 265 | 266 | 120 267 | 268 | 269 | 270 | YES 271 | 272 | GrowlMountainNotifierPrefs 273 | NSPreferencePane 274 | 275 | IBProjectSource 276 | ./Classes/GrowlMountainNotifierPrefs.h 277 | 278 | 279 | 280 | NSPreferencePane 281 | NSObject 282 | 283 | YES 284 | 285 | YES 286 | _firstKeyView 287 | _initialKeyView 288 | _lastKeyView 289 | _window 290 | 291 | 292 | YES 293 | NSView 294 | NSView 295 | NSView 296 | NSWindow 297 | 298 | 299 | 300 | YES 301 | 302 | YES 303 | _firstKeyView 304 | _initialKeyView 305 | _lastKeyView 306 | _window 307 | 308 | 309 | YES 310 | 311 | _firstKeyView 312 | NSView 313 | 314 | 315 | _initialKeyView 316 | NSView 317 | 318 | 319 | _lastKeyView 320 | NSView 321 | 322 | 323 | _window 324 | NSWindow 325 | 326 | 327 | 328 | 329 | IBProjectSource 330 | ./Classes/NSPreferencePane.h 331 | 332 | 333 | 334 | 335 | 0 336 | IBCocoaFramework 337 | 338 | com.apple.InterfaceBuilder.CocoaPlugin.macosx 339 | 340 | 341 | 342 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 343 | 344 | 345 | YES 346 | 3 347 | 348 | 349 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/el.lproj/GrowlMountainNotifierPrefs.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1030 5 | 12A269 6 | 2829 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2829 12 | 13 | 14 | YES 15 | NSCustomObject 16 | NSTextField 17 | NSTextFieldCell 18 | NSView 19 | NSWindowTemplate 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.CocoaPlugin 24 | 25 | 26 | PluginDependencyRecalculationVersion 27 | 28 | 29 | 30 | YES 31 | 32 | GrowlMountainNotifierPrefs 33 | 34 | 35 | FirstResponder 36 | 37 | 38 | NSApplication 39 | 40 | 41 | 15 42 | 2 43 | {{118, 400}, {354, 289}} 44 | 1886912512 45 | 46 | Window 47 | 48 | NSWindow 49 | 50 | View 51 | 52 | 53 | {213, 107} 54 | 55 | 56 | 256 57 | 58 | YES 59 | 60 | 61 | 256 62 | {{17, 244}, {310, 25}} 63 | 64 | 65 | 66 | YES 67 | 68 | 67108864 69 | 272629760 70 | Mountain Lion Notifications 71 | 72 | LucidaGrande 73 | 13 74 | 1044 75 | 76 | 77 | 78 | 6 79 | System 80 | controlColor 81 | 82 | 3 83 | MC42NjY2NjY2NjY3AA 84 | 85 | 86 | 87 | 6 88 | System 89 | controlTextColor 90 | 91 | 3 92 | MAA 93 | 94 | 95 | 96 | NO 97 | 98 | 99 | 100 | 256 101 | {{17, 132}, {299, 104}} 102 | 103 | 104 | YES 105 | 106 | 67108864 107 | 272629760 108 | dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp 109 | ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh 110 | YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv 111 | biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp 112 | ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA 113 | 114 | LucidaGrande 115 | 10 116 | 2843 117 | 118 | 119 | 120 | 121 | 122 | NO 123 | 124 | 125 | {354, 289} 126 | 127 | 128 | 129 | 130 | {{0, 0}, {1440, 878}} 131 | {213, 129} 132 | {10000000000000, 10000000000000} 133 | YES 134 | 135 | 136 | 137 | 138 | YES 139 | 140 | 141 | _window 142 | 143 | 144 | 145 | 36 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | 0 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | 160 | -2 161 | 162 | 163 | File's Owner 164 | 165 | 166 | -1 167 | 168 | 169 | First Responder 170 | 171 | 172 | 5 173 | 174 | 175 | YES 176 | 177 | 178 | 179 | Window 180 | 181 | 182 | 6 183 | 184 | 185 | YES 186 | 187 | 188 | 189 | 190 | 191 | 192 | -3 193 | 194 | 195 | Application 196 | 197 | 198 | 117 199 | 200 | 201 | YES 202 | 203 | 204 | 205 | 206 | 207 | 118 208 | 209 | 210 | YES 211 | 212 | 213 | 214 | 215 | 216 | 119 217 | 218 | 219 | 220 | 221 | 120 222 | 223 | 224 | 225 | 226 | 227 | 228 | YES 229 | 230 | YES 231 | -1.IBPluginDependency 232 | -2.IBPluginDependency 233 | -3.IBPluginDependency 234 | 117.IBPluginDependency 235 | 118.IBPluginDependency 236 | 119.IBPluginDependency 237 | 120.IBPluginDependency 238 | 5.IBPluginDependency 239 | 6.IBPluginDependency 240 | 241 | 242 | YES 243 | com.apple.InterfaceBuilder.CocoaPlugin 244 | com.apple.InterfaceBuilder.CocoaPlugin 245 | com.apple.InterfaceBuilder.CocoaPlugin 246 | com.apple.InterfaceBuilder.CocoaPlugin 247 | com.apple.InterfaceBuilder.CocoaPlugin 248 | com.apple.InterfaceBuilder.CocoaPlugin 249 | com.apple.InterfaceBuilder.CocoaPlugin 250 | com.apple.InterfaceBuilder.CocoaPlugin 251 | com.apple.InterfaceBuilder.CocoaPlugin 252 | 253 | 254 | 255 | YES 256 | 257 | 258 | 259 | 260 | 261 | YES 262 | 263 | 264 | 265 | 266 | 120 267 | 268 | 269 | 270 | YES 271 | 272 | GrowlMountainNotifierPrefs 273 | NSPreferencePane 274 | 275 | IBProjectSource 276 | ./Classes/GrowlMountainNotifierPrefs.h 277 | 278 | 279 | 280 | NSPreferencePane 281 | NSObject 282 | 283 | YES 284 | 285 | YES 286 | _firstKeyView 287 | _initialKeyView 288 | _lastKeyView 289 | _window 290 | 291 | 292 | YES 293 | NSView 294 | NSView 295 | NSView 296 | NSWindow 297 | 298 | 299 | 300 | YES 301 | 302 | YES 303 | _firstKeyView 304 | _initialKeyView 305 | _lastKeyView 306 | _window 307 | 308 | 309 | YES 310 | 311 | _firstKeyView 312 | NSView 313 | 314 | 315 | _initialKeyView 316 | NSView 317 | 318 | 319 | _lastKeyView 320 | NSView 321 | 322 | 323 | _window 324 | NSWindow 325 | 326 | 327 | 328 | 329 | IBProjectSource 330 | ./Classes/NSPreferencePane.h 331 | 332 | 333 | 334 | 335 | 0 336 | IBCocoaFramework 337 | 338 | com.apple.InterfaceBuilder.CocoaPlugin.macosx 339 | 340 | 341 | 342 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 343 | 344 | 345 | YES 346 | 3 347 | 348 | 349 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/en.lproj/GrowlMountainNotifierPrefs.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1030 5 | 12A269 6 | 2829 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2829 12 | 13 | 14 | YES 15 | NSCustomObject 16 | NSTextField 17 | NSTextFieldCell 18 | NSView 19 | NSWindowTemplate 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.CocoaPlugin 24 | 25 | 26 | PluginDependencyRecalculationVersion 27 | 28 | 29 | 30 | YES 31 | 32 | GrowlMountainNotifierPrefs 33 | 34 | 35 | FirstResponder 36 | 37 | 38 | NSApplication 39 | 40 | 41 | 15 42 | 2 43 | {{118, 400}, {354, 289}} 44 | 1886912512 45 | 46 | Window 47 | 48 | NSWindow 49 | 50 | View 51 | 52 | 53 | {213, 107} 54 | 55 | 56 | 256 57 | 58 | YES 59 | 60 | 61 | 256 62 | {{17, 244}, {310, 25}} 63 | 64 | 65 | 66 | YES 67 | 68 | 67108864 69 | 272629760 70 | Mountain Lion Notifications 71 | 72 | LucidaGrande 73 | 13 74 | 1044 75 | 76 | 77 | 78 | 6 79 | System 80 | controlColor 81 | 82 | 3 83 | MC42NjY2NjY2NjY3AA 84 | 85 | 86 | 87 | 6 88 | System 89 | controlTextColor 90 | 91 | 3 92 | MAA 93 | 94 | 95 | 96 | NO 97 | 98 | 99 | 100 | 256 101 | {{17, 132}, {299, 104}} 102 | 103 | 104 | YES 105 | 106 | 67108864 107 | 272629760 108 | dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp 109 | ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh 110 | YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv 111 | biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp 112 | ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA 113 | 114 | LucidaGrande 115 | 10 116 | 2843 117 | 118 | 119 | 120 | 121 | 122 | NO 123 | 124 | 125 | {354, 289} 126 | 127 | 128 | 129 | 130 | {{0, 0}, {1440, 878}} 131 | {213, 129} 132 | {10000000000000, 10000000000000} 133 | YES 134 | 135 | 136 | 137 | 138 | YES 139 | 140 | 141 | _window 142 | 143 | 144 | 145 | 36 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | 0 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | 160 | -2 161 | 162 | 163 | File's Owner 164 | 165 | 166 | -1 167 | 168 | 169 | First Responder 170 | 171 | 172 | 5 173 | 174 | 175 | YES 176 | 177 | 178 | 179 | Window 180 | 181 | 182 | 6 183 | 184 | 185 | YES 186 | 187 | 188 | 189 | 190 | 191 | 192 | -3 193 | 194 | 195 | Application 196 | 197 | 198 | 117 199 | 200 | 201 | YES 202 | 203 | 204 | 205 | 206 | 207 | 118 208 | 209 | 210 | YES 211 | 212 | 213 | 214 | 215 | 216 | 119 217 | 218 | 219 | 220 | 221 | 120 222 | 223 | 224 | 225 | 226 | 227 | 228 | YES 229 | 230 | YES 231 | -1.IBPluginDependency 232 | -2.IBPluginDependency 233 | -3.IBPluginDependency 234 | 117.IBPluginDependency 235 | 118.IBPluginDependency 236 | 119.IBPluginDependency 237 | 120.IBPluginDependency 238 | 5.IBPluginDependency 239 | 6.IBPluginDependency 240 | 241 | 242 | YES 243 | com.apple.InterfaceBuilder.CocoaPlugin 244 | com.apple.InterfaceBuilder.CocoaPlugin 245 | com.apple.InterfaceBuilder.CocoaPlugin 246 | com.apple.InterfaceBuilder.CocoaPlugin 247 | com.apple.InterfaceBuilder.CocoaPlugin 248 | com.apple.InterfaceBuilder.CocoaPlugin 249 | com.apple.InterfaceBuilder.CocoaPlugin 250 | com.apple.InterfaceBuilder.CocoaPlugin 251 | com.apple.InterfaceBuilder.CocoaPlugin 252 | 253 | 254 | 255 | YES 256 | 257 | 258 | 259 | 260 | 261 | YES 262 | 263 | 264 | 265 | 266 | 120 267 | 268 | 269 | 270 | YES 271 | 272 | GrowlMountainNotifierPrefs 273 | NSPreferencePane 274 | 275 | IBProjectSource 276 | ./Classes/GrowlMountainNotifierPrefs.h 277 | 278 | 279 | 280 | NSPreferencePane 281 | NSObject 282 | 283 | YES 284 | 285 | YES 286 | _firstKeyView 287 | _initialKeyView 288 | _lastKeyView 289 | _window 290 | 291 | 292 | YES 293 | NSView 294 | NSView 295 | NSView 296 | NSWindow 297 | 298 | 299 | 300 | YES 301 | 302 | YES 303 | _firstKeyView 304 | _initialKeyView 305 | _lastKeyView 306 | _window 307 | 308 | 309 | YES 310 | 311 | _firstKeyView 312 | NSView 313 | 314 | 315 | _initialKeyView 316 | NSView 317 | 318 | 319 | _lastKeyView 320 | NSView 321 | 322 | 323 | _window 324 | NSWindow 325 | 326 | 327 | 328 | 329 | IBProjectSource 330 | ./Classes/NSPreferencePane.h 331 | 332 | 333 | 334 | 335 | 0 336 | IBCocoaFramework 337 | 338 | com.apple.InterfaceBuilder.CocoaPlugin.macosx 339 | 340 | 341 | 342 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 343 | 344 | 345 | YES 346 | 3 347 | 348 | 349 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/es.lproj/GrowlMountainNotifierPrefs.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1030 5 | 12A269 6 | 2829 7 | 1187 8 | 624.00 9 | 10 | com.apple.InterfaceBuilder.CocoaPlugin 11 | 2829 12 | 13 | 14 | YES 15 | NSCustomObject 16 | NSTextField 17 | NSTextFieldCell 18 | NSView 19 | NSWindowTemplate 20 | 21 | 22 | YES 23 | com.apple.InterfaceBuilder.CocoaPlugin 24 | 25 | 26 | PluginDependencyRecalculationVersion 27 | 28 | 29 | 30 | YES 31 | 32 | GrowlMountainNotifierPrefs 33 | 34 | 35 | FirstResponder 36 | 37 | 38 | NSApplication 39 | 40 | 41 | 15 42 | 2 43 | {{118, 400}, {354, 289}} 44 | 1886912512 45 | 46 | Window 47 | 48 | NSWindow 49 | 50 | View 51 | 52 | 53 | {213, 107} 54 | 55 | 56 | 256 57 | 58 | YES 59 | 60 | 61 | 256 62 | {{17, 244}, {310, 25}} 63 | 64 | 65 | 66 | YES 67 | 68 | 67108864 69 | 272629760 70 | Mountain Lion Notifications 71 | 72 | LucidaGrande 73 | 13 74 | 1044 75 | 76 | 77 | 78 | 6 79 | System 80 | controlColor 81 | 82 | 3 83 | MC42NjY2NjY2NjY3AA 84 | 85 | 86 | 87 | 6 88 | System 89 | controlTextColor 90 | 91 | 3 92 | MAA 93 | 94 | 95 | 96 | NO 97 | 98 | 99 | 100 | 256 101 | {{17, 132}, {299, 104}} 102 | 103 | 104 | YES 105 | 106 | 67108864 107 | 272629760 108 | dmVyc2lvbiAwLjcgKDgvMTgvMjAxMikgMTAuOCByZXF1aXJlZC4gCgpVc2VzIE1vdW50YWluTm90aWZp 109 | ZXIgY29tbWFuZCBsaW5lIHRvb2wgIHRvIHNlbmQgbm90aWZpY2F0aW9ucyB3aXRoIGEgY29uZmlndXJh 110 | YmxlIGljb24gKHBzZCxqcGcscGRmLGljbnMpIHRvIHRoZSBtb3VudGFpbiBsaW9uIG5vdGlmaWNhdGlv 111 | biBjZW50ZXIKClZpc2l0IGh0dHA6Ly9naXRodWIuY29tL0RhaWotRGphbi9ERE1vdW50YWluTm90aWZp 112 | ZXIgZm9yIGZ1cnRoZXIgaW5mb3JtYXRpb24gaW5mb3JtYXRpb24uA 113 | 114 | LucidaGrande 115 | 10 116 | 2843 117 | 118 | 119 | 120 | 121 | 122 | NO 123 | 124 | 125 | {354, 289} 126 | 127 | 128 | 129 | 130 | {{0, 0}, {1440, 878}} 131 | {213, 129} 132 | {10000000000000, 10000000000000} 133 | YES 134 | 135 | 136 | 137 | 138 | YES 139 | 140 | 141 | _window 142 | 143 | 144 | 145 | 36 146 | 147 | 148 | 149 | 150 | YES 151 | 152 | 0 153 | 154 | YES 155 | 156 | 157 | 158 | 159 | 160 | -2 161 | 162 | 163 | File's Owner 164 | 165 | 166 | -1 167 | 168 | 169 | First Responder 170 | 171 | 172 | 5 173 | 174 | 175 | YES 176 | 177 | 178 | 179 | Window 180 | 181 | 182 | 6 183 | 184 | 185 | YES 186 | 187 | 188 | 189 | 190 | 191 | 192 | -3 193 | 194 | 195 | Application 196 | 197 | 198 | 117 199 | 200 | 201 | YES 202 | 203 | 204 | 205 | 206 | 207 | 118 208 | 209 | 210 | YES 211 | 212 | 213 | 214 | 215 | 216 | 119 217 | 218 | 219 | 220 | 221 | 120 222 | 223 | 224 | 225 | 226 | 227 | 228 | YES 229 | 230 | YES 231 | -1.IBPluginDependency 232 | -2.IBPluginDependency 233 | -3.IBPluginDependency 234 | 117.IBPluginDependency 235 | 118.IBPluginDependency 236 | 119.IBPluginDependency 237 | 120.IBPluginDependency 238 | 5.IBPluginDependency 239 | 6.IBPluginDependency 240 | 241 | 242 | YES 243 | com.apple.InterfaceBuilder.CocoaPlugin 244 | com.apple.InterfaceBuilder.CocoaPlugin 245 | com.apple.InterfaceBuilder.CocoaPlugin 246 | com.apple.InterfaceBuilder.CocoaPlugin 247 | com.apple.InterfaceBuilder.CocoaPlugin 248 | com.apple.InterfaceBuilder.CocoaPlugin 249 | com.apple.InterfaceBuilder.CocoaPlugin 250 | com.apple.InterfaceBuilder.CocoaPlugin 251 | com.apple.InterfaceBuilder.CocoaPlugin 252 | 253 | 254 | 255 | YES 256 | 257 | 258 | 259 | 260 | 261 | YES 262 | 263 | 264 | 265 | 266 | 120 267 | 268 | 269 | 270 | YES 271 | 272 | GrowlMountainNotifierPrefs 273 | NSPreferencePane 274 | 275 | IBProjectSource 276 | ./Classes/GrowlMountainNotifierPrefs.h 277 | 278 | 279 | 280 | NSPreferencePane 281 | NSObject 282 | 283 | YES 284 | 285 | YES 286 | _firstKeyView 287 | _initialKeyView 288 | _lastKeyView 289 | _window 290 | 291 | 292 | YES 293 | NSView 294 | NSView 295 | NSView 296 | NSWindow 297 | 298 | 299 | 300 | YES 301 | 302 | YES 303 | _firstKeyView 304 | _initialKeyView 305 | _lastKeyView 306 | _window 307 | 308 | 309 | YES 310 | 311 | _firstKeyView 312 | NSView 313 | 314 | 315 | _initialKeyView 316 | NSView 317 | 318 | 319 | _lastKeyView 320 | NSView 321 | 322 | 323 | _window 324 | NSWindow 325 | 326 | 327 | 328 | 329 | IBProjectSource 330 | ./Classes/NSPreferencePane.h 331 | 332 | 333 | 334 | 335 | 0 336 | IBCocoaFramework 337 | 338 | com.apple.InterfaceBuilder.CocoaPlugin.macosx 339 | 340 | 341 | 342 | com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 343 | 344 | 345 | YES 346 | 3 347 | 348 | 349 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/growl-1.3-headers/GrowlAbstractSingletonObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlAbstractSingletonObject.h 3 | // GBUtilities 4 | // 5 | // Renamed from GBAbstractSingletonObject to GrowlAbstractSingletonObject. 6 | // Created by Ofri Wolfus on 15/08/05. 7 | // Copyright 2005-2006 The Growl Project. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | 13 | /*! 14 | * @class GrowlAbstractSingletonObject 15 | * @brief An Abstract Singleton Object 16 | * 17 | * This is an abstract object for object that should have only one instnace 18 | * that is never released (singleton object). 19 | * This class is thread safe. 20 | */ 21 | @interface GrowlAbstractSingletonObject : NSObject { 22 | BOOL _isInitialized; 23 | } 24 | 25 | /*! 26 | * @brief Returns the shared instance of this class. 27 | */ 28 | + (id) sharedInstance; 29 | 30 | /*! 31 | * @brief Releases and deallocates all the singletons that are subclasses of this object. 32 | * 33 | * Once +destroyAllSingletons has been called, no more singletons can be created 34 | * and every call to [SomeSingletonSubclass sharedInstance] will return nil. 35 | * Also note that a call to this method will destroy GBAbstractSingletonObject and all it's subclasses. 36 | * Even though that you generally can't release a singleton object, it's dealloc message WILL be called 37 | * when it's beeing destroyed. 38 | * 39 | * USE THIS METHOD WITH GREAT CAUTION!!! 40 | */ 41 | + (void) destroyAllSingletons; 42 | 43 | @end 44 | 45 | /*! 46 | * @category GrowlSingletonObjectInit 47 | * @brief A private category for subclasses only. 48 | * 49 | * Only subclasses should override/call methods in the category. 50 | */ 51 | @interface GrowlAbstractSingletonObject (GrowlAbstractSingletonObjectInit) 52 | 53 | /*! 54 | * @brief An init method for your singleton object. 55 | * 56 | * Implement this in your subclass to init your shared object. 57 | * You should call [super initSingleton] and return your initialized object. 58 | * Never call this method directly! It'll be automatically called when needed. 59 | */ 60 | - (id) initSingleton; 61 | 62 | /*! 63 | * @brief Finish and clean up whatever your singleton does. 64 | * 65 | * This will be called before the singleton will be destroyed. 66 | * You should put whatever you would put in the -dealloc method here instead 67 | * and then call [super destroy]. 68 | */ 69 | - (void) destroy; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/growl-1.3-headers/GrowlApplicationTicket.h: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlApplicationTicket.h 3 | // Growl 4 | // 5 | // Created by Karl Adam on Tue Apr 27 2004. 6 | // Copyright 2004-2006 The Growl Project. All rights reserved. 7 | // 8 | // This file is under the BSD License, refer to License.txt for details 9 | 10 | 11 | #import 12 | 13 | @class GrowlNotificationTicket, GrowlDisplayPlugin; 14 | 15 | @interface GrowlApplicationTicket : NSObject { 16 | NSString *appNameHostName; // This is - 17 | NSString *appName; // This app's name for display by notifications that want it 18 | NSString *hostName; // This is the host which registered this 19 | NSString *appId; // This app's bundle identifier 20 | NSString *appPath; // This app's location on disk (cached here and in saved tickets) 21 | NSData *iconData; // This app's icon data 22 | NSImage *icon; // This app's icon 23 | 24 | NSDictionary *allNotifications; // All the notifications possible for this app 25 | NSArray *allNotificationNames; // Keys of allNotifications, in the order in which they were originally passed 26 | 27 | NSArray *defaultNotifications; // The default notifications 28 | 29 | NSDictionary *humanReadableNames; // Dictionary of human readable names 30 | NSDictionary *notificationDescriptions; // Dictionary of notification descriptions 31 | 32 | NSString *displayPluginName; 33 | GrowlDisplayPlugin *displayPlugin; // Non-nil if this ticket uses a custom display plugin 34 | 35 | NSInteger positionType; // Integer that tracks the selected position type (default or custom currently) 36 | NSInteger selectedCustomPosition; // Integer that tracks the selected custom position [int value translated from enum] FRAGILE 37 | 38 | BOOL changed; 39 | BOOL useDefaults; // Flag for whether this ticket just uses default 40 | BOOL ticketEnabled; 41 | BOOL clickHandlersEnabled; // Flag whether click handlers are enabled 42 | 43 | BOOL synchronizeOnChanges; 44 | BOOL isLocalHost; //If we are local host, this is a faster way of checking than doing string checks 45 | 46 | BOOL loggingEnabled; 47 | } 48 | 49 | //these are specifically for auto-discovery tickets, hence the requirement of GROWL_TICKET_VERSION. 50 | + (BOOL) isValidAutoDiscoverableTicketDictionary:(NSDictionary *)dict; 51 | + (BOOL) isKnownTicketVersion:(NSDictionary *)dict; 52 | 53 | #pragma mark - 54 | 55 | //designated initialiser. 56 | + (id) ticketWithDictionary:(NSDictionary *)ticketDict; 57 | - (id) initWithDictionary:(NSDictionary *)dict; 58 | 59 | - (id) initTicketFromPath:(NSString *) inPath; 60 | - (id) initTicketForApplication: (NSString *) inApp; 61 | 62 | - (void) saveTicket; 63 | - (void) saveTicketToPath:(NSString *)destDir; 64 | - (NSString *) path; 65 | - (void) synchronize; 66 | 67 | #pragma mark - 68 | 69 | @property (nonatomic, assign) BOOL hasChanged; 70 | 71 | - (NSData *) iconData; 72 | - (void) setIconData:(NSData *) inIconData; 73 | 74 | - (NSString *) applicationName; 75 | @property (nonatomic, readonly) NSString* appNameHostName; 76 | @property (nonatomic, readonly) BOOL isLocalHost; 77 | 78 | @property (nonatomic, assign) BOOL ticketEnabled; 79 | @property (nonatomic, assign) BOOL clickHandlersEnabled; 80 | @property (nonatomic, assign) BOOL useDefaults; 81 | @property (nonatomic, assign) NSInteger positionType; 82 | @property (nonatomic, assign) NSInteger selectedPosition; 83 | @property (nonatomic, copy) NSString *displayPluginName; 84 | 85 | @property (nonatomic) BOOL loggingEnabled; 86 | 87 | - (GrowlDisplayPlugin *) displayPlugin; 88 | 89 | #pragma mark - 90 | 91 | - (void) reregisterWithAllNotifications:(NSArray *) inAllNotes 92 | defaults:(id) inDefaults 93 | iconData:(NSData *) inIconData; 94 | - (void) reregisterWithDictionary:(NSDictionary *) dict; 95 | 96 | - (NSArray *) allNotifications; 97 | - (void) setAllNotifications:(NSArray *) inArray; 98 | 99 | - (NSArray *) defaultNotifications; 100 | - (void) setDefaultNotifications:(id) inObject; 101 | 102 | - (NSArray *) allowedNotifications; 103 | - (void) setAllowedNotifications:(NSArray *) inArray; 104 | - (void) setAllowedNotificationsToDefault; 105 | 106 | - (BOOL) isNotificationAllowed:(NSString *) name; 107 | 108 | #pragma mark Notification accessors 109 | - (NSArray *) notifications; 110 | - (GrowlNotificationTicket *) notificationTicketForName:(NSString *)name; 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/growl-1.3-headers/GrowlDisplayPlugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlDisplayPlugin.h 3 | // Growl 4 | // 5 | // Created by Peter Hosey on 2005-06-01. 6 | // Copyright 2005-2006 The Growl Project. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "GrowlPlugin.h" 11 | 12 | @class GrowlNotification, GrowlNotificationDisplayBridge; 13 | @class GrowlDisplayWindowController; 14 | 15 | //Info.plist keys for plug-in bundles. 16 | extern NSString *GrowlDisplayPluginInfoKeyUsesQueue; 17 | extern NSString *GrowlDisplayPluginInfoKeyWindowNibName; 18 | 19 | /*! 20 | * @class GrowlDisplayPlugin 21 | * @abstract Base class for all display plugins. 22 | */ 23 | @interface GrowlDisplayPlugin : GrowlPlugin { 24 | Class windowControllerClass; 25 | 26 | //for all displays 27 | NSMutableDictionary *coalescableBridges; 28 | 29 | //for non-queueing displays 30 | NSMutableArray *activeBridges; //GrowlNotificationDisplayBridges currently being displayed 31 | 32 | //for queueing displays 33 | GrowlNotificationDisplayBridge *bridge; 34 | NSMutableArray *queue; //GrowlNotificationDisplayBridges yet to be displayed 35 | } 36 | 37 | /*! @method displayNotification: 38 | * @abstract Display a notification to the user. 39 | * @param notification The notification to display. 40 | * @discussion Unless you have a specific reason to override this method you should not do so. 41 | * All the magic should happen in the window controller's setNotification: 42 | */ 43 | - (void) displayNotification:(GrowlNotification *)notification; 44 | 45 | /*! @method windowNibName 46 | * @abstract Returns the name of the display's sole nib file (resulting in 47 | * the creation of a window controller for the window in that file). 48 | * @discussion When subclassing GrowlDisplayPlugin, override this 49 | * method and return the name of the nib (without the ".nib" extension) that 50 | * contains the display window. This method is called by 51 | * displayNotification: to create a 52 | * GrowlNotificationDisplayBridge, which is the File's Owner for 53 | * the nib. 54 | * 55 | * The default implementation returns the value of 56 | * GrowlDisplayWindowNibName in the Info.plist of the bundle for 57 | * the display plug-in. 58 | * @result The name of the window nib. 59 | */ 60 | - (NSString *) windowNibName; 61 | 62 | /* */ 63 | - (void) displayWindowControllerDidTakeDownWindow:(GrowlDisplayWindowController *)wc; 64 | 65 | - (BOOL) queuesNotifications; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/growl-1.3-headers/GrowlNotification.h: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlNotification.h 3 | // Growl 4 | // 5 | // Copyright 2005-2011 The Growl Project. All rights reserved. 6 | // 7 | 8 | @interface GrowlNotification: NSObject 9 | { 10 | NSString *name; 11 | NSString *applicationName; 12 | 13 | NSString *title; 14 | NSString *messageText; 15 | 16 | NSImage *icon; 17 | 18 | NSString *identifier; 19 | 20 | BOOL sticky; 21 | NSInteger priority; 22 | 23 | NSDictionary *auxiliaryDictionary; 24 | 25 | NSDictionary *cachedDictionaryRepresentation; 26 | } 27 | 28 | + (GrowlNotification *) notificationWithDictionary:(NSDictionary *)dict; 29 | - (GrowlNotification *) initWithDictionary:(NSDictionary *)dict; 30 | 31 | //You can pass nil for description. 32 | - (GrowlNotification *) initWithName:(NSString *)newName 33 | applicationName:(NSString *)newAppName 34 | title:(NSString *)newTitle 35 | description:(NSString *)newDesc; 36 | 37 | #pragma mark - 38 | 39 | /*As of 1.3, this returns: 40 | * * GROWL_NOTIFICATION_NAME 41 | * * GROWL_APP_NAME 42 | * * GROWL_NOTIFICATION_TITLE 43 | * * GROWL_NOTIFICATION_DESCRIPTION 44 | *You can pass this set to -dictionaryRepresentationWithKeys:. 45 | */ 46 | + (NSSet *) standardKeys; 47 | 48 | //Same as dictionaryRepresentationWithKeys:nil. 49 | - (NSDictionary *) dictionaryRepresentation; 50 | 51 | /*With nil, returns all of the standard keys plus the auxiliary dictionary. 52 | *With non-nil, returns only the keys (from internal storage plus the auxiliary 53 | * dictionary) that are in the set. 54 | *In other words, returns the intersection of the standard dictionary keys, the 55 | * auxiliary dictionary, and the provided keys. 56 | */ 57 | - (NSDictionary *) dictionaryRepresentationWithKeys:(NSSet *)keys; 58 | 59 | #pragma mark - 60 | 61 | @property(nonatomic, copy) NSString *name; 62 | @property(nonatomic, copy) NSString *applicationName; 63 | 64 | @property(nonatomic, copy) NSString *title; 65 | @property(nonatomic, copy) NSString *messageText; 66 | 67 | //Compatibility alias for messageText. 68 | - (NSString *) notificationDescription; 69 | 70 | @property(nonatomic, copy) NSImage *icon; 71 | 72 | @property(nonatomic, copy) NSString *identifier; 73 | 74 | @property(nonatomic, assign, getter=isSticky) BOOL sticky; 75 | @property(nonatomic, assign) NSInteger priority; 76 | 77 | @property(nonatomic, copy) NSDictionary *auxiliaryDictionary; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/growl-1.3-headers/GrowlPlugin.h: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlPlugin.h 3 | // Growl 4 | // 5 | // Created by Peter Hosey on 2005-06-01. 6 | // Copyright 2005-2006 The Growl Project. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class NSPreferencePane; 12 | 13 | /*! @class GrowlPlugin 14 | * @abstract The base plug-in class. 15 | * @discussion All Growl plug-in instances are a kind of this class, including 16 | * display plug-ins, which are kinds of GrowlDisplayPlugin. 17 | */ 18 | @interface GrowlPlugin : NSObject { 19 | NSString *pluginName, *pluginAuthor, *pluginVersion, *pluginDesc; 20 | NSBundle *pluginBundle; 21 | NSString *pluginPathName; 22 | 23 | NSPreferencePane *preferencePane; 24 | NSString *prefDomain; 25 | } 26 | 27 | /*! 28 | * @method initWithName:author:version:pathname: 29 | * @abstract Designated initializer. 30 | * @param name The name of the plugin. 31 | * @param author The author of the plugin. 32 | * @param version The version of the plugin. 33 | * @param pathname The pathname of the plugin. 34 | * @result An initialized GrowlPlugin object. 35 | */ 36 | - (id) initWithName:(NSString *)name author:(NSString *)author version:(NSString *)version pathname:(NSString *)pathname; 37 | 38 | /*! 39 | * @method initWithBundle: 40 | * @abstract Initializer for plug-ins in bundles. The name, author, version, and pathname will be obtained from the bundle. 41 | * @result An initialized GrowlPlugin object. 42 | */ 43 | - (id) initWithBundle:(NSBundle *)bundle; 44 | 45 | /*! 46 | * @method name 47 | * @abstract Returns the name of the receiver. 48 | */ 49 | @property (nonatomic, copy) NSString *name; 50 | 51 | /*! 52 | * @method author 53 | * @abstract Returns the author of the receiver. 54 | */ 55 | @property (nonatomic, copy) NSString *author; 56 | 57 | /*! 58 | * @method version 59 | * @abstract Returns the version of the receiver. 60 | */ 61 | @property (nonatomic, copy) NSString *version; 62 | 63 | /*! 64 | * @method pluginDescription 65 | * @abstract Returns the plugin's description. 66 | */ 67 | @property (nonatomic, copy) NSString *pluginDescription; 68 | 69 | /*! 70 | * @method bundle 71 | * @abstract Returns the bundle of the receiver. 72 | */ 73 | @property (nonatomic, retain) NSBundle *bundle; 74 | 75 | /*! 76 | * @method pathname 77 | * @abstract Returns the pathname of the receiver. 78 | */ 79 | @property (nonatomic, copy) NSString *pathname; 80 | 81 | /*! 82 | * @method pathname 83 | * @abstract Returns the string used to access the preference domain of the receiver. 84 | */ 85 | @property (nonatomic, retain) NSString *prefDomain; 86 | 87 | /*! @method preferencePane 88 | * @abstract Return an NSPreferencePane instance that manages 89 | * the plugin's preferences. 90 | * @discussion Your plug-in should put the controls for its preferences in 91 | * this preference pane. 92 | * 93 | * Currently, the size of the preference pane's view should be 354 pixels by 94 | * 289 pixels, but you should set the springs of the view and its subviews 95 | * under the assumption that it can be resized horizontally and vertically to 96 | * any size. 97 | * 98 | * The default implementation of this method returns nil. 99 | * @result The preference pane. Can be nil. 100 | */ 101 | @property (nonatomic, assign) NSPreferencePane *preferencePane; 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/growl-1.3-headers/GrowlTicketController.h: -------------------------------------------------------------------------------- 1 | // 2 | // GrowlTicketController.h 3 | // Growl 4 | // 5 | // Created by Peter Hosey on 2005-06-08. 6 | // Copyright 2005-2006 Peter Hosey. All rights reserved. 7 | // 8 | 9 | #import "GrowlAbstractSingletonObject.h" 10 | 11 | @class GrowlApplicationTicket; 12 | 13 | @interface GrowlTicketController: GrowlAbstractSingletonObject 14 | { 15 | NSMutableDictionary *ticketsByApplicationName; 16 | } 17 | 18 | + (id) sharedController; 19 | 20 | - (NSArray *) allSavedTickets; 21 | 22 | - (GrowlApplicationTicket *) ticketForApplicationName:(NSString *) appName hostName:(NSString*)hostName; 23 | - (void) addTicket:(GrowlApplicationTicket *) newTicket; 24 | - (void) removeTicketForApplicationName:(NSString *)appName; 25 | 26 | - (void) loadAllSavedTickets; 27 | @end 28 | -------------------------------------------------------------------------------- /MountianGrowlPlugin/growl-1.3-headers/NSStringAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSStringAdditions.h 3 | // Growl 4 | // 5 | // Created by Ingmar Stein on 16.05.05. 6 | // Copyright 2005-2006 The Growl Project. All rights reserved. 7 | // 8 | // This file is under the BSD License, refer to License.txt for details 9 | 10 | #import 11 | 12 | @interface NSString (GrowlAdditions) 13 | 14 | - (unsigned long) unsignedLongValue; 15 | - (unsigned) unsignedIntValue; 16 | 17 | - (BOOL) isSubpathOf:(NSString *)superpath; 18 | 19 | - (BOOL) Growl_isLikelyDomainName; 20 | - (BOOL) Growl_isLikelyIPAddress; 21 | - (BOOL) isLocalHost; 22 | 23 | +(NSString*)stringWithAddressData:(NSData*)aAddressData; 24 | +(NSString*)hostNameForAddressData:(NSData *)aAddressData; 25 | 26 | - (NSString*)stringByEscapingForHTML; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #About 2 | this project providers a commandline tool and a growl plugin to send notifications with a configurable icon (psd,jpg,pdf,icns) to the mountain lion notification center and specify an app/file path or url to open on click! 3 | Apart from this tool, this repository holds a plugin for the growl app that forwards ANY growl notification to the ML notification center (the click handling will not be perfect here because _I_ dont need it but it could easily be added) 4 | 5 | ##example usage 6 | the CLI tool included can be called from terminal, from a shellscript or applescript or cocoa. For use in scripts it should be installed by copying the file to /usr/bin 7 | 8 | 9 | e.g. from terminal, to have a notification seem to come from apple mail: 10 | 11 | hostname:~ user$ MountainNotifier com.apple.mail 'New Mail' 'One new Mail by Dominik' 'The mail's body starts with: Hi, growl is cool!' 12 | 13 | You pass the tool 4 Parameters: 14 | - 1. the original caller: this can be an apple bundle identifier OR a unique string 'e.g. my super-tool', This identifier is used by Apple to decide which category in the sidebar a notification gets placed into. 15 | - 2. you pass the notification's title: any string 16 | - 3. you pass the notification's subtitle: any string 17 | - 4. you pass the notification's content. the message body: any string 18 | - 5. OPTIONALLY you can pass in the path or url of a icns file to be used for the notification and category icon. (If not specified BUT caller is a bundle identifier, the bundle's icon is used) 19 | 20 | from an applescript you call it via 'do shellscript', in a shellscript the syntax is the same as in terminal and in cocoa you use the NSTask API to run it. 21 | 22 | ##additional growl 1.3 plugin 23 | I included a plugin for growl 1.3 (current appstore version) which sends ANY growl notification to the ML notification center. 24 | 25 | With Growl running double click the MountianGrowlPlugin.growlView file to install it and enable it in growl's preferences so all notifications go the notification area (later on ;)) 26 | 27 | ##how it works (ruffly) 28 | Same as other comparable projects, MountainNotifier has to deal with the ML notification API from Apple and suffers from its restrictions. 29 | - a) the API only accepts notifications from Cocoa Apps -- which MountainNotifier is not. No script is either :P 30 | - b) The Notification Center always uses the application’s own icon, there’s currently no way to specify a custom icon for a notification. 31 | 32 | MountainNotifier works around both issues with an 'evil' but harmless hack :D (No system files are modified or so)
33 | For every caller it shall post a notification for it writes a proxy app with the correct identifier and the specified icon. That proxy is then called to post the final notification to ML.
34 |
35 | The proxy app's are in ~/Library/Application Support/MountainNotifier. (1 per caller) 36 | 37 | ###Wrong Icon? 38 | The ML notification center caches the icon foreach caller. that means that while MountainNotifier can change the icon for one caller multiple times, ML will NOT reflect that right away.
39 | ML Notification center can have N callers but every caller has 1 icon.
40 |
41 | A change of the caller's icon will only show up when the category is removed from the center and the system is rebooted (or maybe when the proxy app is deleted) 42 | 43 | ##everything prebuilt as well 44 | In the Downloads area there is all content built for 10.8. 45 | Nothing is code-signed though yet :) 46 | 47 | ##Licenses 48 | - Growl is originally from growl.info and is available under BSD 49 | - DDMinizip is available under the original libz license -------------------------------------------------------------------------------- /__DIST__/MountainGrowlPlugin.growlView.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/__DIST__/MountainGrowlPlugin.growlView.zip -------------------------------------------------------------------------------- /__DIST__/MountainNotifier 0.9 OLD.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/__DIST__/MountainNotifier 0.9 OLD.zip -------------------------------------------------------------------------------- /__DIST__/MountainNotifier.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/__DIST__/MountainNotifier.zip -------------------------------------------------------------------------------- /__DIST__/MountianGrowlPlugin.growlView 0.5 OLD.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/__DIST__/MountianGrowlPlugin.growlView 0.5 OLD.zip -------------------------------------------------------------------------------- /__DIST__/MountianGrowlPlugin.growlView 0.7.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/DDMountainNotifier/0f8a4e4c4813b150dc737e8c269a1657f9023938/__DIST__/MountianGrowlPlugin.growlView 0.7.zip --------------------------------------------------------------------------------