change travis to xcode9.2
将 app 资源打包加密进行管理。
Package resources to a single file, and access them via file name as key.
TextFormater 可通过CocoaPods安装:
ResourcePackage is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ResourcePackage"
git clone https://github.com/1Fr3dG/ResourcePackage.git cd ResourcePackage cd packager swift build -c release .build/release/packager
可使用该打包工具将资源目录打包为单个文件供 app 使用。
This tool designed to package a resource folder to a single file, for used by app.
Note: This tool support only gzip as compress algorithm, you can build your own tool to support more.
let _compress: SimpleEncrypter = EncrypterCompress(with: "gzip") let _encrypt: SimpleEncrypter = EncrypterXor(with: "password12345") let _pkgfile: String = "filename" let pkg = ResourcePackage(with: _pkgfile, encrypter: _encrypt, compressor: _compress)
let pkgReader = ResourcePackageReader( withCache: false, useTwoStepLocating: false, autoDeviceCustomization: false, useKeyPrefix: false) pkgReader.packages["pkg1"] = pkg let themePkgReader = ResourcePackageReader(withTheme theme: String, FromThemePackages respkg: ["themePkg1" : themePkg], withBackwardTheme backward: "default")
let stringValue = String(data:pkgReader[keyofString], encoding: .utf8) let imageValue = UIImage(data:pkgReader[keyofImage])
resource package priority is reverse order of package key
pkgReader[key] will looking for resource with following order:
pkgReader[key]
for two step locating, sufix will NOT applied for 2nd search, but all packages will be included
uibutton.loadTheme(from: themePkgReader, key: "button1") uilable.setText(from: themePkgReader, key: "labeltext") uiimageview.setImage(from: themePkgReader, key: "image1")
pkgReader.playSound(key: "asound", withVibrate: false) pkgReader.playMusic("bgmusic.mp3", loops: 1, volume: 0.8)
Alfred Gao, alfredg@alfredg.cn
ResourcePackage is available under the MIT license. See the LICENSE file for more info.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
ResourcePackage
将 app 资源打包加密进行管理。
Package resources to a single file, and access them via file name as key.
Requirements
Installation
TextFormater 可通过CocoaPods安装:
ResourcePackage is available through CocoaPods. To install it, simply add the following line to your Podfile:
Structure
Usage
Packager - 打包工具
可使用该打包工具将资源目录打包为单个文件供 app 使用。
This tool designed to package a resource folder to a single file, for used by app.
Note: This tool support only gzip as compress algorithm, you can build your own tool to support more.
Open a package
Open packages with package reader
Read data
Resource Priority
resource package priority is reverse order of package key
pkgReader[key]
will looking for resource with following order:for two step locating, sufix will NOT applied for 2nd search, but all packages will be included
Use UIExtensions
Sounds
Author
Alfred Gao, alfredg@alfredg.cn
License
ResourcePackage is available under the MIT license. See the LICENSE file for more info.