Java Code Examples for com.dd.plist.NSDictionary#containsKey()
The following examples show how to use
com.dd.plist.NSDictionary#containsKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AirPlayAuth.java From AirPlayAuth with MIT License | 6 votes |
private PairSetupPin1Response doPairSetupPin1(Socket socket) throws Exception { byte[] pairSetupPinRequestData = AuthUtils.createPList(new HashMap<String, String>() {{ put("method", "pin"); put("user", clientId); }}); byte[] pairSetupPin1ResponseBytes = AuthUtils.postData(socket, "/pair-setup-pin", "application/x-apple-binary-plist", pairSetupPinRequestData); NSDictionary pairSetupPin1Response = (NSDictionary) PropertyListParser.parse(pairSetupPin1ResponseBytes); if (pairSetupPin1Response.containsKey("pk") && pairSetupPin1Response.containsKey("salt")) { byte[] pk = ((NSData) pairSetupPin1Response.get("pk")).bytes(); byte[] salt = ((NSData) pairSetupPin1Response.get("salt")).bytes(); return new PairSetupPin1Response(pk, salt); } throw new Exception(); }
Example 2
Source File: PBXProject.java From thym with Eclipse Public License 1.0 | 6 votes |
public void addResourceFile(PBXFile file) throws PBXProjectException { if (file.isPlugin()) { this.addPluginFile(file); } if (!file.isPlugin()) { NSDictionary resGroup = getGroupByName("Resources"); if(resGroup.containsKey("path")){ String path = file.getPath(); int index = path.indexOf("Resources/"); if(index > -1){ file.setPath(path.substring(index+"Resources/".length())); } } } addToPbxBuildFileSection(file); // PBXBuildFile addToBuildPhase("PBXResourcesBuildPhase",file); // PBXResourcesBuildPhase if(!file.isPlugin()){ addToPbxFileReferenceSection(file); // PBXFileReference addToPbxGroup("Resources",file); // PBXGroup } }
Example 3
Source File: PBXProject.java From thym with Eclipse Public License 1.0 | 6 votes |
private NSString searchPathForFile(PBXFile pbxfile) throws PBXProjectException { String filepath = FilenameUtils.getFullPathNoEndSeparator(pbxfile.getPath()); if(filepath.equals(".")){ filepath = ""; }else{ filepath = "/"+filepath; } NSDictionary group = getGroupByName("Plugins"); if(pbxfile.isPlugin() && group.containsKey("path")){ NSString groupPath = (NSString)group.objectForKey("path"); return NSObject.wrap("$(SRCROOT)/" + groupPath.getContent().replace('"', ' ').trim()); } else{ return NSObject.wrap("$(SRCROOT)/"+ getProductName() + filepath ); } }
Example 4
Source File: PBXProject.java From thym with Eclipse Public License 1.0 | 6 votes |
public String getProductName() throws PBXProjectException { HashMap<String, NSObject> hashmap = getObjects().getHashMap(); Collection<NSObject> values = hashmap.values(); for (NSObject nsObject : values) { NSDictionary obj = (NSDictionary) nsObject; NSString isa = (NSString) obj.objectForKey("isa"); if(isa != null && isa.getContent().equals("XCBuildConfiguration")){ NSDictionary buildSettings = (NSDictionary) obj.objectForKey("buildSettings"); if( buildSettings.containsKey("PRODUCT_NAME")){ NSString name = (NSString) buildSettings.get("PRODUCT_NAME"); return name.getContent().replace('"', ' ').trim(); } } } return null; }
Example 5
Source File: AirPlayAuth.java From AirPlayAuth with MIT License | 5 votes |
private PairSetupPin2Response doPairSetupPin2(Socket socket, final byte[] publicClientValueA, final byte[] clientEvidenceMessageM1) throws Exception { byte[] pairSetupPinRequestData = AuthUtils.createPList(new HashMap<String, byte[]>() {{ put("pk", publicClientValueA); put("proof", clientEvidenceMessageM1); }}); byte[] pairSetupPin2ResponseBytes = AuthUtils.postData(socket, "/pair-setup-pin", "application/x-apple-binary-plist", pairSetupPinRequestData); NSDictionary pairSetupPin2Response = (NSDictionary) PropertyListParser.parse(pairSetupPin2ResponseBytes); if (pairSetupPin2Response.containsKey("proof")) { byte[] proof = ((NSData) pairSetupPin2Response.get("proof")).bytes(); return new PairSetupPin2Response(proof); } throw new Exception(); }
Example 6
Source File: AirPlayAuth.java From AirPlayAuth with MIT License | 5 votes |
private PairSetupPin3Response doPairSetupPin3(Socket socket, final byte[] sessionKeyHashK) throws Exception { MessageDigest sha512Digest = MessageDigest.getInstance("SHA-512"); sha512Digest.update("Pair-Setup-AES-Key".getBytes(StandardCharsets.UTF_8)); sha512Digest.update(sessionKeyHashK); byte[] aesKey = Arrays.copyOfRange(sha512Digest.digest(), 0, 16); sha512Digest.update("Pair-Setup-AES-IV".getBytes(StandardCharsets.UTF_8)); sha512Digest.update(sessionKeyHashK); byte[] aesIV = Arrays.copyOfRange(sha512Digest.digest(), 0, 16); int lengthB; int lengthA = lengthB = aesIV.length - 1; for (; lengthB >= 0 && 256 == ++aesIV[lengthA]; lengthA = lengthB += -1) ; Cipher aesGcm128Encrypt = Cipher.getInstance("AES/GCM/NoPadding"); SecretKeySpec secretKey = new SecretKeySpec(aesKey, "AES"); aesGcm128Encrypt.init(Cipher.ENCRYPT_MODE, secretKey, new GCMParameterSpec(128, aesIV)); final byte[] aesGcm128ClientLTPK = aesGcm128Encrypt.doFinal(authKey.getAbyte()); byte[] pairSetupPinRequestData = AuthUtils.createPList(new HashMap<String, byte[]>() {{ put("epk", Arrays.copyOfRange(aesGcm128ClientLTPK, 0, aesGcm128ClientLTPK.length - 16)); put("authTag", Arrays.copyOfRange(aesGcm128ClientLTPK, aesGcm128ClientLTPK.length - 16, aesGcm128ClientLTPK.length)); }}); byte[] pairSetupPin3ResponseBytes = AuthUtils.postData(socket, "/pair-setup-pin", "application/x-apple-binary-plist", pairSetupPinRequestData); NSDictionary pairSetupPin3Response = (NSDictionary) PropertyListParser.parse(pairSetupPin3ResponseBytes); if (pairSetupPin3Response.containsKey("epk") && pairSetupPin3Response.containsKey("authTag")) { byte[] epk = ((NSData) pairSetupPin3Response.get("epk")).bytes(); byte[] authTag = ((NSData) pairSetupPin3Response.get("authTag")).bytes(); return new PairSetupPin3Response(epk, authTag); } throw new Exception(); }
Example 7
Source File: PListsLegacy.java From InflatableDonkey with MIT License | 5 votes |
@Deprecated public static <T extends NSObject> T fetch(NSDictionary dictionary, String key) throws BadDataException { if (dictionary.containsKey(key)) { return cast(key, dictionary); } throw new BadDataException("Missing key: " + key); }
Example 8
Source File: PListsLegacy.java From InflatableDonkey with MIT License | 5 votes |
@Deprecated public static <T extends NSObject> T fetchOrDefault(NSDictionary dictionary, String key, T defaultValue) throws BadDataException { return dictionary.containsKey(key) ? cast(key, dictionary) : defaultValue; }
Example 9
Source File: ColorParser.java From Alite with GNU General Public License v3.0 | 5 votes |
private static float getAlpha(NSDictionary dictionary) { if (dictionary.containsKey("alpha")) { return ((NSNumber) dictionary.get("alpha")).floatValue(); } if (dictionary.containsKey("opacity")) { return ((NSNumber) dictionary.get("opacity")).floatValue(); } return 1.0f; }
Example 10
Source File: ColorParser.java From Alite with GNU General Public License v3.0 | 5 votes |
private static float getValue(NSDictionary dictionary) { if (dictionary.containsKey("value")) { return ((NSNumber) dictionary.get("value")).floatValue(); } if (dictionary.containsKey("brightness")) { return ((NSNumber) dictionary.get("brightness")).floatValue(); } return 1.0f; }
Example 11
Source File: OXPColorScheme.java From Alite with GNU General Public License v3.0 | 5 votes |
public void read(NSDictionary colors) { if (colors.containsKey("default_text_color")) { mainText = ColorParser.getColorFromOXP(colors.get("default_text_color")); } if (colors.containsKey("screen_title_color")) { message = ColorParser.getColorFromOXP(colors.get("screen_title_color")); } if (colors.containsKey("market_cash_color")) { price = ColorParser.getColorFromOXP(colors.get("market_cash_color")); } if (colors.containsKey("systemdata_facts_color")) { } }
Example 12
Source File: PBXProject.java From thym with Eclipse Public License 1.0 | 5 votes |
public void addPluginFile(PBXFile file) throws PBXProjectException{ file.setPlugin(true); NSDictionary pluginsGroup= getGroupByName("Plugins"); if(pluginsGroup.containsKey("path")){ String path = file.getPath(); int index = path.indexOf("Plugins/"); if(index>-1){ file.setPath(path.substring(index+"Plugins/".length())); } } this.addToPbxFileReferenceSection(file); // PBXFileReference this.addToPbxGroup("Plugins",file); // PBXGroup }
Example 13
Source File: PListsLegacy.java From InflatableDonkey with MIT License | 4 votes |
public static Optional<NSObject> optional(NSDictionary dictionary, String key) { return dictionary.containsKey(key) ? Optional.of(dictionary.get(key)) : Optional.empty(); }
Example 14
Source File: NSDictionaries.java From InflatableDonkey with MIT License | 4 votes |
public static Optional<NSObject> get(NSDictionary dictionary, String key) { return dictionary.containsKey(key) ? Optional.of(dictionary.get(key)) : Optional.empty(); }
Example 15
Source File: OXPParser.java From Alite with GNU General Public License v3.0 | 4 votes |
private String readRequiredString(NSDictionary dict, String parameter, String fileName) throws IOException { if (!dict.containsKey(parameter)) { throw new IOException("Invalid manifest file. No " + parameter + " given. (" + fileName + ")"); } return ((NSString) dict.get(parameter)).getContent(); }
Example 16
Source File: OXPParser.java From Alite with GNU General Public License v3.0 | 4 votes |
private String readString(NSDictionary dict, String parameter) { if (!dict.containsKey(parameter)) { return ""; } return ((NSString) dict.get(parameter)).getContent(); }