├── .gitignore ├── .gitmodules ├── CARExtractor ├── CARExtractor.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── CARExtractor │ └── main.m ├── LICENSE ├── README.md ├── README_zh-Hans.md ├── iOSImagesExtractor.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist └── iOSImagesExtractor ├── .gitattributes ├── iOSImagesExtractor.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── iOSImagesExtractor.xcscheme └── iOSImagesExtractor ├── Base.lproj └── MainMenu.xib ├── Classes ├── Libs │ ├── DCOAboutWindow │ │ ├── DCOAboutWindow.xib │ │ ├── DCOAboutWindowController.h │ │ ├── DCOAboutWindowController.m │ │ └── DCOTransparentScroller │ │ │ ├── DCOTransparentScrollView.h │ │ │ ├── DCOTransparentScrollView.m │ │ │ ├── DCOTransparentScroller.h │ │ │ └── DCOTransparentScroller.m │ └── ZipArchive │ │ ├── ZipArchive.h │ │ ├── ZipArchive.m │ │ └── minizip │ │ ├── crypt.h │ │ ├── ioapi.c │ │ ├── ioapi.h │ │ ├── mztools.c │ │ ├── mztools.h │ │ ├── unzip.c │ │ ├── unzip.h │ │ ├── zip.c │ │ └── zip.h └── Main │ ├── App │ ├── AppDelegate.h │ ├── AppDelegate.m │ └── main.m │ ├── Controllers │ ├── MainViewController.h │ ├── MainViewController.m │ └── MainViewController.xib │ ├── Models │ ├── XMFileItem.h │ └── XMFileItem.m │ └── Views │ ├── NSAlert+XM.h │ ├── NSAlert+XM.m │ ├── XMDragView.h │ └── XMDragView.m ├── Credits.rtf ├── Images.xcassets ├── AppIcon.appiconset │ ├── AppIcon-128.png │ ├── AppIcon-128@2x.png │ ├── AppIcon-16.png │ ├── AppIcon-16@2x.png │ ├── AppIcon-256.png │ ├── AppIcon-256@2x.png │ ├── AppIcon-32.png │ ├── AppIcon-32@2x.png │ ├── AppIcon-512.png │ ├── AppIcon-512@2x.png │ └── Contents.json └── Contents.json └── Info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | Products/ 13 | 14 | 15 | xcuserdata 16 | *.xccheckout 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | *.xcuserstate 22 | *.DS_Store 23 | 24 | # CocoaPods 25 | # 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | #Pods/ 31 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "CARExtractor/QLCARFiles"] 2 | path = CARExtractor/QLCARFiles 3 | url = https://github.com/devcxm/QLCARFiles.git 4 | -------------------------------------------------------------------------------- /CARExtractor/CARExtractor.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8982EB282484F82200BCB558 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8982EB272484F82200BCB558 /* main.m */; }; 11 | 8982EB362484F92E00BCB558 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8982EB352484F92E00BCB558 /* Foundation.framework */; }; 12 | 8982EB3F2484F9B400BCB558 /* ImageUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 8982EB3A2484F9B400BCB558 /* ImageUtilities.m */; }; 13 | 8982EB402484F9B400BCB558 /* CarUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 8982EB3D2484F9B400BCB558 /* CarUtilities.m */; }; 14 | 8982EB482484FD6700BCB558 /* CoreUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8982EB462484FD6700BCB558 /* CoreUI.framework */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXCopyFilesBuildPhase section */ 18 | 8982EB222484F82200BCB558 /* CopyFiles */ = { 19 | isa = PBXCopyFilesBuildPhase; 20 | buildActionMask = 2147483647; 21 | dstPath = /usr/share/man/man1/; 22 | dstSubfolderSpec = 0; 23 | files = ( 24 | ); 25 | runOnlyForDeploymentPostprocessing = 1; 26 | }; 27 | /* End PBXCopyFilesBuildPhase section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 8982EB242484F82200BCB558 /* CARExtractor */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CARExtractor; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 8982EB272484F82200BCB558 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32 | 8982EB352484F92E00BCB558 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 33 | 8982EB3A2484F9B400BCB558 /* ImageUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageUtilities.m; sourceTree = ""; }; 34 | 8982EB3B2484F9B400BCB558 /* CarUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarUtilities.h; sourceTree = ""; }; 35 | 8982EB3C2484F9B400BCB558 /* CoreUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreUI.h; sourceTree = ""; }; 36 | 8982EB3D2484F9B400BCB558 /* CarUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CarUtilities.m; sourceTree = ""; }; 37 | 8982EB3E2484F9B400BCB558 /* ImageUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageUtilities.h; sourceTree = ""; }; 38 | 8982EB462484FD6700BCB558 /* CoreUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreUI.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/PrivateFrameworks/CoreUI.framework; sourceTree = DEVELOPER_DIR; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | 8982EB212484F82200BCB558 /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | 8982EB362484F92E00BCB558 /* Foundation.framework in Frameworks */, 47 | 8982EB482484FD6700BCB558 /* CoreUI.framework in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | 8982EB1B2484F82200BCB558 = { 55 | isa = PBXGroup; 56 | children = ( 57 | 8982EB262484F82200BCB558 /* CARExtractor */, 58 | 8982EB252484F82200BCB558 /* Products */, 59 | 8982EB342484F92E00BCB558 /* Frameworks */, 60 | ); 61 | sourceTree = ""; 62 | }; 63 | 8982EB252484F82200BCB558 /* Products */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 8982EB242484F82200BCB558 /* CARExtractor */, 67 | ); 68 | name = Products; 69 | sourceTree = ""; 70 | }; 71 | 8982EB262484F82200BCB558 /* CARExtractor */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 8982EB392484F9B400BCB558 /* Common */, 75 | 8982EB272484F82200BCB558 /* main.m */, 76 | ); 77 | path = CARExtractor; 78 | sourceTree = ""; 79 | }; 80 | 8982EB342484F92E00BCB558 /* Frameworks */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 8982EB462484FD6700BCB558 /* CoreUI.framework */, 84 | 8982EB352484F92E00BCB558 /* Foundation.framework */, 85 | ); 86 | name = Frameworks; 87 | sourceTree = ""; 88 | }; 89 | 8982EB392484F9B400BCB558 /* Common */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 8982EB3B2484F9B400BCB558 /* CarUtilities.h */, 93 | 8982EB3D2484F9B400BCB558 /* CarUtilities.m */, 94 | 8982EB3C2484F9B400BCB558 /* CoreUI.h */, 95 | 8982EB3E2484F9B400BCB558 /* ImageUtilities.h */, 96 | 8982EB3A2484F9B400BCB558 /* ImageUtilities.m */, 97 | ); 98 | name = Common; 99 | path = QLCARFiles/Common; 100 | sourceTree = SOURCE_ROOT; 101 | }; 102 | /* End PBXGroup section */ 103 | 104 | /* Begin PBXNativeTarget section */ 105 | 8982EB232484F82200BCB558 /* CARExtractor */ = { 106 | isa = PBXNativeTarget; 107 | buildConfigurationList = 8982EB2B2484F82200BCB558 /* Build configuration list for PBXNativeTarget "CARExtractor" */; 108 | buildPhases = ( 109 | 8982EB202484F82200BCB558 /* Sources */, 110 | 8982EB212484F82200BCB558 /* Frameworks */, 111 | 8982EB222484F82200BCB558 /* CopyFiles */, 112 | 8982EB412484FB3400BCB558 /* ShellScript */, 113 | ); 114 | buildRules = ( 115 | ); 116 | dependencies = ( 117 | ); 118 | name = CARExtractor; 119 | productName = CARExtractor; 120 | productReference = 8982EB242484F82200BCB558 /* CARExtractor */; 121 | productType = "com.apple.product-type.tool"; 122 | }; 123 | /* End PBXNativeTarget section */ 124 | 125 | /* Begin PBXProject section */ 126 | 8982EB1C2484F82200BCB558 /* Project object */ = { 127 | isa = PBXProject; 128 | attributes = { 129 | LastUpgradeCheck = 1150; 130 | ORGANIZATIONNAME = chi; 131 | TargetAttributes = { 132 | 8982EB232484F82200BCB558 = { 133 | CreatedOnToolsVersion = 11.5; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = 8982EB1F2484F82200BCB558 /* Build configuration list for PBXProject "CARExtractor" */; 138 | compatibilityVersion = "Xcode 9.3"; 139 | developmentRegion = en; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = 8982EB1B2484F82200BCB558; 146 | productRefGroup = 8982EB252484F82200BCB558 /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | 8982EB232484F82200BCB558 /* CARExtractor */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXShellScriptBuildPhase section */ 156 | 8982EB412484FB3400BCB558 /* ShellScript */ = { 157 | isa = PBXShellScriptBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | ); 161 | inputFileListPaths = ( 162 | ); 163 | inputPaths = ( 164 | ); 165 | outputFileListPaths = ( 166 | ); 167 | outputPaths = ( 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | shellPath = /bin/sh; 171 | shellScript = "mkdir -p \"${PROJECT_DIR}/../Products\";\nrm -f \"${PROJECT_DIR}/../Products/${TARGET_NAME}\";\ncp \"${TARGET_BUILD_DIR}/${TARGET_NAME}\" \"${PROJECT_DIR}/../Products/${TARGET_NAME}\"\n"; 172 | }; 173 | /* End PBXShellScriptBuildPhase section */ 174 | 175 | /* Begin PBXSourcesBuildPhase section */ 176 | 8982EB202484F82200BCB558 /* Sources */ = { 177 | isa = PBXSourcesBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | 8982EB3F2484F9B400BCB558 /* ImageUtilities.m in Sources */, 181 | 8982EB402484F9B400BCB558 /* CarUtilities.m in Sources */, 182 | 8982EB282484F82200BCB558 /* main.m in Sources */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXSourcesBuildPhase section */ 187 | 188 | /* Begin XCBuildConfiguration section */ 189 | 8982EB292484F82200BCB558 /* Debug */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ALWAYS_SEARCH_USER_PATHS = NO; 193 | CLANG_ANALYZER_NONNULL = YES; 194 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 195 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 196 | CLANG_CXX_LIBRARY = "libc++"; 197 | CLANG_ENABLE_MODULES = YES; 198 | CLANG_ENABLE_OBJC_ARC = YES; 199 | CLANG_ENABLE_OBJC_WEAK = YES; 200 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 201 | CLANG_WARN_BOOL_CONVERSION = YES; 202 | CLANG_WARN_COMMA = YES; 203 | CLANG_WARN_CONSTANT_CONVERSION = YES; 204 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 205 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 206 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 207 | CLANG_WARN_EMPTY_BODY = YES; 208 | CLANG_WARN_ENUM_CONVERSION = YES; 209 | CLANG_WARN_INFINITE_RECURSION = YES; 210 | CLANG_WARN_INT_CONVERSION = YES; 211 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 212 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 213 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 214 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 215 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 216 | CLANG_WARN_STRICT_PROTOTYPES = YES; 217 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 218 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 219 | CLANG_WARN_UNREACHABLE_CODE = YES; 220 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 221 | COPY_PHASE_STRIP = NO; 222 | DEBUG_INFORMATION_FORMAT = dwarf; 223 | ENABLE_STRICT_OBJC_MSGSEND = YES; 224 | ENABLE_TESTABILITY = YES; 225 | GCC_C_LANGUAGE_STANDARD = gnu11; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_NO_COMMON_BLOCKS = YES; 228 | GCC_OPTIMIZATION_LEVEL = 0; 229 | GCC_PREPROCESSOR_DEFINITIONS = ( 230 | "DEBUG=1", 231 | "$(inherited)", 232 | ); 233 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | MACOSX_DEPLOYMENT_TARGET = 10.15; 240 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 241 | MTL_FAST_MATH = YES; 242 | ONLY_ACTIVE_ARCH = YES; 243 | SDKROOT = macosx; 244 | }; 245 | name = Debug; 246 | }; 247 | 8982EB2A2484F82200BCB558 /* Release */ = { 248 | isa = XCBuildConfiguration; 249 | buildSettings = { 250 | ALWAYS_SEARCH_USER_PATHS = NO; 251 | CLANG_ANALYZER_NONNULL = YES; 252 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 253 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 254 | CLANG_CXX_LIBRARY = "libc++"; 255 | CLANG_ENABLE_MODULES = YES; 256 | CLANG_ENABLE_OBJC_ARC = YES; 257 | CLANG_ENABLE_OBJC_WEAK = YES; 258 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_COMMA = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 263 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 264 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INFINITE_RECURSION = YES; 268 | CLANG_WARN_INT_CONVERSION = YES; 269 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 271 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 272 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 273 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 274 | CLANG_WARN_STRICT_PROTOTYPES = YES; 275 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 276 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | COPY_PHASE_STRIP = NO; 280 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 281 | ENABLE_NS_ASSERTIONS = NO; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | GCC_C_LANGUAGE_STANDARD = gnu11; 284 | GCC_NO_COMMON_BLOCKS = YES; 285 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 286 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 287 | GCC_WARN_UNDECLARED_SELECTOR = YES; 288 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 289 | GCC_WARN_UNUSED_FUNCTION = YES; 290 | GCC_WARN_UNUSED_VARIABLE = YES; 291 | MACOSX_DEPLOYMENT_TARGET = 10.15; 292 | MTL_ENABLE_DEBUG_INFO = NO; 293 | MTL_FAST_MATH = YES; 294 | SDKROOT = macosx; 295 | }; 296 | name = Release; 297 | }; 298 | 8982EB2C2484F82200BCB558 /* Debug */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | CODE_SIGN_STYLE = Automatic; 302 | PRODUCT_NAME = "$(TARGET_NAME)"; 303 | SYSTEM_FRAMEWORK_SEARCH_PATHS = ( 304 | "$(inherited)", 305 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 306 | "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 307 | ); 308 | }; 309 | name = Debug; 310 | }; 311 | 8982EB2D2484F82200BCB558 /* Release */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | CODE_SIGN_STYLE = Automatic; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | SYSTEM_FRAMEWORK_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 319 | "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", 320 | ); 321 | }; 322 | name = Release; 323 | }; 324 | /* End XCBuildConfiguration section */ 325 | 326 | /* Begin XCConfigurationList section */ 327 | 8982EB1F2484F82200BCB558 /* Build configuration list for PBXProject "CARExtractor" */ = { 328 | isa = XCConfigurationList; 329 | buildConfigurations = ( 330 | 8982EB292484F82200BCB558 /* Debug */, 331 | 8982EB2A2484F82200BCB558 /* Release */, 332 | ); 333 | defaultConfigurationIsVisible = 0; 334 | defaultConfigurationName = Release; 335 | }; 336 | 8982EB2B2484F82200BCB558 /* Build configuration list for PBXNativeTarget "CARExtractor" */ = { 337 | isa = XCConfigurationList; 338 | buildConfigurations = ( 339 | 8982EB2C2484F82200BCB558 /* Debug */, 340 | 8982EB2D2484F82200BCB558 /* Release */, 341 | ); 342 | defaultConfigurationIsVisible = 0; 343 | defaultConfigurationName = Release; 344 | }; 345 | /* End XCConfigurationList section */ 346 | }; 347 | rootObject = 8982EB1C2484F82200BCB558 /* Project object */; 348 | } 349 | -------------------------------------------------------------------------------- /CARExtractor/CARExtractor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CARExtractor/CARExtractor.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CARExtractor/CARExtractor/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CARExtractor 4 | // 5 | // Created by chixm on 2020/6/1. 6 | // Copyright © 2020 chi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CoreUI.h" 12 | #import "CarUtilities.h" 13 | 14 | static NSString *kProccessingNotificationName = nil; 15 | static CFTimeInterval s_lastPostNotificationTime = 0; 16 | 17 | void postProccessingNotification(NSDictionary *userInfo) { 18 | CFTimeInterval currentMediaTime = CACurrentMediaTime(); 19 | if (currentMediaTime - s_lastPostNotificationTime < 0.05f) { 20 | return; 21 | } 22 | s_lastPostNotificationTime = currentMediaTime; 23 | if (kProccessingNotificationName && userInfo.count > 0) { 24 | CFNotificationCenterRef distributedCenter = 25 | CFNotificationCenterGetDistributedCenter(); 26 | 27 | CFNotificationCenterPostNotification(distributedCenter, 28 | (__bridge CFStringRef)kProccessingNotificationName, 29 | NULL, 30 | (__bridge CFDictionaryRef)userInfo, 31 | TRUE); 32 | } 33 | } 34 | 35 | NSString * FindUniquePathForPath(NSString *inPath, NSString *optionalPathComponent, BOOL forceUseOptionalFileNamePathComponent) 36 | { 37 | NSString *outPath = inPath; 38 | 39 | // If the path exists, add the optional path component for differenciation 40 | if([optionalPathComponent length] > 0 && ([[NSFileManager defaultManager] fileExistsAtPath:inPath] || forceUseOptionalFileNamePathComponent)) 41 | { 42 | NSString *pathExtension = [inPath pathExtension]; 43 | if([pathExtension length] > 0) 44 | { 45 | NSString *replaceString = [NSString stringWithFormat:@".%@", pathExtension]; 46 | outPath = [inPath stringByReplacingOccurrencesOfString:replaceString withString:[NSString stringWithFormat:@"~%@%@", optionalPathComponent, replaceString] options:NSBackwardsSearch range:NSMakeRange(0, [inPath length])]; 47 | } 48 | else 49 | { 50 | outPath = [inPath stringByAppendingFormat:@"%@", [NSString stringWithFormat:@"~%@", optionalPathComponent]]; 51 | } 52 | } 53 | 54 | // Ensure the path does not exist 55 | NSString *initialPath = outPath; 56 | if([[NSFileManager defaultManager] fileExistsAtPath:initialPath]) 57 | { 58 | NSString *pathExtension = [initialPath pathExtension]; 59 | if([pathExtension length] > 0) 60 | { 61 | NSString *replaceString = [NSString stringWithFormat:@".%@", pathExtension]; 62 | NSUInteger fileSuffix = 1; 63 | while([[NSFileManager defaultManager] fileExistsAtPath:outPath]) 64 | { 65 | outPath = [initialPath stringByReplacingOccurrencesOfString:replaceString withString:[NSString stringWithFormat:@"~%ld%@", fileSuffix, replaceString] options:NSBackwardsSearch range:NSMakeRange(0, [initialPath length])]; 66 | fileSuffix++; 67 | } 68 | } 69 | else 70 | { 71 | NSUInteger fileSuffix = 1; 72 | while([[NSFileManager defaultManager] fileExistsAtPath:outPath]) 73 | { 74 | outPath = [initialPath stringByAppendingFormat:@"%@", [NSString stringWithFormat:@"~%ld", fileSuffix]]; 75 | fileSuffix++; 76 | } 77 | } 78 | } 79 | 80 | return outPath; 81 | } 82 | 83 | void DumpCGImageToPath(CGImageRef inImage, NSString *inPath) 84 | { 85 | if(inImage != NULL && inPath != nil) 86 | { 87 | // Get the file URL 88 | CFURLRef fileURL = (__bridge CFURLRef)[NSURL fileURLWithPath:inPath]; 89 | 90 | // Write the CGImageRef to disk 91 | CGImageDestinationRef destinationRef = CGImageDestinationCreateWithURL(fileURL, kUTTypePNG, 1, NULL); 92 | if(destinationRef != NULL) 93 | { 94 | CGImageDestinationAddImage(destinationRef, inImage, nil); 95 | if (!CGImageDestinationFinalize(destinationRef)) 96 | { 97 | NSLog(@"Could not dump the image to %@", inPath); 98 | } 99 | 100 | CFRelease(destinationRef); 101 | } 102 | } 103 | } 104 | 105 | void ProcessNamedLookup(NSString *inOutputFolder, NSString *fileName, NSString *optionalFileNameComponent, BOOL forceUseOptionalFileNamePathComponent, CGImageRef cgImage, NSData *representation) 106 | { 107 | // 108 | // 109 | // From /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/PrivateFrameworks/CoreThemeDefinition.framework/CoreThemeDefinition 110 | // "ZZZZExplicitlyPackedAsset-%d.%d.%d-gamut%d" 111 | // "ZZZZPackedAsset-%d.%d.%d-gamut%d" 112 | // "ZZZZFlattenedImage-%d.%d.%d" 113 | // "ZZZZRadiosityImage-%d.%d.%d" 114 | // 115 | 116 | if([fileName hasPrefix:@"ZZZZPackedAsset"]) 117 | { 118 | // Ignore ZZZZPackedAsset 119 | return; 120 | } 121 | 122 | NSString *uniqueFilePath = FindUniquePathForPath([inOutputFolder stringByAppendingPathComponent:fileName], optionalFileNameComponent, forceUseOptionalFileNamePathComponent); 123 | 124 | if(cgImage != NULL) 125 | { 126 | DumpCGImageToPath(cgImage, uniqueFilePath); 127 | } 128 | else if([representation isKindOfClass:[NSData class]]) 129 | { 130 | [(NSData *)representation writeToFile:uniqueFilePath atomically:NO]; 131 | } 132 | else 133 | { 134 | NSLog(@"Nothing to output for %@", uniqueFilePath); 135 | } 136 | } 137 | 138 | void exportCarFileAtPath(NSString * carPath, NSString *outputDirectoryPath) 139 | { 140 | 141 | outputDirectoryPath = [outputDirectoryPath stringByExpandingTildeInPath]; 142 | 143 | if (![[NSFileManager defaultManager] fileExistsAtPath:outputDirectoryPath]) { 144 | [[NSFileManager defaultManager] createDirectoryAtPath:outputDirectoryPath withIntermediateDirectories:YES attributes:nil error:nil]; 145 | } 146 | 147 | 148 | __block NSMutableArray *filenameListM = [NSMutableArray array]; 149 | 150 | ProcessCarFileAtPath(carPath, outputDirectoryPath, ^(NSString *inOutputFolder, CarNamedLookupDict carNamedLookupDict) 151 | { 152 | if(carNamedLookupDict != nil) 153 | { 154 | NSString *fileName = carNamedLookupDict[kCarInfoDict_FilenameKey]; 155 | if([fileName hasPrefix:@"ZZZZExplicitlyPackedAsset-"] || 156 | [fileName hasPrefix:@"ZZZZPackedAsset-"] || 157 | [fileName hasPrefix:@"ZZZZFlattenedImage-"] || 158 | [fileName hasPrefix:@"ZZZZRadiosityImage-"]) 159 | { 160 | // Ignore assets like: 161 | // "ZZZZExplicitlyPackedAsset-%d.%d.%d-gamut%d" 162 | // "ZZZZPackedAsset-%d.%d.%d-gamut%d" 163 | // "ZZZZFlattenedImage-%d.%d.%d" 164 | // "ZZZZRadiosityImage-%d.%d.%d" 165 | return; 166 | } 167 | 168 | if (!fileName || [filenameListM containsObject:fileName]) { 169 | return; 170 | } 171 | 172 | postProccessingNotification(@{@"name":fileName}); 173 | 174 | [filenameListM addObject:fileName]; 175 | 176 | CGImageRef cgImage = (__bridge CGImageRef)(carNamedLookupDict[kCarInfoDict_CGImageKey]); 177 | NSData *assetData = carNamedLookupDict[kCarInfoDict_DataKey]; 178 | 179 | NSString *optionalFileNamePathComponent = nil; 180 | if(cgImage != nil) 181 | { 182 | optionalFileNamePathComponent = [NSString stringWithFormat:@"%ldx%ld", CGImageGetWidth(cgImage), CGImageGetHeight(cgImage)]; 183 | } 184 | 185 | BOOL forceUseOptionalFileNamePathComponent = [carNamedLookupDict[kCarInfoDict_IsMultisizeImageKey] boolValue]; 186 | ProcessNamedLookup(inOutputFolder, fileName, optionalFileNamePathComponent, forceUseOptionalFileNamePathComponent, cgImage, assetData); 187 | } 188 | }); 189 | } 190 | 191 | 192 | int main(int argc, const char * argv[]) { 193 | @autoreleasepool { 194 | if (argc > 3) { 195 | for (int i = 2; i < argc; ++i) { 196 | NSString *argvString = [NSString stringWithUTF8String:argv[i]]; 197 | if ([argvString containsString:@"--DistributedNotificationName="]) { 198 | NSArray *components = [argvString componentsSeparatedByString:@"="]; 199 | if (components.count == 2) { 200 | kProccessingNotificationName = components.lastObject.length > 0 ? components.lastObject : nil; 201 | } 202 | break; 203 | } 204 | } 205 | } 206 | 207 | 208 | exportCarFileAtPath([NSString stringWithUTF8String:argv[1]], argc > 2 ? [NSString stringWithUTF8String:argv[2]] : nil); 209 | 210 | } 211 | return 0; 212 | } 213 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 devcxm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | 23 | [ZipArchive](https://github.com/mattconnolly/ZipArchive) 24 | Copyright (C) 2010-2012 Matt Connolly, Edward Patel, et al 25 | 26 | Permission is hereby granted, free of charge, to any person obtaining a copy of 27 | this software and associated documentation files (the "Software"), to deal in 28 | the Software without restriction, including without limitation the rights to 29 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 30 | the Software, and to permit persons to whom the Software is furnished to do so, 31 | subject to the following conditions: 32 | 33 | The above copyright notice and this permission notice shall be included in all 34 | copies or substantial portions of the Software. 35 | 36 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 37 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 38 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 39 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 40 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 41 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 42 | 43 | [iOS-Asset-Extractor](https://github.com/Marxon13/iOS-Asset-Extractor) 44 | Copyright (c) 2014 Brandon McQuilkin 45 | 46 | Permission is hereby granted, free of charge, to any person obtaining a copy 47 | of this software and associated documentation files (the "Software"), to deal 48 | in the Software without restriction, including without limitation the rights 49 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 50 | copies of the Software, and to permit persons to whom the Software is 51 | furnished to do so, subject to the following conditions: 52 | 53 | The above copyright notice and this permission notice shall be included in 54 | all copies or substantial portions of the Software. 55 | 56 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 57 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 58 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 59 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 60 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 61 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 62 | THE SOFTWARE. 63 | 64 | 65 | [DCOAboutWindow](https://github.com/DangerCove/DCOAboutWindow) 66 | Copyright (c) 2014, Danger Cove All rights reserved. 67 | 68 | Redistribution and use in source and binary forms, with or without 69 | modification, are permitted provided that the following conditions are met: 70 | * Redistributions of source code must retain the above copyright 71 | notice, this list of conditions and the following disclaimer. 72 | * Redistributions in binary form must reproduce the above copyright 73 | notice, this list of conditions and the following disclaimer in the 74 | documentation and/or other materials provided with the distribution. 75 | * Neither the name of the nor the 76 | names of its contributors may be used to endorse or promote products 77 | derived from this software without specific prior written permission. 78 | 79 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 80 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 81 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 82 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 83 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 84 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 85 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 86 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 87 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 88 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS Images Extractor 2 | iOS Images Extractor is a Mac app to normalize, decode and extract images from iOS apps. You can download binary release from the [latest releases](https://github.com/devcxm/iOS-Images-Extractor/releases/latest). (Sorry for my bad English) 3 | 4 | ![logo](https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/master/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-256.png) 5 | 6 | ## Support Files 7 | - `png、jpg` 8 | - `ipa` 9 | - `car(Assets.car)` 10 | 11 | ## Build 12 | ``` 13 | git clone https://github.com/devcxm/iOS-Images-Extractor 14 | cd iOS-Images-Extractor 15 | git submodule update --init --recursive 16 | open iOSImagesExtractor.xcworkspace 17 | ``` 18 | ### [中文使用方法看这里](/README_zh-Hans.md) 19 | 20 | ## Screenshot 21 | ![(Screenshot)](https://cloud.githubusercontent.com/assets/8568955/7927878/874f0594-0918-11e5-9fe3-452372f5affd.gif) 22 | 23 | 24 | ## Requirements 25 | _**OS X 10.14 or later.**_ 26 | 27 | ## Change Logs 28 | * v0.4.0 2020-06-03 29 | * Replace extractor with [Timac/QLCARFiles](https://github.com/Timac/QLCARFiles). 30 | * Support export raw PDF files. 31 | * Better output folder grading. 32 | * Quickly install `QLCARFiles`(macOS QuickLook Plugin) to visualize .car files. 33 | 34 | - v0.3.1 2016-05-15 35 | * Add app icons and update CARExtractor. 36 | 37 | - v0.2.5 2015-06-02 38 | * First release. 39 | 40 | ## Credits 41 | 42 | - Matt Connolly [ZipArchive](https://github.com/mattconnolly/ZipArchive) 43 | 44 | - Brandon McQuilkin [iOS-Asset-Extractor](https://github.com/Marxon13/iOS-Asset-Extractor) 45 | 46 | - Danger Cove [DCOAboutWindow](https://github.com/DangerCove/DCOAboutWindow) 47 | 48 | - Timac [QLCARFiles](https://github.com/Timac/QLCARFiles) 49 | 50 | ## License 51 | 52 | iOS Images Extractor is released under the MIT license. See [LICENSE](/LICENSE) for details. 53 | -------------------------------------------------------------------------------- /README_zh-Hans.md: -------------------------------------------------------------------------------- 1 | # 中文使用说明 2 | 3 | ## 发行版本 4 | 5 | ### 下载地址:[百度网盘下载](http://pan.baidu.com/s/1i4T8seT) 6 | 7 | ## 系统要求 8 | * OS X 10.14 9 | 10 | 11 | ## 使用说明 12 | ### 打开软件后,拖拽`ipa`、`car文件`、`png`、`jpg`或者`整个文件夹`到软件窗口,点击`Start`按钮即可开始提取图片资源文件。 13 | ### 图片默认输出到`/User/用户名/Downloads/iOSImagesExtractor`文件夹,可直接点击`Output Dir`按钮快速跳转到输出文件夹。 14 | -------------------------------------------------------------------------------- /iOSImagesExtractor.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOSImagesExtractor.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /iOSImagesExtractor/.gitattributes: -------------------------------------------------------------------------------- 1 | iOSImagesExtractor/Classes/Libs/* linguist-vendored 2 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor.xcodeproj/xcshareddata/xcschemes/iOSImagesExtractor.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | 66 | 68 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/DCOAboutWindow/DCOAboutWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 46 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 143 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 209 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/DCOAboutWindow/DCOAboutWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DCOAboutWindowController.h 3 | // Tapetrap 4 | // 5 | // Created by Boy van Amstel on 20-01-14. 6 | // Copyright (c) 2014 Danger Cove. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * The about window. 13 | */ 14 | @interface DCOAboutWindowController : NSWindowController 15 | 16 | /** 17 | * The application name. 18 | * Default: CFBundleName 19 | */ 20 | @property (copy) NSString *appName; 21 | 22 | /** 23 | * The application version. 24 | * Default: "Version %@ (Build %@)", CFBundleVersion, CFBundleShortVersionString 25 | */ 26 | @property (copy) NSString *appVersion; 27 | 28 | /** 29 | * The copyright line. 30 | * Default: NSHumanReadableCopyright 31 | */ 32 | @property (copy) NSString *appCopyright; 33 | 34 | /** 35 | * The credits. 36 | * Default: contents of file at [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"]; 37 | */ 38 | @property (copy) NSAttributedString *appCredits; 39 | 40 | /** 41 | * The URL pointing to the app's website. 42 | * Default: none 43 | */ 44 | @property (strong) NSURL *appWebsiteURL; 45 | 46 | /** 47 | * The path to the file that contains the acknowledgments. 48 | * Default: [[NSBundle mainBundle] pathForResource:@"Acknowledgments" ofType:@"rtf"]; 49 | */ 50 | @property (nonatomic, copy) NSString *acknowledgmentsPath; 51 | 52 | /** 53 | * If set to YES acknowledgments are shown in a text view, inside the window. Otherwise an external editor is launched. 54 | * Default: NO; 55 | */ 56 | @property (assign) BOOL useTextViewForAcknowledgments; 57 | 58 | /** 59 | * Visit the website. 60 | * 61 | * @param sender The object making the call. 62 | */ 63 | - (IBAction)visitWebsite:(id)sender; 64 | 65 | /** 66 | * Show acknowledgments for libraries used etc. 67 | * 68 | * @param sender The object making the call. 69 | */ 70 | - (IBAction)showAcknowledgments:(id)sender; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/DCOAboutWindow/DCOAboutWindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DCOAboutWindowController.m 3 | // Tapetrap 4 | // 5 | // Created by Boy van Amstel on 20-01-14. 6 | // Copyright (c) 2014 Danger Cove. All rights reserved. 7 | // 8 | 9 | #import "DCOAboutWindowController.h" 10 | 11 | @interface DCOAboutWindowController() 12 | 13 | /** The window nib to load. */ 14 | + (NSString *)nibName; 15 | 16 | /** The place holder view. */ 17 | @property (assign) IBOutlet NSView *placeHolderView; 18 | 19 | /** The info view. */ 20 | @property (assign) IBOutlet NSView *infoView; 21 | 22 | /** The acknowledgments view. */ 23 | @property (assign) IBOutlet NSView *acknowledgmentsView; 24 | 25 | /** The credits text view. */ 26 | @property (assign) IBOutlet NSTextView *creditsTextView; 27 | 28 | /** The acknowledgments text view. */ 29 | @property (assign) IBOutlet NSTextView *acknowledgmentsTextView; 30 | 31 | /** The button that opens the app's website. */ 32 | @property (assign) IBOutlet NSButton *visitWebsiteButton; 33 | 34 | /** The button that opens the acknowledgments. */ 35 | @property (assign) IBOutlet NSButton *acknowledgmentsButton; 36 | 37 | /** The view that's currently active. */ 38 | @property (assign) NSView *activeView; 39 | 40 | /** The string to hold the acknowledgments if we're showing them in same window. */ 41 | @property (copy) NSAttributedString *acknowledgmentsString; 42 | 43 | @end 44 | 45 | @implementation DCOAboutWindowController 46 | 47 | #pragma mark - Class Methods 48 | 49 | + (NSString *)nibName { 50 | return @"DCOAboutWindow"; 51 | } 52 | 53 | #pragma mark - Overrides 54 | 55 | - (id)init { 56 | return [super initWithWindowNibName:[[self class] nibName]]; 57 | } 58 | 59 | - (void)windowDidLoad { 60 | [super windowDidLoad]; 61 | 62 | // Load variables 63 | NSDictionary *bundleDict = [[NSBundle mainBundle] infoDictionary]; 64 | 65 | // Set app name 66 | if(!self.appName) { 67 | self.appName = [bundleDict objectForKey:@"CFBundleName"]; 68 | } 69 | 70 | // Set app version 71 | if(!self.appVersion) { 72 | NSString *version = [bundleDict objectForKey:@"CFBundleVersion"]; 73 | NSString *shortVersion = [bundleDict objectForKey:@"CFBundleShortVersionString"]; 74 | self.appVersion = [NSString stringWithFormat:NSLocalizedString(@"Version %@ (Build %@)", @"Version %@ (Build %@), displayed in the about window"), shortVersion, version]; 75 | } 76 | 77 | // Set copyright 78 | if(!self.appCopyright) { 79 | self.appCopyright = [bundleDict objectForKey:@"NSHumanReadableCopyright"]; 80 | } 81 | 82 | // Set "visit website" caption 83 | self.visitWebsiteButton.title = [NSString stringWithFormat:NSLocalizedString(@"Visit the %@ Website", @"Caption on the 'Visit the %@ Website' button in the about window"), self.appName]; 84 | // Set the "acknowledgments" caption 85 | self.acknowledgmentsButton.title = NSLocalizedString(@"Acknowledgments", @"Caption of the 'Acknowledgments' button in the about window"); 86 | 87 | // Set acknowledgments 88 | if(!self.acknowledgmentsPath) { 89 | self.acknowledgmentsPath = [[NSBundle mainBundle] pathForResource:@"Acknowledgments" ofType:@"rtf"]; 90 | } 91 | 92 | // Set credits 93 | if(!self.appCredits) { 94 | NSString *creditsPath = [[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"]; 95 | self.appCredits = [[NSAttributedString alloc] initWithPath:creditsPath documentAttributes:nil]; 96 | } 97 | 98 | // Disable editing 99 | [self.creditsTextView setEditable:NO]; // Somehow IB checkboxes are not working 100 | [self.acknowledgmentsTextView setEditable:NO]; // Somehow IB checkboxes are not working 101 | } 102 | 103 | - (void)showWindow:(id)sender { 104 | [super showWindow:sender]; 105 | 106 | // Show infoView per default 107 | [self showView:self.infoView]; 108 | } 109 | 110 | #pragma mark - Getters/Setters 111 | 112 | - (void)setAcknowledgmentsPath:(NSString *)acknowledgmentsPath { 113 | _acknowledgmentsPath = acknowledgmentsPath; 114 | 115 | if(acknowledgmentsPath) { 116 | 117 | // Set acknowledgments 118 | self.acknowledgmentsString = [[NSAttributedString alloc] initWithPath:acknowledgmentsPath documentAttributes:nil]; 119 | 120 | } else { 121 | 122 | // Remove the button (and constraints) 123 | [self.acknowledgmentsButton removeFromSuperview]; 124 | 125 | } 126 | } 127 | 128 | #pragma mark - Interface Methods 129 | 130 | - (IBAction)visitWebsite:(id)sender { 131 | 132 | if(self.appWebsiteURL) { 133 | [[NSWorkspace sharedWorkspace] openURL:self.appWebsiteURL]; 134 | } else { 135 | NSLog(@"Error: please set the appWebsiteURL property on the about window"); 136 | } 137 | } 138 | 139 | - (IBAction)showAcknowledgments:(id)sender { 140 | 141 | if(self.useTextViewForAcknowledgments) { 142 | 143 | // Toggle between the infoView and the acknowledgmentsView 144 | if([self.activeView isEqualTo:self.infoView]) { 145 | 146 | [self showView:self.acknowledgmentsView]; 147 | self.acknowledgmentsButton.title = NSLocalizedString(@"Credits", nil); 148 | 149 | } else { 150 | 151 | [self showView:self.infoView]; 152 | self.acknowledgmentsButton.title = NSLocalizedString(@"Acknowledgments", nil); 153 | } 154 | 155 | } else { 156 | 157 | if(self.acknowledgmentsPath) { 158 | 159 | // Load in default editor 160 | [[NSWorkspace sharedWorkspace] openFile:self.acknowledgmentsPath]; 161 | 162 | } else { 163 | NSLog(@"Error: couldn't load the acknowledgments file"); 164 | } 165 | } 166 | } 167 | 168 | #pragma mark - Private Methods 169 | 170 | - (void)showView:(NSView*)theView { 171 | 172 | // Exit early if the view is the same 173 | if([theView isEqualTo:self.activeView]) { 174 | return; 175 | } 176 | 177 | // Remove the active view from the place holder 178 | if(self.activeView) { 179 | [self.activeView removeFromSuperview]; 180 | } 181 | 182 | // Resize view to fit 183 | theView.autoresizingMask = NSViewHeightSizable | NSViewWidthSizable; 184 | theView.frame = self.placeHolderView.bounds; 185 | 186 | // Add to placeholder 187 | [self.placeHolderView addSubview:theView]; 188 | 189 | // Enable layer backing and change the background color 190 | theView.wantsLayer = YES; 191 | theView.layer.backgroundColor = [NSColor whiteColor].CGColor; 192 | 193 | // Add bottom border 194 | CALayer *bottomBorder = [CALayer layer]; 195 | bottomBorder.borderColor = [NSColor grayColor].CGColor; 196 | bottomBorder.borderWidth = 1; 197 | bottomBorder.frame = CGRectMake(-1.f, .0f, CGRectGetWidth(theView.frame) + 2.f, CGRectGetHeight(theView.frame) + 1.f); 198 | bottomBorder.autoresizingMask = NSViewHeightSizable | NSViewWidthSizable; 199 | [theView.layer addSublayer:bottomBorder]; 200 | 201 | // Set active view 202 | self.activeView = theView; 203 | } 204 | 205 | @end 206 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/DCOAboutWindow/DCOTransparentScroller/DCOTransparentScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DCOTransparentScrollView.h 3 | // Tapetrap 4 | // 5 | // Created by Boy van Amstel on 06-01-14. 6 | // Copyright (c) 2014 Danger Cove. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * Doesn't draw the scroller track. 13 | * 14 | * Source: http://stackoverflow.com/a/5252803/2219517 15 | */ 16 | @interface DCOTransparentScrollView : NSScrollView 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/DCOAboutWindow/DCOTransparentScroller/DCOTransparentScrollView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DCOTransparentScrollView.m 3 | // Tapetrap 4 | // 5 | // Created by Boy van Amstel on 06-01-14. 6 | // Copyright (c) 2014 Danger Cove. All rights reserved. 7 | // 8 | 9 | #import "DCOTransparentScrollView.h" 10 | 11 | @implementation DCOTransparentScrollView 12 | 13 | #pragma mark - Overrides 14 | 15 | - (void)tile { 16 | [super tile]; 17 | [[self contentView] setFrame:[self bounds]]; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/DCOAboutWindow/DCOTransparentScroller/DCOTransparentScroller.h: -------------------------------------------------------------------------------- 1 | // 2 | // DCOTransparentScroller.h 3 | // Tapetrap 4 | // 5 | // Created by Boy van Amstel on 06-01-14. 6 | // Copyright (c) 2014 Danger Cove. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * Doesn't draw the scroller track. 13 | * 14 | * Source: http://stackoverflow.com/a/5252803/2219517 15 | */ 16 | @interface DCOTransparentScroller : NSScroller 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/DCOAboutWindow/DCOTransparentScroller/DCOTransparentScroller.m: -------------------------------------------------------------------------------- 1 | // 2 | // DCOTransparentScroller.m 3 | // Tapetrap 4 | // 5 | // Created by Boy van Amstel on 06-01-14. 6 | // Copyright (c) 2014 Danger Cove. All rights reserved. 7 | // 8 | 9 | #import "DCOTransparentScroller.h" 10 | 11 | @implementation DCOTransparentScroller 12 | 13 | - (void)drawRect:(NSRect)dirtyRect { 14 | [self drawKnob]; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/ZipArchive.h: -------------------------------------------------------------------------------- 1 | /** 2 | // @header ZipArchive.h 3 | // 4 | // An objective C wrapper for minizip and libz for creating and exanding ZIP files. 5 | // 6 | // @author Created by aish on 08-9-11. 7 | // acsolu@gmail.com 8 | // @copyright Copyright 2008 Inc. All rights reserved. 9 | // 10 | */ 11 | 12 | 13 | @import Foundation; 14 | 15 | typedef NS_ENUM(NSInteger, ZipArchiveCompression) { 16 | ZipArchiveCompressionDefault = -1, 17 | ZipArchiveCompressionNone = 0, 18 | ZipArchiveCompressionSpeed = 1, 19 | ZipArchiveCompressionBest = 9, 20 | }; 21 | 22 | 23 | /** 24 | a block that is called from UnzipFileTo:overwrite:withProgressBlock: where the percentage of 25 | files processed (as an integer from 0 to 100), the number of files processed so far and the 26 | total number of files in the archive is called after each file is processed. 27 | */ 28 | typedef void(^ZipArchiveProgressUpdateBlock)(int percentage, int filesProcessed, unsigned long numFiles); 29 | 30 | /** 31 | @protocol 32 | @discussion methods for a delegate to receive error notifications and control overwriting of files 33 | */ 34 | 35 | @protocol ZipArchiveDelegate 36 | @optional 37 | 38 | /** 39 | @brief Delegate method to be notified of errors 40 | 41 | ZipArchive calls this selector on the delegate when errors are encountered. 42 | 43 | @param msg a string describing the error. 44 | @result void 45 | */ 46 | 47 | -(void) ErrorMessage:(NSString*) msg; 48 | 49 | /** 50 | @brief Delegate method to determine if a file should be replaced 51 | 52 | When an zip file is being expanded and a file is about to be replaced, this selector 53 | is called on the delegate to notify that file is about to be replaced. The delegate method 54 | should return YES to overwrite the file, or NO to skip it. 55 | 56 | @param file - path to the file to be overwritten. 57 | @result a BOOL - YES to replace, NO to skip 58 | */ 59 | 60 | -(BOOL) OverWriteOperation:(NSString*) file; 61 | 62 | @end 63 | 64 | /** 65 | @class 66 | @brief An object that can create zip files and expand existing ones. 67 | This class provides methods to create a zip file (optionally with a password) and 68 | add files to that zip archive. 69 | 70 | It also provides methods to expand an existing archive file (optionally with a password), 71 | and extract the files. 72 | */ 73 | 74 | @interface ZipArchive : NSObject { 75 | @private 76 | void* _zipFile; 77 | void* _unzFile; 78 | 79 | unsigned long _numFiles; 80 | NSString* _password; 81 | id _delegate; 82 | ZipArchiveProgressUpdateBlock _progressBlock; 83 | 84 | NSArray* _unzippedFiles; 85 | 86 | NSFileManager* _fileManager; 87 | NSStringEncoding _stringEncoding; 88 | } 89 | 90 | /** a delegate object conforming to ZipArchiveDelegate protocol */ 91 | @property (nonatomic, retain) id delegate; 92 | @property (nonatomic, readonly) unsigned long numFiles; 93 | @property (nonatomic, copy) ZipArchiveProgressUpdateBlock progressBlock; 94 | 95 | @property (nonatomic, assign) ZipArchiveCompression compression; 96 | 97 | /** 98 | @brief String encoding to be used when interpreting file names in the zip file. 99 | */ 100 | @property (nonatomic, assign) NSStringEncoding stringEncoding; 101 | 102 | /** an array of files that were successfully expanded. Available after calling UnzipFileTo:overWrite: */ 103 | @property (nonatomic, readonly) NSArray* unzippedFiles; 104 | 105 | -(id) initWithFileManager:(NSFileManager*) fileManager; 106 | 107 | -(BOOL) CreateZipFile2:(NSString*) zipFile; 108 | -(BOOL) CreateZipFile2:(NSString*) zipFile append:(BOOL)isAppend; 109 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password; 110 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password append:(BOOL)isAppend; 111 | -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; 112 | -(BOOL) addDataToZip:(NSData*) data fileAttributes:(NSDictionary *)attr newname:(NSString*) newname; 113 | -(BOOL) CloseZipFile2; 114 | 115 | -(BOOL) UnzipOpenFile:(NSString*) zipFile; 116 | -(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password; 117 | -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite; 118 | -(NSDictionary *)UnzipFileToMemory;//To avoid memory issue, only use this method for small zip files. 119 | -(BOOL) UnzipCloseFile; 120 | 121 | // List the contents of the zip archive. must be called after UnzipOpenFile. 122 | // If zip file was appended with `CreateZipFile2:append:` or ``CreateZipFile2:Password:append:`, 123 | // `getZipFileContents` result won't be updated until re-unzip-open after close write handle (`CloseZipFile2` then `UnzipCloseFile` then (`UnzipOpenFile:` or `UnzipOpenFile:Password`) get called). 124 | -(NSArray*) getZipFileContents; 125 | 126 | @end 127 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/ZipArchive.m: -------------------------------------------------------------------------------- 1 | /** 2 | // ZipArchive.m 3 | // 4 | // 5 | // Created by aish on 08-9-11. 6 | // acsolu@gmail.com 7 | // Copyright 2008 Inc. All rights reserved. 8 | // 9 | */ 10 | 11 | #import "ZipArchive.h" 12 | #import "zlib.h" 13 | #import "zconf.h" 14 | #include "minizip/zip.h" 15 | #include "minizip/unzip.h" 16 | 17 | 18 | @interface NSFileManager(ZipArchive) 19 | - (NSDictionary *)_attributesOfItemAtPath:(NSString *)path followingSymLinks:(BOOL)followingSymLinks error:(NSError **)error; 20 | @end 21 | 22 | @interface ZipArchive () 23 | 24 | -(void) OutputErrorMessage:(NSString*) msg; 25 | -(BOOL) OverWrite:(NSString*) file; 26 | -(NSDate*) Date1980; 27 | 28 | @property (nonatomic,copy) NSString* password; 29 | @end 30 | 31 | 32 | 33 | @implementation ZipArchive 34 | @synthesize delegate = _delegate; 35 | @synthesize numFiles = _numFiles; 36 | @synthesize password = _password; 37 | @synthesize unzippedFiles = _unzippedFiles; 38 | @synthesize progressBlock = _progressBlock; 39 | @synthesize stringEncoding = _stringEncoding; 40 | 41 | -(id) init 42 | { 43 | return [self initWithFileManager:[NSFileManager defaultManager]]; 44 | } 45 | 46 | -(id) initWithFileManager:(NSFileManager*) fileManager 47 | { 48 | if( self=[super init] ) 49 | { 50 | _zipFile = NULL; 51 | _fileManager = fileManager; 52 | self.stringEncoding = NSUTF8StringEncoding; 53 | self.compression = ZipArchiveCompressionDefault; 54 | } 55 | return self; 56 | } 57 | 58 | -(void) dealloc 59 | { 60 | // close any open file operations 61 | [self CloseZipFile2]; 62 | [self UnzipCloseFile]; 63 | 64 | // release retained/copied properties. 65 | [_password release]; 66 | [_delegate release]; 67 | [_unzippedFiles release]; 68 | 69 | [super dealloc]; 70 | } 71 | 72 | /** 73 | * Create a new zip file at the specified path, ready for new files to be added. 74 | * 75 | * @param zipFile the path of the zip file to create 76 | * @returns BOOL YES on success 77 | */ 78 | 79 | -(BOOL) CreateZipFile2:(NSString*) zipFile 80 | { 81 | return [self CreateZipFile2:zipFile append:NO]; 82 | } 83 | 84 | -(BOOL) CreateZipFile2:(NSString*) zipFile append:(BOOL)isAppend 85 | { 86 | _zipFile = zipOpen( (const char*)[zipFile UTF8String], (isAppend ? APPEND_STATUS_ADDINZIP : APPEND_STATUS_CREATE) ); 87 | if( !_zipFile ) 88 | return NO; 89 | return YES; 90 | } 91 | 92 | /** 93 | * Create a new zip file at the specified path, ready for new files to be added. 94 | * 95 | * @param zipFile the path of the zip file to create 96 | * @param password a password used to encrypt the zip file 97 | * @returns BOOL YES on success 98 | */ 99 | 100 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password 101 | { 102 | self.password = password; 103 | return [self CreateZipFile2:zipFile]; 104 | } 105 | 106 | -(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password append:(BOOL)isAppend 107 | { 108 | self.password = password; 109 | return [self CreateZipFile2:zipFile append:isAppend]; 110 | } 111 | 112 | /** 113 | * add an existing file on disk to the zip archive, compressing it. 114 | * 115 | * @param file the path to the file to compress 116 | * @param newname the name of the file in the zip archive, ie: path relative to the zip archive root. 117 | * @returns BOOL YES on success 118 | */ 119 | 120 | -(BOOL) addFileToZip:(NSString*) file newname:(NSString*) newname; 121 | { 122 | NSData *data = [NSData dataWithContentsOfFile:file]; 123 | NSError* error = nil; 124 | NSDictionary* attr = [_fileManager _attributesOfItemAtPath:file followingSymLinks:YES error:&error]; 125 | BOOL result = [self addDataToZip:data fileAttributes:attr newname:newname]; 126 | return result; 127 | } 128 | 129 | /** 130 | * add an existing file on disk to the zip archive, compressing it. 131 | * 132 | * @param data the data to compress 133 | * @param attr the file attribute for data to add as file 134 | * @param newname the name of the file in the zip archive, ie: path relative to the zip archive root. 135 | * @returns BOOL YES on success 136 | */ 137 | 138 | -(BOOL) addDataToZip:(NSData*) data fileAttributes:(NSDictionary *)attr newname:(NSString*) newname 139 | { 140 | if (!data) 141 | { 142 | return NO; 143 | } 144 | if( !_zipFile ) 145 | return NO; 146 | // tm_zip filetime; 147 | 148 | zip_fileinfo zipInfo = {{0}}; 149 | 150 | NSDate* fileDate = nil; 151 | 152 | if( attr ) 153 | fileDate = (NSDate*)[attr objectForKey:NSFileModificationDate]; 154 | 155 | if( fileDate == nil ) 156 | fileDate = [NSDate date]; 157 | 158 | 159 | NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 160 | NSDateComponents* components = [gregorianCalendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | 161 | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond fromDate:fileDate]; 162 | [gregorianCalendar release]; 163 | 164 | zipInfo.tmz_date.tm_sec = (uInt)components.second; 165 | zipInfo.tmz_date.tm_min = (uInt)components.minute; 166 | zipInfo.tmz_date.tm_hour = (uInt)components.hour; 167 | zipInfo.tmz_date.tm_mday = (uInt)components.day; 168 | zipInfo.tmz_date.tm_mon = (uInt)components.month; 169 | zipInfo.tmz_date.tm_year = (uInt)components.year; 170 | 171 | 172 | int ret ; 173 | if( [_password length] == 0 ) 174 | { 175 | ret = zipOpenNewFileInZip( _zipFile, 176 | (const char*) [newname cStringUsingEncoding:self.stringEncoding], 177 | &zipInfo, 178 | NULL,0, 179 | NULL,0, 180 | NULL,//comment 181 | Z_DEFLATED, 182 | self.compression ); 183 | } 184 | else 185 | { 186 | uLong crcValue = crc32( 0L,NULL, 0L ); 187 | crcValue = crc32( crcValue, (const Bytef*)[data bytes], (unsigned int)[data length] ); 188 | ret = zipOpenNewFileInZip3( _zipFile, 189 | (const char*) [newname cStringUsingEncoding:self.stringEncoding], 190 | &zipInfo, 191 | NULL,0, 192 | NULL,0, 193 | NULL,//comment 194 | Z_DEFLATED, 195 | self.compression, 196 | 0, 197 | 15, 198 | 8, 199 | Z_DEFAULT_STRATEGY, 200 | [_password cStringUsingEncoding:NSASCIIStringEncoding], 201 | crcValue ); 202 | } 203 | if( ret!=Z_OK ) 204 | { 205 | return NO; 206 | } 207 | unsigned int dataLen = (unsigned int)[data length]; 208 | ret = zipWriteInFileInZip( _zipFile, (const void*)[data bytes], dataLen); 209 | if( ret!=Z_OK ) 210 | { 211 | return NO; 212 | } 213 | ret = zipCloseFileInZip( _zipFile ); 214 | if( ret!=Z_OK ) 215 | return NO; 216 | return YES; 217 | } 218 | 219 | /** 220 | * Close a zip file after creating and added files to it. 221 | * 222 | * @returns BOOL YES on success 223 | */ 224 | 225 | -(BOOL) CloseZipFile2 226 | { 227 | self.password = nil; 228 | if( _zipFile==NULL ) 229 | return NO; 230 | BOOL ret = zipClose( _zipFile,NULL )==Z_OK?YES:NO; 231 | _zipFile = NULL; 232 | return ret; 233 | } 234 | 235 | /** 236 | * open an existing zip file ready for expanding. 237 | * 238 | * @param zipFile the path to a zip file to be opened. 239 | * @returns BOOL YES on success 240 | */ 241 | 242 | -(BOOL) UnzipOpenFile:(NSString*) zipFile 243 | { 244 | // create an array to receive the list of unzipped files. 245 | if (_unzippedFiles) [_unzippedFiles release]; 246 | _unzippedFiles = [[NSMutableArray alloc] initWithCapacity:1]; 247 | 248 | _unzFile = unzOpen( (const char*)[zipFile UTF8String] ); 249 | if( _unzFile ) 250 | { 251 | unz_global_info globalInfo = {0}; 252 | if( unzGetGlobalInfo(_unzFile, &globalInfo )==UNZ_OK ) 253 | { 254 | _numFiles = globalInfo.number_entry; 255 | NSLog(@"%lu entries in the zip file", globalInfo.number_entry); 256 | } 257 | } 258 | return _unzFile!=NULL; 259 | } 260 | 261 | /** 262 | * open an existing zip file with a password ready for expanding. 263 | * 264 | * @param zipFile the path to a zip file to be opened. 265 | * @param password the password to use decrpyting the file. 266 | * @returns BOOL YES on success 267 | */ 268 | 269 | -(BOOL) UnzipOpenFile:(NSString*) zipFile Password:(NSString*) password 270 | { 271 | self.password = password; 272 | return [self UnzipOpenFile:zipFile]; 273 | } 274 | 275 | /** 276 | * Expand all files in the zip archive into the specified directory. 277 | * 278 | * If a delegate has been set and responds to OverWriteOperation: it can 279 | * return YES to overwrite a file, or NO to skip that file. 280 | * 281 | * On completion, the property `unzippedFiles` will be an array populated 282 | * with the full paths of each file that was successfully expanded. 283 | * 284 | * @param path the directory where expanded files will be created 285 | * @param overwrite should existing files be overwritten 286 | * @returns BOOL YES on success 287 | */ 288 | 289 | -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite 290 | { 291 | BOOL success = YES; 292 | int index = 0; 293 | int progress = -1; 294 | int ret = unzGoToFirstFile( _unzFile ); 295 | unsigned char buffer[4096] = {0}; 296 | if( ret!=UNZ_OK ) 297 | { 298 | [self OutputErrorMessage:@"Failed"]; 299 | } 300 | 301 | const char* password = [_password cStringUsingEncoding:NSASCIIStringEncoding]; 302 | 303 | do{ 304 | @autoreleasepool { 305 | if( [_password length]==0 ) 306 | ret = unzOpenCurrentFile( _unzFile ); 307 | else 308 | ret = unzOpenCurrentFilePassword( _unzFile, password ); 309 | if( ret!=UNZ_OK ) 310 | { 311 | [self OutputErrorMessage:@"Error occurs"]; 312 | success = NO; 313 | break; 314 | } 315 | // reading data and write to file 316 | int read ; 317 | unz_file_info fileInfo ={0}; 318 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); 319 | if( ret!=UNZ_OK ) 320 | { 321 | [self OutputErrorMessage:@"Error occurs while getting file info"]; 322 | success = NO; 323 | unzCloseCurrentFile( _unzFile ); 324 | break; 325 | } 326 | char* filename = (char*) malloc( fileInfo.size_filename +1 ); 327 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); 328 | filename[fileInfo.size_filename] = '\0'; 329 | 330 | // check if it contains directory 331 | NSString * strPath = [NSString stringWithCString:filename encoding:self.stringEncoding]; 332 | BOOL isDirectory = NO; 333 | if( filename[fileInfo.size_filename-1]=='/' || filename[fileInfo.size_filename-1]=='\\') 334 | isDirectory = YES; 335 | free( filename ); 336 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound ) 337 | {// contains a path 338 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; 339 | } 340 | NSString* fullPath = [path stringByAppendingPathComponent:strPath]; 341 | 342 | if( isDirectory ) 343 | [_fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:nil error:nil]; 344 | else 345 | [_fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil]; 346 | 347 | FILE* fp = NULL; 348 | do 349 | { 350 | read = unzReadCurrentFile(_unzFile, buffer, 4096); 351 | if (read >= 0) 352 | { 353 | if (fp == NULL) { 354 | if( [_fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite ) 355 | { 356 | if( ![self OverWrite:fullPath] ) 357 | { 358 | // don't process any more of the file, but continue 359 | break; 360 | } 361 | } 362 | if (!isDirectory) { 363 | fp = fopen( (const char*)[fullPath UTF8String], "wb"); 364 | if (fp == NULL) { 365 | [self OutputErrorMessage:@"Failed to open output file for writing"]; 366 | break; 367 | } 368 | } 369 | } 370 | fwrite(buffer, read, 1, fp ); 371 | } 372 | else // if (read < 0) 373 | { 374 | ret = read; // result will be an error code 375 | success = NO; 376 | [self OutputErrorMessage:@"Failed to read zip file"]; 377 | } 378 | } while (read > 0); 379 | 380 | if (fp) 381 | { 382 | fclose( fp ); 383 | 384 | // add the full path of this file to the output array 385 | [(NSMutableArray*)_unzippedFiles addObject:fullPath]; 386 | 387 | // set the orignal datetime property 388 | if( fileInfo.tmu_date.tm_year!=0 ) 389 | { 390 | NSDateComponents* components = [[NSDateComponents alloc] init]; 391 | components.second = fileInfo.tmu_date.tm_sec; 392 | components.minute = fileInfo.tmu_date.tm_min; 393 | components.hour = fileInfo.tmu_date.tm_hour; 394 | components.day = fileInfo.tmu_date.tm_mday; 395 | components.month = fileInfo.tmu_date.tm_mon + 1; 396 | components.year = fileInfo.tmu_date.tm_year; 397 | 398 | NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 399 | NSDate* orgDate = [[gregorianCalendar dateFromComponents:components] retain]; 400 | [components release]; 401 | [gregorianCalendar release]; 402 | 403 | NSDictionary* attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate]; //[_fileManager fileAttributesAtPath:fullPath traverseLink:YES]; 404 | if( attr ) 405 | { 406 | // [attr setValue:orgDate forKey:NSFileCreationDate]; 407 | if( ![_fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] ) 408 | { 409 | // cann't set attributes 410 | NSLog(@"Failed to set attributes"); 411 | } 412 | 413 | } 414 | [orgDate release]; 415 | orgDate = nil; 416 | } 417 | 418 | } 419 | 420 | if (ret == UNZ_OK) { 421 | ret = unzCloseCurrentFile( _unzFile ); 422 | if (ret != UNZ_OK) { 423 | [self OutputErrorMessage:@"file was unzipped but failed crc check"]; 424 | success = NO; 425 | } 426 | } 427 | 428 | if (ret == UNZ_OK) { 429 | ret = unzGoToNextFile( _unzFile ); 430 | } 431 | 432 | if (_progressBlock && _numFiles) { 433 | index++; 434 | int p = index*100/_numFiles; 435 | progress = p; 436 | _progressBlock(progress, index, _numFiles); 437 | } 438 | } 439 | } while (ret==UNZ_OK && ret!=UNZ_END_OF_LIST_OF_FILE); 440 | return success; 441 | } 442 | 443 | -(NSDictionary *)UnzipFileToMemory 444 | { 445 | NSMutableDictionary *fileDictionary = [NSMutableDictionary dictionary]; 446 | 447 | BOOL success = YES; 448 | int index = 0; 449 | int progress = -1; 450 | int ret = unzGoToFirstFile( _unzFile ); 451 | unsigned char buffer[4096] = {0}; 452 | if( ret!=UNZ_OK ) 453 | { 454 | [self OutputErrorMessage:@"Failed"]; 455 | } 456 | 457 | const char* password = [_password cStringUsingEncoding:NSASCIIStringEncoding]; 458 | 459 | do{ 460 | @autoreleasepool { 461 | if( [_password length]==0 ) 462 | ret = unzOpenCurrentFile( _unzFile ); 463 | else 464 | ret = unzOpenCurrentFilePassword( _unzFile, password ); 465 | if( ret!=UNZ_OK ) 466 | { 467 | [self OutputErrorMessage:@"Error occurs"]; 468 | success = NO; 469 | break; 470 | } 471 | // reading data and write to file 472 | int read ; 473 | unz_file_info fileInfo ={0}; 474 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); 475 | if( ret!=UNZ_OK ) 476 | { 477 | [self OutputErrorMessage:@"Error occurs while getting file info"]; 478 | success = NO; 479 | unzCloseCurrentFile( _unzFile ); 480 | break; 481 | } 482 | char* filename = (char*) malloc( fileInfo.size_filename +1 ); 483 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); 484 | filename[fileInfo.size_filename] = '\0'; 485 | 486 | // check if it contains directory 487 | NSString * strPath = [NSString stringWithCString:filename encoding:self.stringEncoding]; 488 | free( filename ); 489 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound ) 490 | {// contains a path 491 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; 492 | } 493 | 494 | NSMutableData *fileMutableData = [NSMutableData data]; 495 | do 496 | { 497 | read = unzReadCurrentFile(_unzFile, buffer, 4096); 498 | if (read >= 0) 499 | { 500 | if (read != 0) 501 | { 502 | [fileMutableData appendBytes:buffer length:read]; 503 | } 504 | } 505 | else // if (read < 0) 506 | { 507 | ret = read; // result will be an error code 508 | success = NO; 509 | [self OutputErrorMessage:@"Failed to read zip file"]; 510 | } 511 | } while (read > 0); 512 | 513 | 514 | if (fileMutableData.length > 0) 515 | { 516 | NSData *fileData = [NSData dataWithData:fileMutableData]; 517 | [fileDictionary setObject:fileData forKey:strPath]; 518 | } 519 | 520 | if (ret == UNZ_OK) { 521 | ret = unzCloseCurrentFile( _unzFile ); 522 | if (ret != UNZ_OK) { 523 | [self OutputErrorMessage:@"file was unzipped but failed crc check"]; 524 | success = NO; 525 | } 526 | } 527 | 528 | if (ret == UNZ_OK) { 529 | ret = unzGoToNextFile( _unzFile ); 530 | } 531 | 532 | if (_progressBlock && _numFiles) { 533 | index++; 534 | int p = index*100/_numFiles; 535 | progress = p; 536 | _progressBlock(progress, index, _numFiles); 537 | } 538 | } 539 | } while (ret==UNZ_OK && ret!=UNZ_END_OF_LIST_OF_FILE); 540 | 541 | NSDictionary *resultDictionary = [NSDictionary dictionaryWithDictionary:fileDictionary]; 542 | return resultDictionary; 543 | } 544 | 545 | /** 546 | * Close the zip file. 547 | * 548 | * @returns BOOL YES on success 549 | */ 550 | 551 | -(BOOL) UnzipCloseFile 552 | { 553 | self.password = nil; 554 | if( _unzFile ) { 555 | int err = unzClose( _unzFile ); 556 | _unzFile = nil; 557 | return err ==UNZ_OK; 558 | } 559 | return YES; 560 | } 561 | 562 | 563 | /** 564 | * Return a list of filenames that are in the zip archive. 565 | * No path information is available as this can be called before the zip is expanded. 566 | * 567 | * @returns NSArray list of filenames in the zip archive. 568 | */ 569 | 570 | -(NSArray*) getZipFileContents // list the contents of the zip archive. must be called after UnzipOpenFile 571 | { 572 | int ret = unzGoToFirstFile( _unzFile ); 573 | NSMutableArray * allFilenames = [NSMutableArray arrayWithCapacity:40]; 574 | 575 | if( ret!=UNZ_OK ) 576 | { 577 | [self OutputErrorMessage:@"Failed"]; 578 | } 579 | 580 | const char* password = [_password cStringUsingEncoding:NSASCIIStringEncoding]; 581 | 582 | do{ 583 | if( [_password length]==0 ) 584 | ret = unzOpenCurrentFile( _unzFile ); 585 | else 586 | ret = unzOpenCurrentFilePassword( _unzFile, password ); 587 | if( ret!=UNZ_OK ) 588 | { 589 | [self OutputErrorMessage:@"Error occured"]; 590 | break; 591 | } 592 | 593 | // reading data and write to file 594 | unz_file_info fileInfo ={0}; 595 | ret = unzGetCurrentFileInfo(_unzFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0); 596 | if( ret!=UNZ_OK ) 597 | { 598 | [self OutputErrorMessage:@"Error occurs while getting file info"]; 599 | unzCloseCurrentFile( _unzFile ); 600 | break; 601 | } 602 | char* filename = (char*) malloc( fileInfo.size_filename +1 ); 603 | unzGetCurrentFileInfo(_unzFile, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); 604 | filename[fileInfo.size_filename] = '\0'; 605 | 606 | // check if it contains directory 607 | NSString * strPath = [NSString stringWithCString:filename encoding:self.stringEncoding]; 608 | free( filename ); 609 | if( [strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location!=NSNotFound ) 610 | {// contains a path 611 | strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; 612 | } 613 | 614 | // Copy name to array 615 | [allFilenames addObject:strPath]; 616 | 617 | unzCloseCurrentFile( _unzFile ); 618 | ret = unzGoToNextFile( _unzFile ); 619 | } while( ret==UNZ_OK && UNZ_OK!=UNZ_END_OF_LIST_OF_FILE ); 620 | 621 | // return an immutable array. 622 | return [NSArray arrayWithArray:allFilenames]; 623 | } 624 | 625 | 626 | #pragma mark wrapper for delegate 627 | 628 | /** 629 | * send the ErrorMessage: to the delegate if it responds to it. 630 | */ 631 | -(void) OutputErrorMessage:(NSString*) msg 632 | { 633 | if( _delegate && [_delegate respondsToSelector:@selector(ErrorMessage:)] ) 634 | [_delegate ErrorMessage:msg]; 635 | } 636 | 637 | /** 638 | * send the OverWriteOperation: selector to the delegate if it responds to it, 639 | * returning the result, or YES by default. 640 | */ 641 | 642 | -(BOOL) OverWrite:(NSString*) file 643 | { 644 | if( _delegate && [_delegate respondsToSelector:@selector(OverWriteOperation:)] ) 645 | return [_delegate OverWriteOperation:file]; 646 | return YES; 647 | } 648 | 649 | #pragma mark get NSDate object for 1980-01-01 650 | -(NSDate*) Date1980 651 | { 652 | NSDateComponents *comps = [[NSDateComponents alloc] init]; 653 | [comps setDay:1]; 654 | [comps setMonth:1]; 655 | [comps setYear:1980]; 656 | NSCalendar *gregorian = [[NSCalendar alloc] 657 | initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 658 | NSDate *date = [gregorian dateFromComponents:comps]; 659 | 660 | [comps release]; 661 | [gregorian release]; 662 | return date; 663 | } 664 | 665 | 666 | @end 667 | 668 | 669 | @implementation NSFileManager(ZipArchive) 670 | 671 | - (NSDictionary *)_attributesOfItemAtPath:(NSString *)path followingSymLinks:(BOOL)followingSymLinks error:(NSError **)error 672 | { 673 | // call file manager default action, which is to not follow symlinks 674 | NSDictionary* results = [self attributesOfItemAtPath:path error:error]; 675 | if (followingSymLinks && results && (error ? *error == nil : YES)) { 676 | if ([[results fileType] isEqualToString:NSFileTypeSymbolicLink]) { 677 | // follow the symlink 678 | NSString* realPath = [self destinationOfSymbolicLinkAtPath:path error:error]; 679 | if (realPath && (error ? *error == nil : YES)) { 680 | return [self _attributesOfItemAtPath:realPath followingSymLinks:followingSymLinks error:error]; 681 | } else { 682 | // failure to resolve symlink should be an error returning nil and error will already be set. 683 | return nil; 684 | } 685 | } 686 | } 687 | return results; 688 | } 689 | 690 | @end 691 | 692 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/minizip/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(const char* passwd, /* password string */ 91 | unsigned char* buf, /* where to write header */ 92 | int bufSize, 93 | unsigned long* pkeys, 94 | const unsigned long* pcrc_32_tab, 95 | unsigned long crcForCrypting) 96 | { 97 | int n; /* index in random header */ 98 | int t; /* temporary */ 99 | int c; /* random byte */ 100 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 101 | static unsigned calls = 0; /* ensure different random header each time */ 102 | 103 | if (bufSize> 7) & 0xff; 118 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 119 | } 120 | /* Encrypt random header (last two bytes is high word of crc) */ 121 | init_keys(passwd, pkeys, pcrc_32_tab); 122 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 123 | { 124 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 125 | } 126 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 127 | buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 128 | return n; 129 | } 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/minizip/ioapi.c: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 | 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 5 | 6 | Modifications for Zip64 support 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 8 | 9 | For more info read MiniZip_info.txt 10 | 11 | */ 12 | 13 | #if (defined(_WIN32)) 14 | #define _CRT_SECURE_NO_WARNINGS 15 | #endif 16 | 17 | #include "ioapi.h" 18 | 19 | voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) 20 | { 21 | if (pfilefunc->zfile_func64.zopen64_file != NULL) 22 | return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); 23 | else 24 | { 25 | return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode); 26 | } 27 | } 28 | 29 | long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) 30 | { 31 | if (pfilefunc->zfile_func64.zseek64_file != NULL) 32 | return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); 33 | else 34 | { 35 | uLong offsetTruncated = (uLong)offset; 36 | if (offsetTruncated != offset) 37 | return -1; 38 | else 39 | return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); 40 | } 41 | } 42 | 43 | ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream) 44 | { 45 | if (pfilefunc->zfile_func64.zseek64_file != NULL) 46 | return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); 47 | else 48 | { 49 | uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); 50 | if ((tell_uLong) == ((uLong)-1)) 51 | return (ZPOS64_T)-1; 52 | else 53 | return tell_uLong; 54 | } 55 | } 56 | 57 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32) 58 | { 59 | p_filefunc64_32->zfile_func64.zopen64_file = NULL; 60 | p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; 61 | p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; 62 | p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; 63 | p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; 64 | p_filefunc64_32->zfile_func64.ztell64_file = NULL; 65 | p_filefunc64_32->zfile_func64.zseek64_file = NULL; 66 | p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; 67 | p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; 68 | p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque; 69 | p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file; 70 | p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; 71 | } 72 | 73 | 74 | 75 | static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); 76 | static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 77 | static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); 78 | static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); 79 | static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); 80 | static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); 81 | static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); 82 | 83 | static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode) 84 | { 85 | FILE* file = NULL; 86 | const char* mode_fopen = NULL; 87 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 88 | mode_fopen = "rb"; 89 | else 90 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 91 | mode_fopen = "r+b"; 92 | else 93 | if (mode & ZLIB_FILEFUNC_MODE_CREATE) 94 | mode_fopen = "wb"; 95 | 96 | if ((filename!=NULL) && (mode_fopen != NULL)) 97 | file = fopen(filename, mode_fopen); 98 | return file; 99 | } 100 | 101 | static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) 102 | { 103 | FILE* file = NULL; 104 | const char* mode_fopen = NULL; 105 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 106 | mode_fopen = "rb"; 107 | else 108 | if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 109 | mode_fopen = "r+b"; 110 | else 111 | if (mode & ZLIB_FILEFUNC_MODE_CREATE) 112 | mode_fopen = "wb"; 113 | 114 | if ((filename!=NULL) && (mode_fopen != NULL)) 115 | file = fopen((const char*)filename, mode_fopen); 116 | return file; 117 | } 118 | 119 | 120 | static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) 121 | { 122 | uLong ret; 123 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); 124 | return ret; 125 | } 126 | 127 | static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) 128 | { 129 | uLong ret; 130 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); 131 | return ret; 132 | } 133 | 134 | static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) 135 | { 136 | long ret; 137 | ret = ftell((FILE *)stream); 138 | return ret; 139 | } 140 | 141 | 142 | static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) 143 | { 144 | ZPOS64_T ret; 145 | ret = ftello((FILE *)stream); 146 | return ret; 147 | } 148 | 149 | static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin) 150 | { 151 | int fseek_origin=0; 152 | long ret; 153 | switch (origin) 154 | { 155 | case ZLIB_FILEFUNC_SEEK_CUR : 156 | fseek_origin = SEEK_CUR; 157 | break; 158 | case ZLIB_FILEFUNC_SEEK_END : 159 | fseek_origin = SEEK_END; 160 | break; 161 | case ZLIB_FILEFUNC_SEEK_SET : 162 | fseek_origin = SEEK_SET; 163 | break; 164 | default: return -1; 165 | } 166 | ret = 0; 167 | if (fseek((FILE *)stream, offset, fseek_origin) != 0) 168 | ret = -1; 169 | return ret; 170 | } 171 | 172 | static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) 173 | { 174 | int fseek_origin=0; 175 | long ret; 176 | switch (origin) 177 | { 178 | case ZLIB_FILEFUNC_SEEK_CUR : 179 | fseek_origin = SEEK_CUR; 180 | break; 181 | case ZLIB_FILEFUNC_SEEK_END : 182 | fseek_origin = SEEK_END; 183 | break; 184 | case ZLIB_FILEFUNC_SEEK_SET : 185 | fseek_origin = SEEK_SET; 186 | break; 187 | default: return -1; 188 | } 189 | ret = 0; 190 | 191 | if(fseeko((FILE *)stream, offset, fseek_origin) != 0) 192 | ret = -1; 193 | 194 | return ret; 195 | } 196 | 197 | 198 | static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) 199 | { 200 | int ret; 201 | ret = fclose((FILE *)stream); 202 | return ret; 203 | } 204 | 205 | static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) 206 | { 207 | int ret; 208 | ret = ferror((FILE *)stream); 209 | return ret; 210 | } 211 | 212 | void fill_fopen_filefunc (pzlib_filefunc_def) 213 | zlib_filefunc_def* pzlib_filefunc_def; 214 | { 215 | pzlib_filefunc_def->zopen_file = fopen_file_func; 216 | pzlib_filefunc_def->zread_file = fread_file_func; 217 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; 218 | pzlib_filefunc_def->ztell_file = ftell_file_func; 219 | pzlib_filefunc_def->zseek_file = fseek_file_func; 220 | pzlib_filefunc_def->zclose_file = fclose_file_func; 221 | pzlib_filefunc_def->zerror_file = ferror_file_func; 222 | pzlib_filefunc_def->opaque = NULL; 223 | } 224 | 225 | void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) 226 | { 227 | pzlib_filefunc_def->zopen64_file = fopen64_file_func; 228 | pzlib_filefunc_def->zread_file = fread_file_func; 229 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; 230 | pzlib_filefunc_def->ztell64_file = ftell64_file_func; 231 | pzlib_filefunc_def->zseek64_file = fseek64_file_func; 232 | pzlib_filefunc_def->zclose_file = fclose_file_func; 233 | pzlib_filefunc_def->zerror_file = ferror_file_func; 234 | pzlib_filefunc_def->opaque = NULL; 235 | } 236 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/minizip/ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 | 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 5 | 6 | Modifications for Zip64 support 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 8 | 9 | For more info read MiniZip_info.txt 10 | 11 | Changes 12 | 13 | Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this) 14 | Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux. 15 | More if/def section may be needed to support other platforms 16 | Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows. 17 | (but you should use iowin32.c for windows instead) 18 | 19 | */ 20 | 21 | #ifndef _ZLIBIOAPI64_H 22 | #define _ZLIBIOAPI64_H 23 | 24 | #if (!defined(_WIN32)) && (!defined(WIN32)) 25 | 26 | // Linux needs this to support file operation on files larger then 4+GB 27 | // But might need better if/def to select just the platforms that needs them. 28 | 29 | #ifndef __USE_FILE_OFFSET64 30 | #define __USE_FILE_OFFSET64 31 | #endif 32 | #ifndef __USE_LARGEFILE64 33 | #define __USE_LARGEFILE64 34 | #endif 35 | #ifndef _LARGEFILE64_SOURCE 36 | #define _LARGEFILE64_SOURCE 37 | #endif 38 | #ifndef _FILE_OFFSET_BIT 39 | #define _FILE_OFFSET_BIT 64 40 | #endif 41 | #endif 42 | 43 | #include 44 | #include 45 | #include "zlib.h" 46 | 47 | #if defined(USE_FILE32API) 48 | #define fopen64 fopen 49 | #define ftello64 ftell 50 | #define fseeko64 fseek 51 | #else 52 | #ifdef _MSC_VER 53 | #define fopen64 fopen 54 | #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) 55 | #define ftello64 _ftelli64 56 | #define fseeko64 _fseeki64 57 | #else // old MSC 58 | #define ftello64 ftell 59 | #define fseeko64 fseek 60 | #endif 61 | #endif 62 | #endif 63 | 64 | /* 65 | #ifndef ZPOS64_T 66 | #ifdef _WIN32 67 | #define ZPOS64_T fpos_t 68 | #else 69 | #include 70 | #define ZPOS64_T uint64_t 71 | #endif 72 | #endif 73 | */ 74 | 75 | #ifdef HAVE_MINIZIP64_CONF_H 76 | #include "mz64conf.h" 77 | #endif 78 | 79 | /* a type choosen by DEFINE */ 80 | #ifdef HAVE_64BIT_INT_CUSTOM 81 | typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; 82 | #else 83 | #ifdef HAS_STDINT_H 84 | #include "stdint.h" 85 | typedef uint64_t ZPOS64_T; 86 | #else 87 | 88 | 89 | #if defined(_MSC_VER) || defined(__BORLANDC__) 90 | typedef unsigned __int64 ZPOS64_T; 91 | #else 92 | typedef unsigned long long int ZPOS64_T; 93 | #endif 94 | #endif 95 | #endif 96 | 97 | 98 | 99 | #ifdef __cplusplus 100 | extern "C" { 101 | #endif 102 | 103 | 104 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 105 | #define ZLIB_FILEFUNC_SEEK_END (2) 106 | #define ZLIB_FILEFUNC_SEEK_SET (0) 107 | 108 | #define ZLIB_FILEFUNC_MODE_READ (1) 109 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 110 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 111 | 112 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 113 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 114 | 115 | 116 | #ifndef ZCALLBACK 117 | #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 118 | #define ZCALLBACK CALLBACK 119 | #else 120 | #define ZCALLBACK 121 | #endif 122 | #endif 123 | 124 | 125 | 126 | 127 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 128 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 129 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 130 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 131 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 132 | 133 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 134 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 135 | 136 | 137 | /* here is the "old" 32 bits structure structure */ 138 | typedef struct zlib_filefunc_def_s 139 | { 140 | open_file_func zopen_file; 141 | read_file_func zread_file; 142 | write_file_func zwrite_file; 143 | tell_file_func ztell_file; 144 | seek_file_func zseek_file; 145 | close_file_func zclose_file; 146 | testerror_file_func zerror_file; 147 | voidpf opaque; 148 | } zlib_filefunc_def; 149 | 150 | typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); 151 | typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); 152 | typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); 153 | 154 | typedef struct zlib_filefunc64_def_s 155 | { 156 | open64_file_func zopen64_file; 157 | read_file_func zread_file; 158 | write_file_func zwrite_file; 159 | tell64_file_func ztell64_file; 160 | seek64_file_func zseek64_file; 161 | close_file_func zclose_file; 162 | testerror_file_func zerror_file; 163 | voidpf opaque; 164 | } zlib_filefunc64_def; 165 | 166 | void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); 167 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 168 | 169 | /* now internal definition, only for zip.c and unzip.h */ 170 | typedef struct zlib_filefunc64_32_def_s 171 | { 172 | zlib_filefunc64_def zfile_func64; 173 | open_file_func zopen32_file; 174 | tell_file_func ztell32_file; 175 | seek_file_func zseek32_file; 176 | } zlib_filefunc64_32_def; 177 | 178 | 179 | #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 180 | #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) 181 | //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) 182 | //#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) 183 | #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) 184 | #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) 185 | 186 | voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); 187 | long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); 188 | ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); 189 | 190 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); 191 | 192 | #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) 193 | #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) 194 | #define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) 195 | 196 | #ifdef __cplusplus 197 | } 198 | #endif 199 | 200 | #endif 201 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/minizip/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 | extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) 31 | const char* file; 32 | const char* fileOut; 33 | const char* fileOutTmp; 34 | uLong* nRecovered; 35 | uLong* bytesRecovered; 36 | { 37 | int err = Z_OK; 38 | FILE* fpZip = fopen(file, "rb"); 39 | FILE* fpOut = fopen(fileOut, "wb"); 40 | FILE* fpOutCD = fopen(fileOutTmp, "wb"); 41 | if (fpZip != NULL && fpOut != NULL) { 42 | int entries = 0; 43 | uLong totalBytes = 0; 44 | char header[30]; 45 | char filename[256]; 46 | char extra[1024]; 47 | int offset = 0; 48 | int offsetCD = 0; 49 | while ( fread(header, 1, 30, fpZip) == 30 ) { 50 | int currentOffset = offset; 51 | 52 | /* File entry */ 53 | if (READ_32(header) == 0x04034b50) { 54 | unsigned int version = READ_16(header + 4); 55 | unsigned int gpflag = READ_16(header + 6); 56 | unsigned int method = READ_16(header + 8); 57 | unsigned int filetime = READ_16(header + 10); 58 | unsigned int filedate = READ_16(header + 12); 59 | unsigned int crc = READ_32(header + 14); /* crc */ 60 | unsigned int cpsize = READ_32(header + 18); /* compressed size */ 61 | unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */ 62 | unsigned int fnsize = READ_16(header + 26); /* file name length */ 63 | unsigned int extsize = READ_16(header + 28); /* extra field length */ 64 | filename[0] = extra[0] = '\0'; 65 | 66 | /* Header */ 67 | if (fwrite(header, 1, 30, fpOut) == 30) { 68 | offset += 30; 69 | } else { 70 | err = Z_ERRNO; 71 | break; 72 | } 73 | 74 | /* Filename */ 75 | if (fnsize > 0) { 76 | if (fread(filename, 1, fnsize, fpZip) == fnsize) { 77 | if (fwrite(filename, 1, fnsize, fpOut) == fnsize) { 78 | offset += fnsize; 79 | } else { 80 | err = Z_ERRNO; 81 | break; 82 | } 83 | } else { 84 | err = Z_ERRNO; 85 | break; 86 | } 87 | } else { 88 | err = Z_STREAM_ERROR; 89 | break; 90 | } 91 | 92 | /* Extra field */ 93 | if (extsize > 0) { 94 | if (fread(extra, 1, extsize, fpZip) == extsize) { 95 | if (fwrite(extra, 1, extsize, fpOut) == extsize) { 96 | offset += extsize; 97 | } else { 98 | err = Z_ERRNO; 99 | break; 100 | } 101 | } else { 102 | err = Z_ERRNO; 103 | break; 104 | } 105 | } 106 | 107 | /* Data */ 108 | { 109 | int dataSize = cpsize; 110 | if (dataSize == 0) { 111 | dataSize = uncpsize; 112 | } 113 | if (dataSize > 0) { 114 | char* data = malloc(dataSize); 115 | if (data != NULL) { 116 | if ((int)fread(data, 1, dataSize, fpZip) == dataSize) { 117 | if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) { 118 | offset += dataSize; 119 | totalBytes += dataSize; 120 | } else { 121 | err = Z_ERRNO; 122 | } 123 | } else { 124 | err = Z_ERRNO; 125 | } 126 | free(data); 127 | if (err != Z_OK) { 128 | break; 129 | } 130 | } else { 131 | err = Z_MEM_ERROR; 132 | break; 133 | } 134 | } 135 | } 136 | 137 | /* Central directory entry */ 138 | { 139 | char header[46]; 140 | char* comment = ""; 141 | int comsize = (int) strlen(comment); 142 | WRITE_32(header, 0x02014b50); 143 | WRITE_16(header + 4, version); 144 | WRITE_16(header + 6, version); 145 | WRITE_16(header + 8, gpflag); 146 | WRITE_16(header + 10, method); 147 | WRITE_16(header + 12, filetime); 148 | WRITE_16(header + 14, filedate); 149 | WRITE_32(header + 16, crc); 150 | WRITE_32(header + 20, cpsize); 151 | WRITE_32(header + 24, uncpsize); 152 | WRITE_16(header + 28, fnsize); 153 | WRITE_16(header + 30, extsize); 154 | WRITE_16(header + 32, comsize); 155 | WRITE_16(header + 34, 0); /* disk # */ 156 | WRITE_16(header + 36, 0); /* int attrb */ 157 | WRITE_32(header + 38, 0); /* ext attrb */ 158 | WRITE_32(header + 42, currentOffset); 159 | /* Header */ 160 | if (fwrite(header, 1, 46, fpOutCD) == 46) { 161 | offsetCD += 46; 162 | 163 | /* Filename */ 164 | if (fnsize > 0) { 165 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { 166 | offsetCD += fnsize; 167 | } else { 168 | err = Z_ERRNO; 169 | break; 170 | } 171 | } else { 172 | err = Z_STREAM_ERROR; 173 | break; 174 | } 175 | 176 | /* Extra field */ 177 | if (extsize > 0) { 178 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { 179 | offsetCD += extsize; 180 | } else { 181 | err = Z_ERRNO; 182 | break; 183 | } 184 | } 185 | 186 | /* Comment field */ 187 | if (comsize > 0) { 188 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { 189 | offsetCD += comsize; 190 | } else { 191 | err = Z_ERRNO; 192 | break; 193 | } 194 | } 195 | 196 | 197 | } else { 198 | err = Z_ERRNO; 199 | break; 200 | } 201 | } 202 | 203 | /* Success */ 204 | entries++; 205 | 206 | } else { 207 | break; 208 | } 209 | } 210 | 211 | /* Final central directory */ 212 | { 213 | int entriesZip = entries; 214 | char header[22]; 215 | char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; 216 | int comsize = (int) strlen(comment); 217 | if (entriesZip > 0xffff) { 218 | entriesZip = 0xffff; 219 | } 220 | WRITE_32(header, 0x06054b50); 221 | WRITE_16(header + 4, 0); /* disk # */ 222 | WRITE_16(header + 6, 0); /* disk # */ 223 | WRITE_16(header + 8, entriesZip); /* hack */ 224 | WRITE_16(header + 10, entriesZip); /* hack */ 225 | WRITE_32(header + 12, offsetCD); /* size of CD */ 226 | WRITE_32(header + 16, offset); /* offset to CD */ 227 | WRITE_16(header + 20, comsize); /* comment */ 228 | 229 | /* Header */ 230 | if (fwrite(header, 1, 22, fpOutCD) == 22) { 231 | 232 | /* Comment field */ 233 | if (comsize > 0) { 234 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { 235 | err = Z_ERRNO; 236 | } 237 | } 238 | 239 | } else { 240 | err = Z_ERRNO; 241 | } 242 | } 243 | 244 | /* Final merge (file + central directory) */ 245 | fclose(fpOutCD); 246 | if (err == Z_OK) { 247 | fpOutCD = fopen(fileOutTmp, "rb"); 248 | if (fpOutCD != NULL) { 249 | int nRead; 250 | char buffer[8192]; 251 | while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) { 252 | if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) { 253 | err = Z_ERRNO; 254 | break; 255 | } 256 | } 257 | fclose(fpOutCD); 258 | } 259 | } 260 | 261 | /* Close */ 262 | fclose(fpZip); 263 | fclose(fpOut); 264 | 265 | /* Wipe temporary file */ 266 | (void)remove(fileOutTmp); 267 | 268 | /* Number of recovered entries */ 269 | if (err == Z_OK) { 270 | if (nRecovered != NULL) { 271 | *nRecovered = entries; 272 | } 273 | if (bytesRecovered != NULL) { 274 | *bytesRecovered = totalBytes; 275 | } 276 | } 277 | } else { 278 | err = Z_STREAM_ERROR; 279 | } 280 | return err; 281 | } 282 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/minizip/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 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/minizip/unzip.h: -------------------------------------------------------------------------------- 1 | /* unzip.h -- IO for uncompress .zip files using zlib 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications of Unzip for Zip64 8 | Copyright (C) 2007-2008 Even Rouault 9 | 10 | Modifications for Zip64 support on both zip and unzip 11 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 12 | 13 | For more info read MiniZip_info.txt 14 | 15 | --------------------------------------------------------------------------------- 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 | Changes 38 | 39 | See header of unzip64.c 40 | 41 | */ 42 | 43 | #ifndef _unz64_H 44 | #define _unz64_H 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | #ifndef _ZLIB_H 51 | #include "zlib.h" 52 | #endif 53 | 54 | #ifndef _ZLIBIOAPI_H 55 | #include "ioapi.h" 56 | #endif 57 | 58 | #ifdef HAVE_BZIP2 59 | #include "bzlib.h" 60 | #endif 61 | 62 | #define Z_BZIP2ED 12 63 | 64 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) 65 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 66 | from (void*) without cast */ 67 | typedef struct TagunzFile__ { int unused; } unzFile__; 68 | typedef unzFile__ *unzFile; 69 | #else 70 | typedef voidp unzFile; 71 | #endif 72 | 73 | 74 | #define UNZ_OK (0) 75 | #define UNZ_END_OF_LIST_OF_FILE (-100) 76 | #define UNZ_ERRNO (Z_ERRNO) 77 | #define UNZ_EOF (0) 78 | #define UNZ_PARAMERROR (-102) 79 | #define UNZ_BADZIPFILE (-103) 80 | #define UNZ_INTERNALERROR (-104) 81 | #define UNZ_CRCERROR (-105) 82 | 83 | /* tm_unz contain date/time info */ 84 | typedef struct tm_unz_s 85 | { 86 | uInt tm_sec; /* seconds after the minute - [0,59] */ 87 | uInt tm_min; /* minutes after the hour - [0,59] */ 88 | uInt tm_hour; /* hours since midnight - [0,23] */ 89 | uInt tm_mday; /* day of the month - [1,31] */ 90 | uInt tm_mon; /* months since January - [0,11] */ 91 | uInt tm_year; /* years - [1980..2044] */ 92 | } tm_unz; 93 | 94 | /* unz_global_info structure contain global data about the ZIPfile 95 | These data comes from the end of central dir */ 96 | typedef struct unz_global_info64_s 97 | { 98 | ZPOS64_T number_entry; /* total number of entries in 99 | the central dir on this disk */ 100 | uLong size_comment; /* size of the global comment of the zipfile */ 101 | } unz_global_info64; 102 | 103 | typedef struct unz_global_info_s 104 | { 105 | uLong number_entry; /* total number of entries in 106 | the central dir on this disk */ 107 | uLong size_comment; /* size of the global comment of the zipfile */ 108 | } unz_global_info; 109 | 110 | /* unz_file_info contain information about a file in the zipfile */ 111 | typedef struct unz_file_info64_s 112 | { 113 | uLong version; /* version made by 2 bytes */ 114 | uLong version_needed; /* version needed to extract 2 bytes */ 115 | uLong flag; /* general purpose bit flag 2 bytes */ 116 | uLong compression_method; /* compression method 2 bytes */ 117 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 118 | uLong crc; /* crc-32 4 bytes */ 119 | ZPOS64_T compressed_size; /* compressed size 8 bytes */ 120 | ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ 121 | uLong size_filename; /* filename length 2 bytes */ 122 | uLong size_file_extra; /* extra field length 2 bytes */ 123 | uLong size_file_comment; /* file comment length 2 bytes */ 124 | 125 | uLong disk_num_start; /* disk number start 2 bytes */ 126 | uLong internal_fa; /* internal file attributes 2 bytes */ 127 | uLong external_fa; /* external file attributes 4 bytes */ 128 | 129 | tm_unz tmu_date; 130 | } unz_file_info64; 131 | 132 | typedef struct unz_file_info_s 133 | { 134 | uLong version; /* version made by 2 bytes */ 135 | uLong version_needed; /* version needed to extract 2 bytes */ 136 | uLong flag; /* general purpose bit flag 2 bytes */ 137 | uLong compression_method; /* compression method 2 bytes */ 138 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 139 | uLong crc; /* crc-32 4 bytes */ 140 | uLong compressed_size; /* compressed size 4 bytes */ 141 | uLong uncompressed_size; /* uncompressed size 4 bytes */ 142 | uLong size_filename; /* filename length 2 bytes */ 143 | uLong size_file_extra; /* extra field length 2 bytes */ 144 | uLong size_file_comment; /* file comment length 2 bytes */ 145 | 146 | uLong disk_num_start; /* disk number start 2 bytes */ 147 | uLong internal_fa; /* internal file attributes 2 bytes */ 148 | uLong external_fa; /* external file attributes 4 bytes */ 149 | 150 | tm_unz tmu_date; 151 | } unz_file_info; 152 | 153 | extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, 154 | const char* fileName2, 155 | int iCaseSensitivity)); 156 | /* 157 | Compare two filename (fileName1,fileName2). 158 | If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) 159 | If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi 160 | or strcasecmp) 161 | If iCaseSenisivity = 0, case sensitivity is defaut of your operating system 162 | (like 1 on Unix, 2 on Windows) 163 | */ 164 | 165 | 166 | extern unzFile ZEXPORT unzOpen OF((const char *path)); 167 | extern unzFile ZEXPORT unzOpen64 OF((const void *path)); 168 | /* 169 | Open a Zip file. path contain the full pathname (by example, 170 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer 171 | "zlib/zlib113.zip". 172 | If the zipfile cannot be opened (file don't exist or in not valid), the 173 | return value is NULL. 174 | Else, the return value is a unzFile Handle, usable with other function 175 | of this unzip package. 176 | the "64" function take a const void* pointer, because the path is just the 177 | value passed to the open64_file_func callback. 178 | Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path 179 | is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* 180 | does not describe the reality 181 | */ 182 | 183 | 184 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, 185 | zlib_filefunc_def* pzlib_filefunc_def)); 186 | /* 187 | Open a Zip file, like unzOpen, but provide a set of file low level API 188 | for read/write the zip file (see ioapi.h) 189 | */ 190 | 191 | extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, 192 | zlib_filefunc64_def* pzlib_filefunc_def)); 193 | /* 194 | Open a Zip file, like unz64Open, but provide a set of file low level API 195 | for read/write the zip file (see ioapi.h) 196 | */ 197 | 198 | extern int ZEXPORT unzClose OF((unzFile file)); 199 | /* 200 | Close a ZipFile opened with unzipOpen. 201 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), 202 | these files MUST be closed with unzipCloseCurrentFile before call unzipClose. 203 | return UNZ_OK if there is no problem. */ 204 | 205 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, 206 | unz_global_info *pglobal_info)); 207 | 208 | extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, 209 | unz_global_info64 *pglobal_info)); 210 | /* 211 | Write info about the ZipFile in the *pglobal_info structure. 212 | No preparation of the structure is needed 213 | return UNZ_OK if there is no problem. */ 214 | 215 | 216 | extern int ZEXPORT unzGetGlobalComment OF((unzFile file, 217 | char *szComment, 218 | uLong uSizeBuf)); 219 | /* 220 | Get the global comment string of the ZipFile, in the szComment buffer. 221 | uSizeBuf is the size of the szComment buffer. 222 | return the number of byte copied or an error code <0 223 | */ 224 | 225 | 226 | /***************************************************************************/ 227 | /* Unzip package allow you browse the directory of the zipfile */ 228 | 229 | extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); 230 | /* 231 | Set the current file of the zipfile to the first file. 232 | return UNZ_OK if there is no problem 233 | */ 234 | 235 | extern int ZEXPORT unzGoToNextFile OF((unzFile file)); 236 | /* 237 | Set the current file of the zipfile to the next file. 238 | return UNZ_OK if there is no problem 239 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 240 | */ 241 | 242 | extern int ZEXPORT unzLocateFile OF((unzFile file, 243 | const char *szFileName, 244 | int iCaseSensitivity)); 245 | /* 246 | Try locate the file szFileName in the zipfile. 247 | For the iCaseSensitivity signification, see unzStringFileNameCompare 248 | 249 | return value : 250 | UNZ_OK if the file is found. It becomes the current file. 251 | UNZ_END_OF_LIST_OF_FILE if the file is not found 252 | */ 253 | 254 | 255 | /* ****************************************** */ 256 | /* Ryan supplied functions */ 257 | /* unz_file_info contain information about a file in the zipfile */ 258 | typedef struct unz_file_pos_s 259 | { 260 | uLong pos_in_zip_directory; /* offset in zip file directory */ 261 | uLong num_of_file; /* # of file */ 262 | } unz_file_pos; 263 | 264 | extern int ZEXPORT unzGetFilePos( 265 | unzFile file, 266 | unz_file_pos* file_pos); 267 | 268 | extern int ZEXPORT unzGoToFilePos( 269 | unzFile file, 270 | unz_file_pos* file_pos); 271 | 272 | typedef struct unz64_file_pos_s 273 | { 274 | ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ 275 | ZPOS64_T num_of_file; /* # of file */ 276 | } unz64_file_pos; 277 | 278 | extern int ZEXPORT unzGetFilePos64( 279 | unzFile file, 280 | unz64_file_pos* file_pos); 281 | 282 | extern int ZEXPORT unzGoToFilePos64( 283 | unzFile file, 284 | const unz64_file_pos* file_pos); 285 | 286 | /* ****************************************** */ 287 | 288 | extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, 289 | unz_file_info64 *pfile_info, 290 | char *szFileName, 291 | uLong fileNameBufferSize, 292 | void *extraField, 293 | uLong extraFieldBufferSize, 294 | char *szComment, 295 | uLong commentBufferSize)); 296 | 297 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, 298 | unz_file_info *pfile_info, 299 | char *szFileName, 300 | uLong fileNameBufferSize, 301 | void *extraField, 302 | uLong extraFieldBufferSize, 303 | char *szComment, 304 | uLong commentBufferSize)); 305 | /* 306 | Get Info about the current file 307 | if pfile_info!=NULL, the *pfile_info structure will contain somes info about 308 | the current file 309 | if szFileName!=NULL, the filemane string will be copied in szFileName 310 | (fileNameBufferSize is the size of the buffer) 311 | if extraField!=NULL, the extra field information will be copied in extraField 312 | (extraFieldBufferSize is the size of the buffer). 313 | This is the Central-header version of the extra field 314 | if szComment!=NULL, the comment string of the file will be copied in szComment 315 | (commentBufferSize is the size of the buffer) 316 | */ 317 | 318 | 319 | /** Addition for GDAL : START */ 320 | 321 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); 322 | 323 | /** Addition for GDAL : END */ 324 | 325 | 326 | /***************************************************************************/ 327 | /* for reading the content of the current zipfile, you can open it, read data 328 | from it, and close it (you can close it before reading all the file) 329 | */ 330 | 331 | extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); 332 | /* 333 | Open for reading data the current file in the zipfile. 334 | If there is no error, the return value is UNZ_OK. 335 | */ 336 | 337 | extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, 338 | const char* password)); 339 | /* 340 | Open for reading data the current file in the zipfile. 341 | password is a crypting password 342 | If there is no error, the return value is UNZ_OK. 343 | */ 344 | 345 | extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, 346 | int* method, 347 | int* level, 348 | int raw)); 349 | /* 350 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 351 | if raw==1 352 | *method will receive method of compression, *level will receive level of 353 | compression 354 | note : you can set level parameter as NULL (if you did not want known level, 355 | but you CANNOT set method parameter as NULL 356 | */ 357 | 358 | extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, 359 | int* method, 360 | int* level, 361 | int raw, 362 | const char* password)); 363 | /* 364 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 365 | if raw==1 366 | *method will receive method of compression, *level will receive level of 367 | compression 368 | note : you can set level parameter as NULL (if you did not want known level, 369 | but you CANNOT set method parameter as NULL 370 | */ 371 | 372 | 373 | extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); 374 | /* 375 | Close the file in zip opened with unzOpenCurrentFile 376 | Return UNZ_CRCERROR if all the file was read but the CRC is not good 377 | */ 378 | 379 | extern int ZEXPORT unzReadCurrentFile OF((unzFile file, 380 | voidp buf, 381 | unsigned len)); 382 | /* 383 | Read bytes from the current file (opened by unzOpenCurrentFile) 384 | buf contain buffer where data must be copied 385 | len the size of buf. 386 | 387 | return the number of byte copied if somes bytes are copied 388 | return 0 if the end of file was reached 389 | return <0 with error code if there is an error 390 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) 391 | */ 392 | 393 | extern z_off_t ZEXPORT unztell OF((unzFile file)); 394 | 395 | extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); 396 | /* 397 | Give the current position in uncompressed data 398 | */ 399 | 400 | extern int ZEXPORT unzeof OF((unzFile file)); 401 | /* 402 | return 1 if the end of file was reached, 0 elsewhere 403 | */ 404 | 405 | extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, 406 | voidp buf, 407 | unsigned len)); 408 | /* 409 | Read extra field from the current file (opened by unzOpenCurrentFile) 410 | This is the local-header version of the extra field (sometimes, there is 411 | more info in the local-header version than in the central-header) 412 | 413 | if buf==NULL, it return the size of the local extra field 414 | 415 | if buf!=NULL, len is the size of the buffer, the extra header is copied in 416 | buf. 417 | the return value is the number of bytes copied in buf, or (if <0) 418 | the error code 419 | */ 420 | 421 | /***************************************************************************/ 422 | 423 | /* Get the current file offset */ 424 | extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); 425 | extern uLong ZEXPORT unzGetOffset (unzFile file); 426 | 427 | /* Set the current file offset */ 428 | extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); 429 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); 430 | 431 | 432 | 433 | #ifdef __cplusplus 434 | } 435 | #endif 436 | 437 | #endif /* _unz64_H */ 438 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Libs/ZipArchive/minizip/zip.h: -------------------------------------------------------------------------------- 1 | /* zip.h -- IO on .zip files using zlib 2 | Version 1.1, February 14h, 2010 3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 | 7 | Modifications for Zip64 support 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 9 | 10 | For more info read MiniZip_info.txt 11 | 12 | --------------------------------------------------------------------------- 13 | 14 | Condition of use and distribution are the same than zlib : 15 | 16 | This software is provided 'as-is', without any express or implied 17 | warranty. In no event will the authors be held liable for any damages 18 | arising from the use of this software. 19 | 20 | Permission is granted to anyone to use this software for any purpose, 21 | including commercial applications, and to alter it and redistribute it 22 | freely, subject to the following restrictions: 23 | 24 | 1. The origin of this software must not be misrepresented; you must not 25 | claim that you wrote the original software. If you use this software 26 | in a product, an acknowledgment in the product documentation would be 27 | appreciated but is not required. 28 | 2. Altered source versions must be plainly marked as such, and must not be 29 | misrepresented as being the original software. 30 | 3. This notice may not be removed or altered from any source distribution. 31 | 32 | --------------------------------------------------------------------------- 33 | 34 | Changes 35 | 36 | See header of zip.h 37 | 38 | */ 39 | 40 | #ifndef _zip12_H 41 | #define _zip12_H 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | //#define HAVE_BZIP2 48 | 49 | #ifndef _ZLIB_H 50 | #include "zlib.h" 51 | #endif 52 | 53 | #ifndef _ZLIBIOAPI_H 54 | #include "ioapi.h" 55 | #endif 56 | 57 | #ifdef HAVE_BZIP2 58 | #include "bzlib.h" 59 | #endif 60 | 61 | #define Z_BZIP2ED 12 62 | 63 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) 64 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 65 | from (void*) without cast */ 66 | typedef struct TagzipFile__ { int unused; } zipFile__; 67 | typedef zipFile__ *zipFile; 68 | #else 69 | typedef voidp zipFile; 70 | #endif 71 | 72 | #define ZIP_OK (0) 73 | #define ZIP_EOF (0) 74 | #define ZIP_ERRNO (Z_ERRNO) 75 | #define ZIP_PARAMERROR (-102) 76 | #define ZIP_BADZIPFILE (-103) 77 | #define ZIP_INTERNALERROR (-104) 78 | 79 | #ifndef DEF_MEM_LEVEL 80 | # if MAX_MEM_LEVEL >= 8 81 | # define DEF_MEM_LEVEL 8 82 | # else 83 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL 84 | # endif 85 | #endif 86 | /* default memLevel */ 87 | 88 | /* tm_zip contain date/time info */ 89 | typedef struct tm_zip_s 90 | { 91 | uInt tm_sec; /* seconds after the minute - [0,59] */ 92 | uInt tm_min; /* minutes after the hour - [0,59] */ 93 | uInt tm_hour; /* hours since midnight - [0,23] */ 94 | uInt tm_mday; /* day of the month - [1,31] */ 95 | uInt tm_mon; /* months since January - [0,11] */ 96 | uInt tm_year; /* years - [1980..2044] */ 97 | } tm_zip; 98 | 99 | typedef struct 100 | { 101 | tm_zip tmz_date; /* date in understandable format */ 102 | uLong dosDate; /* if dos_date == 0, tmu_date is used */ 103 | /* uLong flag; */ /* general purpose bit flag 2 bytes */ 104 | 105 | uLong internal_fa; /* internal file attributes 2 bytes */ 106 | uLong external_fa; /* external file attributes 4 bytes */ 107 | } zip_fileinfo; 108 | 109 | typedef const char* zipcharpc; 110 | 111 | 112 | #define APPEND_STATUS_CREATE (0) 113 | #define APPEND_STATUS_CREATEAFTER (1) 114 | #define APPEND_STATUS_ADDINZIP (2) 115 | 116 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); 117 | extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); 118 | /* 119 | Create a zipfile. 120 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on 121 | an Unix computer "zlib/zlib113.zip". 122 | if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip 123 | will be created at the end of the file. 124 | (useful if the file contain a self extractor code) 125 | if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will 126 | add files in existing zip (be sure you don't add file that doesn't exist) 127 | If the zipfile cannot be opened, the return value is NULL. 128 | Else, the return value is a zipFile Handle, usable with other function 129 | of this zip package. 130 | */ 131 | 132 | /* Note : there is no delete function into a zipfile. 133 | If you want delete file into a zipfile, you must open a zipfile, and create another 134 | Of couse, you can use RAW reading and writing to copy the file you did not want delte 135 | */ 136 | 137 | extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, 138 | int append, 139 | zipcharpc* globalcomment, 140 | zlib_filefunc_def* pzlib_filefunc_def)); 141 | 142 | extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, 143 | int append, 144 | zipcharpc* globalcomment, 145 | zlib_filefunc64_def* pzlib_filefunc_def)); 146 | 147 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, 148 | const char* filename, 149 | const zip_fileinfo* zipfi, 150 | const void* extrafield_local, 151 | uInt size_extrafield_local, 152 | const void* extrafield_global, 153 | uInt size_extrafield_global, 154 | const char* comment, 155 | int method, 156 | int level)); 157 | 158 | extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, 159 | const char* filename, 160 | const zip_fileinfo* zipfi, 161 | const void* extrafield_local, 162 | uInt size_extrafield_local, 163 | const void* extrafield_global, 164 | uInt size_extrafield_global, 165 | const char* comment, 166 | int method, 167 | int level, 168 | int zip64)); 169 | 170 | /* 171 | Open a file in the ZIP for writing. 172 | filename : the filename in zip (if NULL, '-' without quote will be used 173 | *zipfi contain supplemental information 174 | if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local 175 | contains the extrafield data the the local header 176 | if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global 177 | contains the extrafield data the the local header 178 | if comment != NULL, comment contain the comment string 179 | method contain the compression method (0 for store, Z_DEFLATED for deflate) 180 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION) 181 | zip64 is set to 1 if a zip64 extended information block should be added to the local file header. 182 | this MUST be '1' if the uncompressed size is >= 0xffffffff. 183 | 184 | */ 185 | 186 | 187 | extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, 188 | const char* filename, 189 | const zip_fileinfo* zipfi, 190 | const void* extrafield_local, 191 | uInt size_extrafield_local, 192 | const void* extrafield_global, 193 | uInt size_extrafield_global, 194 | const char* comment, 195 | int method, 196 | int level, 197 | int raw)); 198 | 199 | 200 | extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, 201 | const char* filename, 202 | const zip_fileinfo* zipfi, 203 | const void* extrafield_local, 204 | uInt size_extrafield_local, 205 | const void* extrafield_global, 206 | uInt size_extrafield_global, 207 | const char* comment, 208 | int method, 209 | int level, 210 | int raw, 211 | int zip64)); 212 | /* 213 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file 214 | */ 215 | 216 | extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, 217 | const char* filename, 218 | const zip_fileinfo* zipfi, 219 | const void* extrafield_local, 220 | uInt size_extrafield_local, 221 | const void* extrafield_global, 222 | uInt size_extrafield_global, 223 | const char* comment, 224 | int method, 225 | int level, 226 | int raw, 227 | int windowBits, 228 | int memLevel, 229 | int strategy, 230 | const char* password, 231 | uLong crcForCrypting)); 232 | 233 | extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, 234 | const char* filename, 235 | const zip_fileinfo* zipfi, 236 | const void* extrafield_local, 237 | uInt size_extrafield_local, 238 | const void* extrafield_global, 239 | uInt size_extrafield_global, 240 | const char* comment, 241 | int method, 242 | int level, 243 | int raw, 244 | int windowBits, 245 | int memLevel, 246 | int strategy, 247 | const char* password, 248 | uLong crcForCrypting, 249 | int zip64 250 | )); 251 | 252 | /* 253 | Same than zipOpenNewFileInZip2, except 254 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 255 | password : crypting password (NULL for no crypting) 256 | crcForCrypting : crc of file to compress (needed for crypting) 257 | */ 258 | 259 | extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, 260 | const char* filename, 261 | const zip_fileinfo* zipfi, 262 | const void* extrafield_local, 263 | uInt size_extrafield_local, 264 | const void* extrafield_global, 265 | uInt size_extrafield_global, 266 | const char* comment, 267 | int method, 268 | int level, 269 | int raw, 270 | int windowBits, 271 | int memLevel, 272 | int strategy, 273 | const char* password, 274 | uLong crcForCrypting, 275 | uLong versionMadeBy, 276 | uLong flagBase 277 | )); 278 | 279 | 280 | extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, 281 | const char* filename, 282 | const zip_fileinfo* zipfi, 283 | const void* extrafield_local, 284 | uInt size_extrafield_local, 285 | const void* extrafield_global, 286 | uInt size_extrafield_global, 287 | const char* comment, 288 | int method, 289 | int level, 290 | int raw, 291 | int windowBits, 292 | int memLevel, 293 | int strategy, 294 | const char* password, 295 | uLong crcForCrypting, 296 | uLong versionMadeBy, 297 | uLong flagBase, 298 | int zip64 299 | )); 300 | /* 301 | Same than zipOpenNewFileInZip4, except 302 | versionMadeBy : value for Version made by field 303 | flag : value for flag field (compression level info will be added) 304 | */ 305 | 306 | 307 | extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, 308 | const void* buf, 309 | unsigned len)); 310 | /* 311 | Write data in the zipfile 312 | */ 313 | 314 | extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); 315 | /* 316 | Close the current file in the zipfile 317 | */ 318 | 319 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, 320 | uLong uncompressed_size, 321 | uLong crc32)); 322 | 323 | extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, 324 | ZPOS64_T uncompressed_size, 325 | uLong crc32)); 326 | 327 | /* 328 | Close the current file in the zipfile, for file opened with 329 | parameter raw=1 in zipOpenNewFileInZip2 330 | uncompressed_size and crc32 are value for the uncompressed size 331 | */ 332 | 333 | extern int ZEXPORT zipClose OF((zipFile file, 334 | const char* global_comment)); 335 | /* 336 | Close the zipfile 337 | */ 338 | 339 | 340 | extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); 341 | /* 342 | zipRemoveExtraInfoBlock - Added by Mathias Svensson 343 | 344 | Remove extra information block from a extra information data for the local file header or central directory header 345 | 346 | It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode. 347 | 348 | 0x0001 is the signature header for the ZIP64 extra information blocks 349 | 350 | usage. 351 | Remove ZIP64 Extra information from a central director extra field data 352 | zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001); 353 | 354 | Remove ZIP64 Extra information from a Local File Header extra field data 355 | zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); 356 | */ 357 | 358 | #ifdef __cplusplus 359 | } 360 | #endif 361 | 362 | #endif /* _zip64_H */ 363 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/App/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15-5-27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/App/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15-5-27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | 12 | #pragma mark - libs 13 | #import "DCOAboutWindowController.h" 14 | 15 | #import "MainViewController.h" 16 | 17 | 18 | @interface AppDelegate () 19 | 20 | @property (weak) IBOutlet NSWindow *window; 21 | 22 | 23 | 24 | @property (nonatomic, strong) MainViewController *mainVc; 25 | 26 | /** The window controller that handles the about window. */ 27 | @property (nonatomic, strong) DCOAboutWindowController *aboutWindowController; 28 | 29 | @end 30 | 31 | @implementation AppDelegate 32 | 33 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 34 | // Insert code here to initialize your application 35 | 36 | 37 | self.mainVc = [[MainViewController alloc]initWithNibName:@"MainViewController" bundle:nil]; 38 | 39 | [self.window.contentView addSubview:self.mainVc.view]; 40 | 41 | // AutoLayout 42 | NSView *selfView = self.mainVc.view; 43 | selfView.translatesAutoresizingMaskIntoConstraints = NO; 44 | NSDictionary *views = NSDictionaryOfVariableBindings(selfView); 45 | NSArray *consH = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0.0-[selfView]-0.0-|" options:0 metrics:nil views:views]; 46 | [selfView.superview addConstraints:consH]; 47 | 48 | NSArray *consV = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0.0-[selfView]-0.0-|" options:0 metrics:nil views:views]; 49 | [selfView.superview addConstraints:consV]; 50 | 51 | [self.mainVc checkForUpdates:NO]; 52 | } 53 | 54 | - (IBAction)showAboutWindow:(id)sender { 55 | 56 | // https://github.com/DangerCove/DCOAboutWindow 57 | // Set about window values (override defaults) 58 | self.aboutWindowController.appWebsiteURL = [NSURL URLWithString:@"https://github.com/devcxm/iOS-Images-Extractor"]; 59 | 60 | // Show the about window 61 | [self.aboutWindowController showWindow:nil]; 62 | } 63 | 64 | - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { 65 | NSLog(@""); 66 | } 67 | 68 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 69 | // Insert code here to tear down your application 70 | } 71 | 72 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication 73 | { 74 | return YES; 75 | } 76 | 77 | #pragma mark - Lazy Initializers 78 | 79 | - (DCOAboutWindowController *)aboutWindowController { 80 | if(!_aboutWindowController) { 81 | _aboutWindowController = [[DCOAboutWindowController alloc] init]; 82 | } 83 | return _aboutWindowController; 84 | } 85 | 86 | 87 | #pragma mark - Resizable 88 | 89 | - (BOOL)isResizable { 90 | return self.aboutWindowController.window.styleMask & NSResizableWindowMask; 91 | } 92 | 93 | - (void)setResizable:(BOOL)resizable { 94 | 95 | if(self.isResizable) { 96 | self.aboutWindowController.window.styleMask &= ~NSResizableWindowMask; 97 | } else { 98 | self.aboutWindowController.window.styleMask |= NSResizableWindowMask; 99 | } 100 | } 101 | 102 | //- (void)setUseTextView:(BOOL)useTextView { 103 | // 104 | // _useTextView = useTextView; 105 | // self.aboutWindowController.useTextViewForAcknowledgments = useTextView; 106 | //} 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/App/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15-5-27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Controllers/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MainViewController.h 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15-5-27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #ifdef DEBUG 12 | #define XMLog(...) NSLog(__VA_ARGS__); 13 | #else 14 | #define XMLog(...) 15 | #endif 16 | 17 | @interface MainViewController : NSViewController 18 | 19 | - (void)checkForUpdates:(BOOL)manualCheck; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Controllers/MainViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 112 | 113 | 114 | 115 | 116 | 117 | 127 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Models/XMFileItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMFileItem.h 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15/5/27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XMFileItem : NSObject 12 | 13 | 14 | /** 15 | * 文件路径 16 | */ 17 | @property (nonatomic, copy) NSString *filePath; 18 | 19 | /** 20 | * 文件(夹)名称 21 | */ 22 | @property (nonatomic, copy, readonly) NSString *fileName; 23 | 24 | 25 | /** 26 | * 是否是文件夹 27 | */ 28 | @property (nonatomic, assign, readonly) BOOL isDirectory; 29 | 30 | 31 | /** 32 | * 是否存在 33 | */ 34 | @property (nonatomic, assign, readonly) BOOL isFileExists; 35 | 36 | 37 | #pragma mark - 类方法 38 | + (instancetype)xmFileItemWithPath:(NSString*)filePath; 39 | 40 | @end 41 | 42 | 43 | @interface NSString (_ShellPath) 44 | 45 | @property (nonatomic, copy, readonly) NSString *xm_shellPath; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Models/XMFileItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // XMFileItem.m 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15/5/27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import "XMFileItem.h" 10 | 11 | 12 | @interface XMFileItem () 13 | { 14 | BOOL _isDirectory; 15 | BOOL _isFileExists; 16 | } 17 | 18 | @end 19 | 20 | @implementation XMFileItem 21 | 22 | 23 | - (NSString *)description 24 | { 25 | return self.filePath; 26 | } 27 | 28 | - (NSString *)fileName 29 | { 30 | return [self.filePath lastPathComponent]; 31 | } 32 | 33 | - (void)setFilePath:(NSString *)filePath 34 | { 35 | _filePath = filePath; 36 | 37 | _isFileExists = [[NSFileManager defaultManager]fileExistsAtPath:filePath isDirectory:&_isDirectory]; 38 | } 39 | 40 | 41 | - (BOOL)isDirectory 42 | { 43 | return _isDirectory; 44 | } 45 | 46 | 47 | - (BOOL)isFileExists 48 | { 49 | return _isFileExists; 50 | } 51 | 52 | 53 | 54 | + (instancetype)xmFileItemWithPath:(NSString*)filePath 55 | { 56 | XMFileItem *item = [[self alloc]init]; 57 | item.filePath = filePath; 58 | return item; 59 | } 60 | 61 | @end 62 | 63 | 64 | @implementation NSString (_ShellPath) 65 | 66 | - (NSString *)xm_shellPath { 67 | NSString *spaceString =@" "; 68 | NSString *backslash = @"\\"; 69 | NSString *path = [self stringByReplacingOccurrencesOfString:@" " withString:[NSString stringWithFormat:@"%@%@",backslash,spaceString]]; 70 | 71 | return path; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Views/NSAlert+XM.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAlert+XM.h 3 | // iOSImagesExtractor 4 | // 5 | // Created by chixm on 2020/6/2. 6 | // Copyright © 2020 chi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSAlert (XM) 14 | 15 | + (instancetype)xm_alertWithMessageText:(nullable NSString *)message informativeText:(nullable NSString *)informativeText defaultButton:(nullable NSString *)defaultButton; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Views/NSAlert+XM.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAlert+XM.m 3 | // iOSImagesExtractor 4 | // 5 | // Created by chixm on 2020/6/2. 6 | // Copyright © 2020 chi. All rights reserved. 7 | // 8 | 9 | #import "NSAlert+XM.h" 10 | 11 | @implementation NSAlert (XM) 12 | 13 | + (instancetype)xm_alertWithMessageText:(NSString *)message informativeText:(NSString *)informativeText defaultButton:(NSString *)defaultButton { 14 | NSAlert *alert = [[self alloc] init]; 15 | alert.messageText = message ?: @"";; 16 | alert.informativeText = informativeText ?: @""; 17 | if (defaultButton.length > 0) { 18 | [alert addButtonWithTitle:defaultButton]; 19 | } 20 | return alert; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Views/XMDragView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMDragView.h 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15-5-27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @class XMDragView; 13 | 14 | @protocol XMDragViewDelegate 15 | 16 | /** 17 | * 接收到拖拽文件后回调 18 | */ 19 | - (void)dragView:(XMDragView *)dragView didDragItems:(NSArray *)items; 20 | 21 | @end 22 | 23 | @interface XMDragView : NSView 24 | 25 | 26 | @property (nonatomic, assign) id delegate; 27 | 28 | /** 29 | * 设置是否可接受拖文件 30 | */ 31 | @property (nonatomic, assign) BOOL dragEnable; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Classes/Main/Views/XMDragView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XMDragView.m 3 | // iOSImagesExtractor 4 | // 5 | // Created by chi on 15-5-27. 6 | // Copyright (c) 2015年 chi. All rights reserved. 7 | // 8 | 9 | #import "XMDragView.h" 10 | 11 | @implementation XMDragView 12 | { 13 | BOOL _draggingEntered; 14 | } 15 | 16 | - (id)initWithFrame:(NSRect)frame 17 | { 18 | self = [super initWithFrame:frame]; 19 | if(self) { 20 | _dragEnable = NO; 21 | self.dragEnable = YES; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | - (void)drawRect:(NSRect)dirtyRect 28 | { 29 | [super drawRect:dirtyRect]; 30 | 31 | if(_draggingEntered) [[NSColor lightGrayColor] set]; 32 | else [[NSColor windowBackgroundColor] set]; 33 | NSRectFill(dirtyRect); 34 | } 35 | 36 | 37 | - (void)setDragEnable:(BOOL)dragEnable 38 | { 39 | if (_dragEnable != dragEnable) { 40 | [self unregisterDraggedTypes]; 41 | 42 | if (dragEnable) { 43 | [self registerForDraggedTypes:@[NSFilenamesPboardType]]; 44 | } 45 | } 46 | 47 | _dragEnable = dragEnable; 48 | } 49 | 50 | 51 | #pragma mark - 52 | #pragma mark NSDraggingDestination Methods 53 | - (NSDragOperation)draggingEntered:(id)sender 54 | { 55 | _draggingEntered = YES; 56 | [self setNeedsDisplay:YES]; 57 | return NSDragOperationCopy; 58 | } 59 | 60 | - (void)draggingExited:(id)sender 61 | { 62 | _draggingEntered = NO; 63 | [self setNeedsDisplay:YES]; 64 | } 65 | 66 | - (void)draggingEnded:(id)sender 67 | { 68 | _draggingEntered = NO; 69 | [self setNeedsDisplay:YES]; 70 | } 71 | 72 | - (BOOL)performDragOperation:(id)sender 73 | { 74 | NSPasteboard *pasteboard = [sender draggingPasteboard]; 75 | if([[pasteboard types] containsObject:NSFilenamesPboardType]) { 76 | NSArray *items = [pasteboard propertyListForType:NSFilenamesPboardType]; 77 | if([self.delegate respondsToSelector:@selector(dragView:didDragItems:)]) { 78 | [self.delegate dragView:self didDragItems:items]; 79 | } 80 | return YES; 81 | } 82 | 83 | return NO; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg936\cocoartf2513 2 | \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | {\*\expandedcolortbl;;} 5 | \paperw11900\paperh16840\vieww37300\viewh20180\viewkind0 6 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\partightenfactor0 7 | 8 | \f0\b\fs28 \cf0 Engineering: 9 | \f1\b0\fs24 \ 10 | 11 | \fs26 {\field{\*\fldinst{HYPERLINK "https://github.com/devcxm"}}{\fldrslt devcxm}} {\field{\*\fldinst{HYPERLINK "mailto:devcxm@qq.com?subject=About%20iOS-Images-Extractor&body=Hi"}}{\fldrslt devcxm@gmail.com}} 12 | \fs24 \ 13 | \ 14 | 15 | \f0\b\fs28 With special thanks to: 16 | \f1\b0\fs24 \ 17 | 18 | \fs26 {\field{\*\fldinst{HYPERLINK "https://github.com/mattconnolly/ZipArchive"}}{\fldrslt ZipArchive}}(Matt Connolly)\ 19 | {\field{\*\fldinst{HYPERLINK "https://github.com/Marxon13/iOS-Asset-Extractor"}}{\fldrslt iOS-Asset-Extractor}}(Brandon McQuilkin)\ 20 | {\field{\*\fldinst{HYPERLINK "https://github.com/DangerCove/DCOAboutWindow"}}{\fldrslt DCOAboutWindow}}(Danger Cove) \ 21 | {\field{\*\fldinst{HYPERLINK "https://github.com/Timac/QLCARFiles"}}{\fldrslt QLCARFiles}}(Timac) 22 | \fs24 \ 23 | } -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-128.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-128@2x.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-16.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-16@2x.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-256.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-256@2x.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-32.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-32@2x.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-512.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devcxm/iOS-Images-Extractor/6a492dc9a50d62155dc769e5776aace4ce70cb45/iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/AppIcon-512@2x.png -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "AppIcon-16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "AppIcon-16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "AppIcon-32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "AppIcon-32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "AppIcon-128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "AppIcon-128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "AppIcon-256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "AppIcon-256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "AppIcon-512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "AppIcon-512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /iOSImagesExtractor/iOSImagesExtractor/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.devcxm.iOSImagesExtractor 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | iOS Images Extractor 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSApplicationCategoryType 26 | public.app-category.developer-tools 27 | LSMinimumSystemVersion 28 | $(MACOSX_DEPLOYMENT_TARGET) 29 | NSHumanReadableCopyright 30 | Copyright © 2015~2020 chi. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | --------------------------------------------------------------------------------