public void AddPersonalVPN() { PlistElement plistElement = (PlistElement) new PlistElementArray(); this.GetOrCreateEntitlementDoc().root[VPNEntitlements.Key] = plistElement; (plistElement as PlistElementArray).values.Add((PlistElement) new PlistElementString(VPNEntitlements.Value)); this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.PersonalVPN, this.m_EntitlementFilePath, false); }
public void AddSignInWithApple() { PlistElement plistElement = (PlistElement) new PlistElementArray(); this.GetOrCreateEntitlementDoc().root[SignInWithAppleEntitlements.Key] = plistElement; (plistElement as PlistElementArray).values.Add((PlistElement) new PlistElementString(SignInWithAppleEntitlements.Value)); this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.SignInWithApple, this.m_EntitlementFilePath, false); }
private static XElement WriteElement(PlistElement el) { if (el is PlistElementBoolean) { return(new XElement((XName)(!(el as PlistElementBoolean).value ? "false" : "true"))); } if (el is PlistElementInteger) { return(new XElement((XName)"integer", (object)(el as PlistElementInteger).value.ToString())); } if (el is PlistElementString) { return(new XElement((XName)"string", (object)(el as PlistElementString).value)); } if (el is PlistElementReal) { return(new XElement((XName)"real", (object)(el as PlistElementReal).value.ToString())); } if (el is PlistElementDate) { return(new XElement((XName)"date", (object)(el as PlistElementDate).value.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"))); } if (el is PlistElementDict) { PlistElementDict plistElementDict = el as PlistElementDict; XElement xelement1 = new XElement((XName)"dict"); foreach (KeyValuePair <string, PlistElement> keyValuePair in (IEnumerable <KeyValuePair <string, PlistElement> >)plistElementDict.values) { XElement xelement2 = new XElement((XName)"key", (object)keyValuePair.Key); XElement xelement3 = PlistDocument.WriteElement(keyValuePair.Value); if (xelement3 != null) { xelement1.Add((object)xelement2); xelement1.Add((object)xelement3); } } return(xelement1); } if (!(el is PlistElementArray)) { return((XElement)null); } PlistElementArray plistElementArray = el as PlistElementArray; XElement xelement4 = new XElement((XName)"array"); foreach (PlistElement el1 in plistElementArray.values) { XElement xelement1 = PlistDocument.WriteElement(el1); if (xelement1 != null) { xelement4.Add((object)xelement1); } } return(xelement4); }
public void AddiCloud(bool enableKeyValueStorage, bool enableiCloudDocument, bool enablecloudKit, bool addDefaultContainers, string[] customContainers) { PlistDocument createEntitlementDoc = this.GetOrCreateEntitlementDoc(); PlistElement plistElement1 = (PlistElement) new PlistElementArray(); createEntitlementDoc.root[ICloudEntitlements.ContainerIdKey] = plistElement1; PlistElementArray plistElementArray1 = plistElement1 as PlistElementArray; PlistElementArray plistElementArray2 = (PlistElementArray)null; if (enableiCloudDocument || enablecloudKit) { PlistElement plistElement2 = (PlistElement) new PlistElementArray(); createEntitlementDoc.root[ICloudEntitlements.ServicesKey] = plistElement2; plistElementArray2 = plistElement2 as PlistElementArray; } if (enableiCloudDocument) { plistElementArray1.values.Add((PlistElement) new PlistElementString(ICloudEntitlements.ContainerIdValue)); plistElementArray2.values.Add((PlistElement) new PlistElementString(ICloudEntitlements.ServicesDocValue)); PlistElement plistElement2 = (PlistElement) new PlistElementArray(); createEntitlementDoc.root[ICloudEntitlements.UbiquityContainerIdKey] = plistElement2; PlistElementArray plistElementArray3 = plistElement2 as PlistElementArray; if (addDefaultContainers) { plistElementArray3.values.Add((PlistElement) new PlistElementString(ICloudEntitlements.UbiquityContainerIdValue)); } if (customContainers != null && customContainers.Length > 0) { for (int index = 0; index < customContainers.Length; ++index) { plistElementArray3.values.Add((PlistElement) new PlistElementString(customContainers[index])); } } } if (enablecloudKit) { if (addDefaultContainers && !enableiCloudDocument) { plistElementArray1.values.Add((PlistElement) new PlistElementString(ICloudEntitlements.ContainerIdValue)); } if (customContainers != null && customContainers.Length > 0) { for (int index = 0; index < customContainers.Length; ++index) { plistElementArray1.values.Add((PlistElement) new PlistElementString(customContainers[index])); } } plistElementArray2.values.Add((PlistElement) new PlistElementString(ICloudEntitlements.ServicesKitValue)); } if (enableKeyValueStorage) { createEntitlementDoc.root[ICloudEntitlements.KeyValueStoreKey] = (PlistElement) new PlistElementString(ICloudEntitlements.KeyValueStoreValue); } this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.iCloud, this.m_EntitlementFilePath, enablecloudKit); }
public void AddAppGroups(string[] groups) { PlistElement plistElement = (PlistElement) new PlistElementArray(); this.GetOrCreateEntitlementDoc().root[AppGroupsEntitlements.Key] = plistElement; PlistElementArray plistElementArray = plistElement as PlistElementArray; for (int index = 0; index < groups.Length; ++index) { plistElementArray.values.Add((PlistElement) new PlistElementString(groups[index])); } this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.AppGroups, this.m_EntitlementFilePath, false); }
public void AddGameCenter() { PlistElement plistElement1 = this.GetOrCreateInfoDoc().root[GameCenterInfo.Key]; if (plistElement1 == null) { PlistElement plistElement2 = (PlistElement) new PlistElementArray(); this.GetOrCreateInfoDoc().root[GameCenterInfo.Key] = plistElement2; plistElement1 = plistElement2; } (plistElement1 as PlistElementArray).values.Add((PlistElement) new PlistElementString(GameCenterInfo.Value)); this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.GameCenter, (string)null, false); }
public void AddHealthKit() { PlistElement plistElement1 = this.GetOrCreateInfoDoc().root[HealthInfo.Key]; if (plistElement1 == null) { PlistElement plistElement2 = (PlistElement) new PlistElementArray(); this.GetOrCreateInfoDoc().root[HealthInfo.Key] = plistElement2; plistElement1 = plistElement2; } this.GetOrCreateStringElementInArray(plistElement1 as PlistElementArray, HealthInfo.Value); this.GetOrCreateEntitlementDoc().root[HealthKitEntitlements.Key] = (PlistElement) new PlistElementBoolean(true); this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.HealthKit, this.m_EntitlementFilePath, false); }
private static XElement WriteElement(PlistElement el) { if (el is PlistElementBoolean) { var realEl = el as PlistElementBoolean; return(new XElement(realEl.value ? "true" : "false")); } if (el is PlistElementInteger) { var realEl = el as PlistElementInteger; return(new XElement("integer", realEl.value.ToString())); } if (el is PlistElementString) { var realEl = el as PlistElementString; return(new XElement("string", realEl.value)); } if (el is PlistElementDict) { var realEl = el as PlistElementDict; var dictXml = new XElement("dict"); foreach (var kv in realEl.values) { var keyXml = new XElement("key", kv.Key); var valueXml = WriteElement(kv.Value); if (valueXml != null) { dictXml.Add(keyXml); dictXml.Add(valueXml); } } return(dictXml); } if (el is PlistElementArray) { var realEl = el as PlistElementArray; var arrayXml = new XElement("array"); foreach (var v in realEl.values) { var elXml = WriteElement(v); if (elXml != null) { arrayXml.Add(elXml); } } return(arrayXml); } return(null); }
public void AddBackgroundModes(BackgroundModesOptions options) { PlistElement plistElement1 = this.GetOrCreateInfoDoc().root[BackgroundInfo.Key]; if (plistElement1 == null) { PlistElement plistElement2 = (PlistElement) new PlistElementArray(); this.GetOrCreateInfoDoc().root[BackgroundInfo.Key] = plistElement2; plistElement1 = plistElement2; } PlistElementArray root = plistElement1 as PlistElementArray; if ((options & BackgroundModesOptions.ActsAsABluetoothLEAccessory) == BackgroundModesOptions.ActsAsABluetoothLEAccessory) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModeActsBluetoothValue); } if ((options & BackgroundModesOptions.AudioAirplayPiP) == BackgroundModesOptions.AudioAirplayPiP) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModeAudioValue); } if ((options & BackgroundModesOptions.BackgroundFetch) == BackgroundModesOptions.BackgroundFetch) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModeFetchValue); } if ((options & BackgroundModesOptions.ExternalAccessoryCommunication) == BackgroundModesOptions.ExternalAccessoryCommunication) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModeExtAccessoryValue); } if ((options & BackgroundModesOptions.LocationUpdates) == BackgroundModesOptions.LocationUpdates) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModeLocationValue); } if ((options & BackgroundModesOptions.NewsstandDownloads) == BackgroundModesOptions.NewsstandDownloads) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModeNewsstandValue); } if ((options & BackgroundModesOptions.RemoteNotifications) == BackgroundModesOptions.RemoteNotifications) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModePushValue); } if ((options & BackgroundModesOptions.VoiceOverIP) == BackgroundModesOptions.VoiceOverIP) { this.GetOrCreateStringElementInArray(root, BackgroundInfo.ModeVOIPValue); } this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.BackgroundModes, (string)null, false); }
public void ReadFromString(string text) { XDocument xdocument = PlistDocument.ParseXmlNoDtd(text); this.version = (string)xdocument.Root.Attribute((XName)"version"); PlistElement plistElement = PlistDocument.ReadElement(System.Xml.XPath.Extensions.XPathSelectElement((XNode)xdocument, "plist/dict")); if (plistElement == null) { throw new Exception("Error parsing plist file"); } this.root = plistElement as PlistElementDict; if (this.root == null) { throw new Exception("Malformed plist file"); } this.documentType = xdocument.DocumentType; }
public void AddKeychainSharing(string[] accessGroups) { PlistElement plistElement = (PlistElement) new PlistElementArray(); this.GetOrCreateEntitlementDoc().root[KeyChainEntitlements.Key] = plistElement; PlistElementArray plistElementArray = plistElement as PlistElementArray; if (accessGroups != null) { for (int index = 0; index < accessGroups.Length; ++index) { plistElementArray.values.Add((PlistElement) new PlistElementString(accessGroups[index])); } } else { plistElementArray.values.Add((PlistElement) new PlistElementString(KeyChainEntitlements.DefaultValue)); } this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.KeychainSharing, this.m_EntitlementFilePath, false); }
public void AddWallet(string[] passSubset) { PlistElement plistElement = (PlistElement) new PlistElementArray(); this.GetOrCreateEntitlementDoc().root[WalletEntitlements.Key] = plistElement; PlistElementArray plistElementArray = plistElement as PlistElementArray; if ((passSubset == null || passSubset.Length == 0) && plistElementArray != null) { plistElementArray.values.Add((PlistElement) new PlistElementString(WalletEntitlements.BaseValue + WalletEntitlements.BaseValue)); } else { for (int index = 0; index < passSubset.Length; ++index) { if (plistElementArray != null) { plistElementArray.values.Add((PlistElement) new PlistElementString(WalletEntitlements.BaseValue + passSubset[index])); } } } this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.Wallet, this.m_EntitlementFilePath, false); }
private static XElement WriteElement(PlistElement el) { if (el is PlistElementBoolean) { var realEl = el as PlistElementBoolean; return new XElement(realEl.value ? "true" : "false"); } if (el is PlistElementInteger) { var realEl = el as PlistElementInteger; return new XElement("integer", realEl.value.ToString()); } if (el is PlistElementString) { var realEl = el as PlistElementString; return new XElement("string", realEl.value); } if (el is PlistElementDict) { var realEl = el as PlistElementDict; var dictXml = new XElement("dict"); foreach (var kv in realEl.values) { var keyXml = new XElement("key", kv.Key); var valueXml = WriteElement(kv.Value); if (valueXml != null) { dictXml.Add(keyXml); dictXml.Add(valueXml); } } return dictXml; } if (el is PlistElementArray) { var realEl = el as PlistElementArray; var arrayXml = new XElement("array"); foreach (var v in realEl.values) { var elXml = WriteElement(v); if (elXml != null) arrayXml.Add(elXml); } return arrayXml; } return null; }
private static PlistElement ReadElement(XElement xml) { string localName = xml.Name.LocalName; if (localName != null) { Dictionary <string, int> types = new Dictionary <string, int>(8) { { "dict", 0 }, { "array", 1 }, { "string", 2 }, { "integer", 3 }, { "real", 4 }, { "date", 5 }, { "true", 6 }, { "false", 7 } }; int num = 0; if (types.TryGetValue(localName, out num)) { switch (num) { case 0: List <XElement> list1 = Enumerable.ToList <XElement>(xml.Elements()); PlistElementDict plistElementDict = new PlistElementDict(); if (list1.Count % 2 == 1) { throw new Exception("Malformed plist file"); } for (int index1 = 0; index1 < list1.Count - 1; ++index1) { if (list1[index1].Name != (XName)"key") { throw new Exception("Malformed plist file. Found '" + (object)list1[index1].Name + "' where 'key' was expected."); } string index2 = PlistDocument.GetText(list1[index1]).Trim(); PlistElement plistElement = PlistDocument.ReadElement(list1[index1 + 1]); if (plistElement != null) { ++index1; plistElementDict[index2] = plistElement; } } return((PlistElement)plistElementDict); case 1: List <XElement> list2 = Enumerable.ToList <XElement>(xml.Elements()); PlistElementArray plistElementArray = new PlistElementArray(); foreach (XElement xml1 in list2) { PlistElement plistElement = PlistDocument.ReadElement(xml1); if (plistElement != null) { plistElementArray.values.Add(plistElement); } } return((PlistElement)plistElementArray); case 2: return((PlistElement) new PlistElementString(PlistDocument.GetText(xml))); case 3: int result1; if (int.TryParse(PlistDocument.GetText(xml), out result1)) { return((PlistElement) new PlistElementInteger(result1)); } return((PlistElement)null); case 4: float result2; if (float.TryParse(PlistDocument.GetText(xml), out result2)) { return((PlistElement) new PlistElementReal(result2)); } return((PlistElement)null); case 5: DateTime result3; if (DateTime.TryParse(PlistDocument.GetText(xml), out result3)) { return((PlistElement) new PlistElementDate(result3.ToUniversalTime())); } return((PlistElement)null); case 6: return((PlistElement) new PlistElementBoolean(true)); case 7: return((PlistElement) new PlistElementBoolean(false)); } } } return(null); }
private static PlistElement ReadElement(XElement xml) { string localName = xml.Name.LocalName; // ISSUE: reference to a compiler-generated method uint stringHash = PrivateImplementationDetails.ComputeStringHash(localName); if (stringHash <= 1303515621U) { if (stringHash <= 398550328U) { if ((int)stringHash != 184981848) { if ((int)stringHash == 398550328 && localName == "string") { return((PlistElement) new PlistElementString(PlistDocument.GetText(xml))); } } else if (localName == "false") { return((PlistElement) new PlistElementBoolean(false)); } } else if ((int)stringHash != 1278716217) { if ((int)stringHash == 1303515621 && localName == "true") { return((PlistElement) new PlistElementBoolean(true)); } } else if (localName == "dict") { List <XElement> list = Enumerable.ToList <XElement>(xml.Elements()); PlistElementDict plistElementDict = new PlistElementDict(); if (list.Count % 2 == 1) { throw new Exception("Malformed plist file"); } for (int index1 = 0; index1 < list.Count - 1; ++index1) { if (list[index1].Name != (XName)"key") { throw new Exception("Malformed plist file. Found '" + (object)list[index1].Name + "' where 'key' was expected."); } string index2 = PlistDocument.GetText(list[index1]).Trim(); PlistElement plistElement = PlistDocument.ReadElement(list[index1 + 1]); if (plistElement != null) { ++index1; plistElementDict[index2] = plistElement; } } return((PlistElement)plistElementDict); } } else if (stringHash <= 3218261061U) { if ((int)stringHash != -1973899994) { int result; if ((int)stringHash == -1076706235 && localName == "integer" && int.TryParse(PlistDocument.GetText(xml), out result)) { return((PlistElement) new PlistElementInteger(result)); } } else if (localName == "array") { List <XElement> list = Enumerable.ToList <XElement>(xml.Elements()); PlistElementArray plistElementArray = new PlistElementArray(); foreach (XElement xml1 in list) { PlistElement plistElement = PlistDocument.ReadElement(xml1); if (plistElement != null) { plistElementArray.values.Add(plistElement); } } return((PlistElement)plistElementArray); } } else if ((int)stringHash != -730669991) { float result; if ((int)stringHash == -689983395 && localName == "real" && float.TryParse(PlistDocument.GetText(xml), out result)) { return((PlistElement) new PlistElementReal(result)); } } else { DateTime result; if (localName == "date" && DateTime.TryParse(PlistDocument.GetText(xml), out result)) { return((PlistElement) new PlistElementDate(result.ToUniversalTime())); } } return((PlistElement)null); }
public void AddMaps(MapsOptions options) { PlistElement plistElement1 = this.GetOrCreateInfoDoc().root[MapsInfo.BundleKey]; if (plistElement1 == null) { PlistElement plistElement2 = (PlistElement) new PlistElementArray(); this.GetOrCreateInfoDoc().root[MapsInfo.BundleKey] = plistElement2; plistElement1 = plistElement2; } PlistElementArray root1 = plistElement1 as PlistElementArray; root1.values.Add((PlistElement) new PlistElementDict()); PlistElementDict dictElementInArray = this.GetOrCreateUniqueDictElementInArray(root1); dictElementInArray[MapsInfo.BundleNameKey] = (PlistElement) new PlistElementString(MapsInfo.BundleNameValue); PlistElement plistElement3 = dictElementInArray[MapsInfo.BundleTypeKey]; if (plistElement3 == null) { PlistElement plistElement2 = (PlistElement) new PlistElementArray(); dictElementInArray[MapsInfo.BundleTypeKey] = plistElement2; plistElement3 = plistElement2; } this.GetOrCreateStringElementInArray(plistElement3 as PlistElementArray, MapsInfo.BundleTypeValue); PlistElement plistElement4 = this.GetOrCreateInfoDoc().root[MapsInfo.ModeKey]; if (plistElement4 == null) { PlistElement plistElement2 = (PlistElement) new PlistElementArray(); this.GetOrCreateInfoDoc().root[MapsInfo.ModeKey] = plistElement2; plistElement4 = plistElement2; } PlistElementArray root2 = plistElement4 as PlistElementArray; if ((options & MapsOptions.Airplane) == MapsOptions.Airplane) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModePlaneValue); } if ((options & MapsOptions.Bike) == MapsOptions.Bike) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeBikeValue); } if ((options & MapsOptions.Bus) == MapsOptions.Bus) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeBusValue); } if ((options & MapsOptions.Car) == MapsOptions.Car) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeCarValue); } if ((options & MapsOptions.Ferry) == MapsOptions.Ferry) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeFerryValue); } if ((options & MapsOptions.Other) == MapsOptions.Other) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeOtherValue); } if ((options & MapsOptions.Pedestrian) == MapsOptions.Pedestrian) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModePedestrianValue); } if ((options & MapsOptions.RideSharing) == MapsOptions.RideSharing) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeRideShareValue); } if ((options & MapsOptions.StreetCar) == MapsOptions.StreetCar) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeStreetCarValue); } if ((options & MapsOptions.Subway) == MapsOptions.Subway) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeSubwayValue); } if ((options & MapsOptions.Taxi) == MapsOptions.Taxi) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeTaxiValue); } if ((options & MapsOptions.Train) == MapsOptions.Train) { this.GetOrCreateStringElementInArray(root2, MapsInfo.ModeTrainValue); } this.project.AddCapability(this.m_TargetGuid, PBXCapabilityType.Maps, (string)null, false); }