aboutsummaryrefslogtreecommitdiff
path: root/cordova/node_modules/bplist-parser
diff options
context:
space:
mode:
Diffstat (limited to 'cordova/node_modules/bplist-parser')
-rwxr-xr-xcordova/node_modules/bplist-parser/.npmignore8
-rwxr-xr-xcordova/node_modules/bplist-parser/README.md47
-rwxr-xr-xcordova/node_modules/bplist-parser/bplistParser.js357
-rwxr-xr-xcordova/node_modules/bplist-parser/package.json60
-rwxr-xr-xcordova/node_modules/bplist-parser/test/airplay.bplistbin0 -> 341 bytes
-rwxr-xr-xcordova/node_modules/bplist-parser/test/iTunes-small.bplistbin0 -> 24433 bytes
-rwxr-xr-xcordova/node_modules/bplist-parser/test/int64.bplistbin0 -> 84 bytes
-rwxr-xr-xcordova/node_modules/bplist-parser/test/int64.xml10
-rwxr-xr-xcordova/node_modules/bplist-parser/test/parseTest.js159
-rwxr-xr-xcordova/node_modules/bplist-parser/test/sample1.bplistbin0 -> 605 bytes
-rwxr-xr-xcordova/node_modules/bplist-parser/test/sample2.bplistbin0 -> 384 bytes
-rwxr-xr-xcordova/node_modules/bplist-parser/test/uid.bplistbin0 -> 365 bytes
-rwxr-xr-xcordova/node_modules/bplist-parser/test/utf16.bplistbin0 -> 1273 bytes
-rwxr-xr-xcordova/node_modules/bplist-parser/test/utf16_chinese.plistbin0 -> 2362 bytes
14 files changed, 641 insertions, 0 deletions
diff --git a/cordova/node_modules/bplist-parser/.npmignore b/cordova/node_modules/bplist-parser/.npmignore
new file mode 100755
index 0000000..a9b46ea
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/.npmignore
@@ -0,0 +1,8 @@
+/build/*
+node_modules
+*.node
+*.sh
+*.swp
+.lock*
+npm-debug.log
+.idea
diff --git a/cordova/node_modules/bplist-parser/README.md b/cordova/node_modules/bplist-parser/README.md
new file mode 100755
index 0000000..37e5e1c
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/README.md
@@ -0,0 +1,47 @@
+bplist-parser
+=============
+
+Binary Mac OS X Plist (property list) parser.
+
+## Installation
+
+```bash
+$ npm install bplist-parser
+```
+
+## Quick Examples
+
+```javascript
+var bplist = require('bplist-parser');
+
+bplist.parseFile('myPlist.bplist', function(err, obj) {
+ if (err) throw err;
+
+ console.log(JSON.stringify(obj));
+});
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 Near Infinity Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/cordova/node_modules/bplist-parser/bplistParser.js b/cordova/node_modules/bplist-parser/bplistParser.js
new file mode 100755
index 0000000..f8335bc
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/bplistParser.js
@@ -0,0 +1,357 @@
+'use strict';
+
+// adapted from http://code.google.com/p/plist/source/browse/trunk/src/com/dd/plist/BinaryPropertyListParser.java
+
+var fs = require('fs');
+var bigInt = require("big-integer");
+var debug = false;
+
+exports.maxObjectSize = 100 * 1000 * 1000; // 100Meg
+exports.maxObjectCount = 32768;
+
+// EPOCH = new SimpleDateFormat("yyyy MM dd zzz").parse("2001 01 01 GMT").getTime();
+// ...but that's annoying in a static initializer because it can throw exceptions, ick.
+// So we just hardcode the correct value.
+var EPOCH = 978307200000;
+
+// UID object definition
+var UID = exports.UID = function(id) {
+ this.UID = id;
+}
+
+var parseFile = exports.parseFile = function (fileNameOrBuffer, callback) {
+ function tryParseBuffer(buffer) {
+ var err = null;
+ var result;
+ try {
+ result = parseBuffer(buffer);
+ } catch (ex) {
+ err = ex;
+ }
+ callback(err, result);
+ }
+
+ if (Buffer.isBuffer(fileNameOrBuffer)) {
+ return tryParseBuffer(fileNameOrBuffer);
+ } else {
+ fs.readFile(fileNameOrBuffer, function (err, data) {
+ if (err) { return callback(err); }
+ tryParseBuffer(data);
+ });
+ }
+};
+
+var parseBuffer = exports.parseBuffer = function (buffer) {
+ var result = {};
+
+ // check header
+ var header = buffer.slice(0, 'bplist'.length).toString('utf8');
+ if (header !== 'bplist') {
+ throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
+ }
+
+ // Handle trailer, last 32 bytes of the file
+ var trailer = buffer.slice(buffer.length - 32, buffer.length);
+ // 6 null bytes (index 0 to 5)
+ var offsetSize = trailer.readUInt8(6);
+ if (debug) {
+ console.log("offsetSize: " + offsetSize);
+ }
+ var objectRefSize = trailer.readUInt8(7);
+ if (debug) {
+ console.log("objectRefSize: " + objectRefSize);
+ }
+ var numObjects = readUInt64BE(trailer, 8);
+ if (debug) {
+ console.log("numObjects: " + numObjects);
+ }
+ var topObject = readUInt64BE(trailer, 16);
+ if (debug) {
+ console.log("topObject: " + topObject);
+ }
+ var offsetTableOffset = readUInt64BE(trailer, 24);
+ if (debug) {
+ console.log("offsetTableOffset: " + offsetTableOffset);
+ }
+
+ if (numObjects > exports.maxObjectCount) {
+ throw new Error("maxObjectCount exceeded");
+ }
+
+ // Handle offset table
+ var offsetTable = [];
+
+ for (var i = 0; i < numObjects; i++) {
+ var offsetBytes = buffer.slice(offsetTableOffset + i * offsetSize, offsetTableOffset + (i + 1) * offsetSize);
+ offsetTable[i] = readUInt(offsetBytes, 0);
+ if (debug) {
+ console.log("Offset for Object #" + i + " is " + offsetTable[i] + " [" + offsetTable[i].toString(16) + "]");
+ }
+ }
+
+ // Parses an object inside the currently parsed binary property list.
+ // For the format specification check
+ // <a href="http://www.opensource.apple.com/source/CF/CF-635/CFBinaryPList.c">
+ // Apple's binary property list parser implementation</a>.
+ function parseObject(tableOffset) {
+ var offset = offsetTable[tableOffset];
+ var type = buffer[offset];
+ var objType = (type & 0xF0) >> 4; //First 4 bits
+ var objInfo = (type & 0x0F); //Second 4 bits
+ switch (objType) {
+ case 0x0:
+ return parseSimple();
+ case 0x1:
+ return parseInteger();
+ case 0x8:
+ return parseUID();
+ case 0x2:
+ return parseReal();
+ case 0x3:
+ return parseDate();
+ case 0x4:
+ return parseData();
+ case 0x5: // ASCII
+ return parsePlistString();
+ case 0x6: // UTF-16
+ return parsePlistString(true);
+ case 0xA:
+ return parseArray();
+ case 0xD:
+ return parseDictionary();
+ default:
+ throw new Error("Unhandled type 0x" + objType.toString(16));
+ }
+
+ function parseSimple() {
+ //Simple
+ switch (objInfo) {
+ case 0x0: // null
+ return null;
+ case 0x8: // false
+ return false;
+ case 0x9: // true
+ return true;
+ case 0xF: // filler byte
+ return null;
+ default:
+ throw new Error("Unhandled simple type 0x" + objType.toString(16));
+ }
+ }
+
+ function bufferToHexString(buffer) {
+ var str = '';
+ var i;
+ for (i = 0; i < buffer.length; i++) {
+ if (buffer[i] != 0x00) {
+ break;
+ }
+ }
+ for (; i < buffer.length; i++) {
+ var part = '00' + buffer[i].toString(16);
+ str += part.substr(part.length - 2);
+ }
+ return str;
+ }
+
+ function parseInteger() {
+ var length = Math.pow(2, objInfo);
+ if (length > 4) {
+ var data = buffer.slice(offset + 1, offset + 1 + length);
+ var str = bufferToHexString(data);
+ return bigInt(str, 16);
+ } if (length < exports.maxObjectSize) {
+ return readUInt(buffer.slice(offset + 1, offset + 1 + length));
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseUID() {
+ var length = objInfo + 1;
+ if (length < exports.maxObjectSize) {
+ return new UID(readUInt(buffer.slice(offset + 1, offset + 1 + length)));
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseReal() {
+ var length = Math.pow(2, objInfo);
+ if (length < exports.maxObjectSize) {
+ var realBuffer = buffer.slice(offset + 1, offset + 1 + length);
+ if (length === 4) {
+ return realBuffer.readFloatBE(0);
+ }
+ else if (length === 8) {
+ return realBuffer.readDoubleBE(0);
+ }
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseDate() {
+ if (objInfo != 0x3) {
+ console.error("Unknown date type :" + objInfo + ". Parsing anyway...");
+ }
+ var dateBuffer = buffer.slice(offset + 1, offset + 9);
+ return new Date(EPOCH + (1000 * dateBuffer.readDoubleBE(0)));
+ }
+
+ function parseData() {
+ var dataoffset = 1;
+ var length = objInfo;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0x4: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var intLength = Math.pow(2, intInfo);
+ dataoffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ if (length < exports.maxObjectSize) {
+ return buffer.slice(offset + dataoffset, offset + dataoffset + length);
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parsePlistString (isUtf16) {
+ isUtf16 = isUtf16 || 0;
+ var enc = "utf8";
+ var length = objInfo;
+ var stroffset = 1;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.err("UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var intLength = Math.pow(2, intInfo);
+ var stroffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ // length is String length -> to get byte length multiply by 2, as 1 character takes 2 bytes in UTF-16
+ length *= (isUtf16 + 1);
+ if (length < exports.maxObjectSize) {
+ var plistString = new Buffer(buffer.slice(offset + stroffset, offset + stroffset + length));
+ if (isUtf16) {
+ plistString = swapBytes(plistString);
+ enc = "ucs2";
+ }
+ return plistString.toString(enc);
+ } else {
+ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
+ }
+ }
+
+ function parseArray() {
+ var length = objInfo;
+ var arrayoffset = 1;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0xa: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var intLength = Math.pow(2, intInfo);
+ arrayoffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ if (length * objectRefSize > exports.maxObjectSize) {
+ throw new Error("To little heap space available!");
+ }
+ var array = [];
+ for (var i = 0; i < length; i++) {
+ var objRef = readUInt(buffer.slice(offset + arrayoffset + i * objectRefSize, offset + arrayoffset + (i + 1) * objectRefSize));
+ array[i] = parseObject(objRef);
+ }
+ return array;
+ }
+
+ function parseDictionary() {
+ var length = objInfo;
+ var dictoffset = 1;
+ if (objInfo == 0xF) {
+ var int_type = buffer[offset + 1];
+ var intType = (int_type & 0xF0) / 0x10;
+ if (intType != 0x1) {
+ console.error("0xD: UNEXPECTED LENGTH-INT TYPE! " + intType);
+ }
+ var intInfo = int_type & 0x0F;
+ var intLength = Math.pow(2, intInfo);
+ dictoffset = 2 + intLength;
+ if (intLength < 3) {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ } else {
+ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
+ }
+ }
+ if (length * 2 * objectRefSize > exports.maxObjectSize) {
+ throw new Error("To little heap space available!");
+ }
+ if (debug) {
+ console.log("Parsing dictionary #" + tableOffset);
+ }
+ var dict = {};
+ for (var i = 0; i < length; i++) {
+ var keyRef = readUInt(buffer.slice(offset + dictoffset + i * objectRefSize, offset + dictoffset + (i + 1) * objectRefSize));
+ var valRef = readUInt(buffer.slice(offset + dictoffset + (length * objectRefSize) + i * objectRefSize, offset + dictoffset + (length * objectRefSize) + (i + 1) * objectRefSize));
+ var key = parseObject(keyRef);
+ var val = parseObject(valRef);
+ if (debug) {
+ console.log(" DICT #" + tableOffset + ": Mapped " + key + " to " + val);
+ }
+ dict[key] = val;
+ }
+ return dict;
+ }
+ }
+
+ return [ parseObject(topObject) ];
+};
+
+function readUInt(buffer, start) {
+ start = start || 0;
+
+ var l = 0;
+ for (var i = start; i < buffer.length; i++) {
+ l <<= 8;
+ l |= buffer[i] & 0xFF;
+ }
+ return l;
+}
+
+// we're just going to toss the high order bits because javascript doesn't have 64-bit ints
+function readUInt64BE(buffer, start) {
+ var data = buffer.slice(start, start + 8);
+ return data.readUInt32BE(4, 8);
+}
+
+function swapBytes(buffer) {
+ var len = buffer.length;
+ for (var i = 0; i < len; i += 2) {
+ var a = buffer[i];
+ buffer[i] = buffer[i+1];
+ buffer[i+1] = a;
+ }
+ return buffer;
+}
diff --git a/cordova/node_modules/bplist-parser/package.json b/cordova/node_modules/bplist-parser/package.json
new file mode 100755
index 0000000..655f43e
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/package.json
@@ -0,0 +1,60 @@
+{
+ "_from": "bplist-parser@^0.1.0",
+ "_id": "[email protected]",
+ "_inBundle": true,
+ "_integrity": "sha1-1g1dzCDLptx+HymbNdPh+V2vuuY=",
+ "_location": "/cordova-ios/bplist-parser",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "bplist-parser@^0.1.0",
+ "name": "bplist-parser",
+ "escapedName": "bplist-parser",
+ "rawSpec": "^0.1.0",
+ "saveSpec": null,
+ "fetchSpec": "^0.1.0"
+ },
+ "_requiredBy": [
+ "/cordova-ios",
+ "/cordova-ios/cordova-common",
+ "/cordova-ios/simple-plist"
+ ],
+ "_resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.1.tgz",
+ "_shasum": "d60d5dcc20cba6dc7e1f299b35d3e1f95dafbae6",
+ "_spec": "bplist-parser@^0.1.0",
+ "_where": "/Users/brodybits/Documents/cordova/cordova-ios/node_modules/cordova-common",
+ "author": {
+ "name": "Joe Ferner",
+ "email": "[email protected]"
+ },
+ "bugs": {
+ "url": "https://github.com/nearinfinity/node-bplist-parser/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "big-integer": "^1.6.7"
+ },
+ "deprecated": false,
+ "description": "Binary plist parser.",
+ "devDependencies": {
+ "nodeunit": "~0.9.1"
+ },
+ "homepage": "https://github.com/nearinfinity/node-bplist-parser#readme",
+ "keywords": [
+ "bplist",
+ "plist",
+ "parser"
+ ],
+ "license": "MIT",
+ "main": "bplistParser.js",
+ "name": "bplist-parser",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nearinfinity/node-bplist-parser.git"
+ },
+ "scripts": {
+ "test": "./node_modules/nodeunit/bin/nodeunit test"
+ },
+ "version": "0.1.1"
+}
diff --git a/cordova/node_modules/bplist-parser/test/airplay.bplist b/cordova/node_modules/bplist-parser/test/airplay.bplist
new file mode 100755
index 0000000..931adea
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/airplay.bplist
Binary files differ
diff --git a/cordova/node_modules/bplist-parser/test/iTunes-small.bplist b/cordova/node_modules/bplist-parser/test/iTunes-small.bplist
new file mode 100755
index 0000000..b7edb14
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/iTunes-small.bplist
Binary files differ
diff --git a/cordova/node_modules/bplist-parser/test/int64.bplist b/cordova/node_modules/bplist-parser/test/int64.bplist
new file mode 100755
index 0000000..6da9c04
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/int64.bplist
Binary files differ
diff --git a/cordova/node_modules/bplist-parser/test/int64.xml b/cordova/node_modules/bplist-parser/test/int64.xml
new file mode 100755
index 0000000..cc6cb03
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/int64.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>zero</key>
+ <integer>0</integer>
+ <key>int64item</key>
+ <integer>12345678901234567890</integer>
+ </dict>
+</plist>
diff --git a/cordova/node_modules/bplist-parser/test/parseTest.js b/cordova/node_modules/bplist-parser/test/parseTest.js
new file mode 100755
index 0000000..67e7bfa
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/parseTest.js
@@ -0,0 +1,159 @@
+'use strict';
+
+// tests are adapted from https://github.com/TooTallNate/node-plist
+
+var path = require('path');
+var nodeunit = require('nodeunit');
+var bplist = require('../');
+
+module.exports = {
+ 'iTunes Small': function (test) {
+ var file = path.join(__dirname, "iTunes-small.bplist");
+ var startTime1 = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime1) + 'ms');
+ var dict = dicts[0];
+ test.equal(dict['Application Version'], "9.0.3");
+ test.equal(dict['Library Persistent ID'], "6F81D37F95101437");
+ test.done();
+ });
+ },
+
+ 'sample1': function (test) {
+ var file = path.join(__dirname, "sample1.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+ var dict = dicts[0];
+ test.equal(dict['CFBundleIdentifier'], 'com.apple.dictionary.MySample');
+ test.done();
+ });
+ },
+
+ 'sample2': function (test) {
+ var file = path.join(__dirname, "sample2.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+ var dict = dicts[0];
+ test.equal(dict['PopupMenu'][2]['Key'], "\n #import <Cocoa/Cocoa.h>\n\n#import <MacRuby/MacRuby.h>\n\nint main(int argc, char *argv[])\n{\n return macruby_main(\"rb_main.rb\", argc, argv);\n}\n");
+ test.done();
+ });
+ },
+
+ 'airplay': function (test) {
+ var file = path.join(__dirname, "airplay.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.equal(dict['duration'], 5555.0495000000001);
+ test.equal(dict['position'], 4.6269989039999997);
+ test.done();
+ });
+ },
+
+ 'utf16': function (test) {
+ var file = path.join(__dirname, "utf16.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.equal(dict['CFBundleName'], 'sellStuff');
+ test.equal(dict['CFBundleShortVersionString'], '2.6.1');
+ test.equal(dict['NSHumanReadableCopyright'], '©2008-2012, sellStuff, Inc.');
+ test.done();
+ });
+ },
+
+ 'utf16chinese': function (test) {
+ var file = path.join(__dirname, "utf16_chinese.plist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.equal(dict['CFBundleName'], '天翼阅读');
+ test.equal(dict['CFBundleDisplayName'], '天翼阅读');
+ test.done();
+ });
+ },
+
+
+
+ 'uid': function (test) {
+ var file = path.join(__dirname, "uid.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+
+ var dict = dicts[0];
+ test.deepEqual(dict['$objects'][1]['NS.keys'], [{UID:2}, {UID:3}, {UID:4}]);
+ test.deepEqual(dict['$objects'][1]['NS.objects'], [{UID: 5}, {UID:6}, {UID:7}]);
+ test.deepEqual(dict['$top']['root'], {UID:1});
+ test.done();
+ });
+ },
+
+ 'int64': function (test) {
+ var file = path.join(__dirname, "int64.bplist");
+ var startTime = new Date();
+
+ bplist.parseFile(file, function (err, dicts) {
+ if (err) {
+ throw err;
+ }
+
+ var endTime = new Date();
+ console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
+ var dict = dicts[0];
+ test.equal(dict['zero'], '0');
+ test.equal(dict['int64item'], '12345678901234567890');
+ test.done();
+ });
+ }
+};
diff --git a/cordova/node_modules/bplist-parser/test/sample1.bplist b/cordova/node_modules/bplist-parser/test/sample1.bplist
new file mode 100755
index 0000000..5b808ff
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/sample1.bplist
Binary files differ
diff --git a/cordova/node_modules/bplist-parser/test/sample2.bplist b/cordova/node_modules/bplist-parser/test/sample2.bplist
new file mode 100755
index 0000000..fc42979
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/sample2.bplist
Binary files differ
diff --git a/cordova/node_modules/bplist-parser/test/uid.bplist b/cordova/node_modules/bplist-parser/test/uid.bplist
new file mode 100755
index 0000000..59f341e
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/uid.bplist
Binary files differ
diff --git a/cordova/node_modules/bplist-parser/test/utf16.bplist b/cordova/node_modules/bplist-parser/test/utf16.bplist
new file mode 100755
index 0000000..ba4bcfa
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/utf16.bplist
Binary files differ
diff --git a/cordova/node_modules/bplist-parser/test/utf16_chinese.plist b/cordova/node_modules/bplist-parser/test/utf16_chinese.plist
new file mode 100755
index 0000000..ba1e2d7
--- /dev/null
+++ b/cordova/node_modules/bplist-parser/test/utf16_chinese.plist
Binary files differ