bool Clear(ref PObject plist) { if (Type != null) { switch (Type.ToLowerInvariant()) { case "string": plist = new PString(string.Empty); break; case "array": plist = new PArray(); break; case "dict": plist = new PDictionary(); break; case "bool": plist = new PBoolean(false); break; case "real": plist = new PReal(0); break; case "integer": plist = new PNumber(0); break; case "date": plist = new PDate(DateTime.Now); break; case "data": plist = new PData(new byte[1]); break; default: Log.LogError(7045, null, $"Unrecognized Type: {Type}"); return(false); } } else { plist = PObject.Create(plist.Type); } return(true); }
public static void SetIfNotPresent(this PDictionary dict, string key, bool value) { var b = dict.Get <PBoolean> (key); if (b == null) { dict[key] = new PBoolean(value); } }
public static void SetBooleanOrRemove(this PDictionary dict, string key, bool value) { if (value) { dict[key] = new PBoolean(true); } else { dict.Remove(key); } }
public void AvailableValues_Boolean_NotInScheme() { var value = new PBoolean(true); var root = new PDictionary(); root.Add("foo", value); var available = PListScheme.AvailableValues(value, PListScheme.Match(root, PListScheme.Empty)); Assert.AreEqual(2, available.Count, "#1"); }
public void AvailableValues_Boolean_InArray() { var scheme = Load(@" <PListScheme> <Key name = ""keyname"" type = ""Array"" arrayType = ""Boolean"" /> </PListScheme>"); var value = new PBoolean(true); var root = new PDictionary(); root.Add(scheme.Keys[0].Identifier, value); var available = PListScheme.AvailableValues(value, PListScheme.Match(root, scheme)); Assert.AreEqual(2, available.Count, "#1"); }
bool CreateValue(string type, string text, out PObject value) { DateTime date = DateTime.Now; bool boolean = false; double real = 0; int integer = 0; value = null; switch (type.ToLowerInvariant()) { case "string": value = new PString(text); return(true); case "array": value = new PArray(); return(true); case "dict": value = new PDictionary(); return(true); case "bool": if (text == null || !bool.TryParse(text, out boolean)) { boolean = false; } value = new PBoolean(boolean); return(true); case "real": if (text != null && !double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out real)) { Log.LogError(7045, null, "Unrecognized Real Format"); return(false); } value = new PReal(real); return(true); case "integer": if (text != null && !int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out integer)) { Log.LogError(7045, null, "Unrecognized Integer Format"); return(false); } value = new PNumber(integer); return(true); case "date": if (text != null && !DateTime.TryParse(text, CultureInfo.InvariantCulture, DateTimeStyles.None, out date)) { Log.LogError(7045, null, "Unrecognized Date Format"); return(false); } value = new PDate(date); return(true); case "data": if (text != null) { value = new PData(Encoding.UTF8.GetBytes(Value)); } else { value = new PData(new byte[0]); } return(true); default: Log.LogError(7045, null, $"Unrecognized Type: {type}"); value = null; return(false); } }
protected override bool Compile(PDictionary plist) { var currentSDK = Sdks.GetAppleSdk(Platform); sdkVersion = AppleSdkVersion.Parse(DefaultSdkVersion); if (!currentSDK.SdkIsInstalled(sdkVersion, SdkIsSimulator)) { Log.LogError(null, null, null, null, 0, 0, 0, 0, MSBStrings.E0013, Platform, sdkVersion); return(false); } supportedDevices = plist.GetUIDeviceFamily(); if (!IsWatchApp) { var version = Sdks.XamIOS.ExtendedVersion; // This key is our supported way of determining if an app // was built with Xamarin, so it needs to be present in all apps. var dict = new PDictionary(); dict.Add("Version", new PString(string.Format("{0} ({1}: {2})", version.Version, version.Branch, version.Hash))); plist.Add("com.xamarin.ios", dict); } var sdkSettings = currentSDK.GetSdkSettings(sdkVersion, SdkIsSimulator); var dtSettings = currentSDK.GetAppleDTSettings(); SetValue(plist, ManifestKeys.BuildMachineOSBuild, dtSettings.BuildMachineOSBuild); // We have an issue here, this is for consideration by the platform: // CFLocaleCopyCurrent(), used in the mono code to get the current locale (locale.c line 421), will return the value of the application's CFBundleDevelopmentRegion Info.plist key if all of the following conditions are true: // // * CFBundleDevelopmentRegion is present in the Info.plist // * The CFBundleDevelopmentRegion language is in the list of preferred languages on the iOS device, but isn't the first one // * There are no localized resources (i.e. no .lproj directory) in the app for the first preferred locale // // This differs from iOS 10 where the presence of the CFBundleDevelopmentRegion key had no effect. Commenting this line out, ensures that CurrentCulture is correct and behaves like the iOS 10 version. // plist.SetIfNotPresent (ManifestKeys.CFBundleDevelopmentRegion, "en"); if (IsIOS) { var executable = plist.GetCFBundleExecutable(); if (executable.EndsWith(".app", StringComparison.Ordinal)) { LogAppManifestError(MSBStrings.E0014, executable); } } if (!string.IsNullOrEmpty(ResourceRules)) { plist.SetIfNotPresent(ManifestKeys.CFBundleResourceSpecification, Path.GetFileName(ResourceRules)); } if (!plist.ContainsKey(ManifestKeys.CFBundleSupportedPlatforms)) { plist[ManifestKeys.CFBundleSupportedPlatforms] = new PArray { SdkPlatform } } ; string dtCompiler = null; string dtPlatformBuild = null; string dtSDKBuild = null; string dtPlatformName = null; string dtPlatformVersion = null; string dtXcode = null; string dtXcodeBuild = null; if (!SdkIsSimulator) { dtCompiler = sdkSettings.DTCompiler; dtPlatformBuild = dtSettings.DTPlatformBuild; dtSDKBuild = sdkSettings.DTSDKBuild; } dtPlatformName = SdkPlatform.ToLowerInvariant(); if (!SdkIsSimulator) { dtPlatformVersion = dtSettings.DTPlatformVersion; } var dtSDKName = sdkSettings.CanonicalName; // older sdksettings didn't have a canonicalname for sim if (SdkIsSimulator && string.IsNullOrEmpty(dtSDKName)) { var deviceSdkSettings = currentSDK.GetSdkSettings(sdkVersion, false); dtSDKName = deviceSdkSettings.AlternateSDK; } if (!SdkIsSimulator) { dtXcode = AppleSdkSettings.DTXcode; dtXcodeBuild = dtSettings.DTXcodeBuild; } SetValueIfNotNull(plist, "DTCompiler", dtCompiler); SetValueIfNotNull(plist, "DTPlatformBuild", dtPlatformBuild); SetValueIfNotNull(plist, "DTSDKBuild", dtSDKBuild); plist.SetIfNotPresent("DTPlatformName", dtPlatformName); SetValueIfNotNull(plist, "DTPlatformVersion", dtPlatformVersion); SetValue(plist, "DTSDKName", dtSDKName); SetValueIfNotNull(plist, "DTXcode", dtXcode); SetValueIfNotNull(plist, "DTXcodeBuild", dtXcodeBuild); SetDeviceFamily(plist); if (IsWatchExtension) { // Note: Only watchOS1 Extensions target Xamarin.iOS if (Platform == ApplePlatform.iOS) { PObject value; if (!plist.TryGetValue(ManifestKeys.UIRequiredDeviceCapabilities, out value)) { var capabilities = new PArray(); capabilities.Add(new PString("watch-companion")); plist.Add(ManifestKeys.UIRequiredDeviceCapabilities, capabilities); } else if (value is PDictionary) { var capabilities = (PDictionary)value; if (!capabilities.ContainsKey("watch-companion")) { capabilities.Add("watch-companion", new PBoolean(true)); } } else { var capabilities = (PArray)value; bool exists = false; foreach (var capability in capabilities.OfType <PString> ()) { if (capability.Value != "watch-companion") { continue; } exists = true; break; } if (!exists) { capabilities.Add(new PString("watch-companion")); } } } if (Debug) { SetAppTransportSecurity(plist); } } SetRequiredArchitectures(plist); if (IsIOS) { Validation(plist); } return(!Log.HasLoggedErrors); } void SetValueIfNotNull(PDictionary dict, string key, string value) { if (value == null) { return; } SetValue(dict, key, value); } void SetRequiredArchitectures(PDictionary plist) { PObject capabilities; if (plist.TryGetValue(ManifestKeys.UIRequiredDeviceCapabilities, out capabilities)) { if (capabilities is PArray) { var architectureValues = new HashSet <string> (new[] { "armv6", "armv7", "arm64" }); var array = (PArray)capabilities; // Remove any architecture values for (int i = 0; i < array.Count; i++) { var value = array[i] as PString; if (value == null || !architectureValues.Contains(value.Value)) { continue; } array.RemoveAt(i); } // If-and-only-if the TargetArchitecture is a single architecture, set it as a required device capability switch (architectures) { case TargetArchitecture.ARM64: array.Add(new PString("arm64")); break; case TargetArchitecture.ARMv7: array.Add(new PString("armv7")); break; } } else if (capabilities is PDictionary) { var dict = (PDictionary)capabilities; switch (architectures) { case TargetArchitecture.ARM64: dict["arm64"] = new PBoolean(true); dict.Remove("armv6"); dict.Remove("armv7"); break; case TargetArchitecture.ARMv7: dict["armv7"] = new PBoolean(true); dict.Remove("armv6"); dict.Remove("arm64"); break; default: dict.Remove("armv6"); dict.Remove("armv7"); dict.Remove("arm64"); break; } } } else { var array = new PArray(); // If-and-only-if the TargetArchitecture is a single architecture, set it as a required device capability switch (architectures) { case TargetArchitecture.ARM64: array.Add(new PString("arm64")); break; case TargetArchitecture.ARMv7: array.Add(new PString("armv7")); break; } if (array.Count > 0) { plist.Add(ManifestKeys.UIRequiredDeviceCapabilities, array); } } } void SetDeviceFamily(PDictionary plist) { switch (Platform) { case ApplePlatform.iOS: SetIOSDeviceFamily(plist); break; case ApplePlatform.WatchOS: plist.SetUIDeviceFamily(IPhoneDeviceType.Watch); break; case ApplePlatform.TVOS: plist.SetUIDeviceFamily(IPhoneDeviceType.TV); break; } } void SetIOSDeviceFamily(PDictionary plist) { if (IsWatchApp) { if (SdkIsSimulator) { plist.SetUIDeviceFamily(IPhoneDeviceType.IPhone | IPhoneDeviceType.Watch); } else { plist.SetUIDeviceFamily(IPhoneDeviceType.Watch); } } else { if (!IsAppExtension) { plist.SetIfNotPresent(ManifestKeys.LSRequiresIPhoneOS, true); } if (supportedDevices == IPhoneDeviceType.NotSet) { plist.SetUIDeviceFamily(IPhoneDeviceType.IPhone); } } } void SetAppTransportSecurity(PDictionary plist) { // Debugging over http has a couple of gotchas: // * We can't use https, because that requires a valid server certificate, // which we can't ensure. // It would also require a hostname for the mac, which it might not have either. // * NSAppTransportSecurity/NSExceptionDomains does not allow exceptions based // on IP address (only hostname). // * Which means the only way to make sure watchOS allows connections from // the app on device to the mac is to disable App Transport Security altogether. // Good news: watchOS 3 will apparently not apply ATS when connecting // directly to IP addresses, which means we won't have to do this at all // (sometime in the future). PDictionary ats; if (!plist.TryGetValue(ManifestKeys.NSAppTransportSecurity, out ats)) { plist.Add(ManifestKeys.NSAppTransportSecurity, ats = new PDictionary()); } if (ats.GetBoolean(ManifestKeys.NSAllowsArbitraryLoads)) { Log.LogMessage(MessageImportance.Low, MSBStrings.M0017); } else { Log.LogMessage(MessageImportance.Low, MSBStrings.M0018); ats.SetBooleanOrRemove(ManifestKeys.NSAllowsArbitraryLoads, true); } } void Validation(PDictionary plist) { if (!Validate) { return; } var supportsIPhone = (supportedDevices & IPhoneDeviceType.IPhone) != 0 || supportedDevices == IPhoneDeviceType.NotSet; var supportsIPad = (supportedDevices & IPhoneDeviceType.IPad) != 0; // Validation... if (!IsAppExtension && sdkVersion >= AppleSdkVersion.V3_2) { IPhoneOrientation orientation; if (supportsIPhone) { orientation = plist.GetUISupportedInterfaceOrientations(false); if (orientation == IPhoneOrientation.None) { LogAppManifestWarning(MSBStrings.W0019); } else if (!orientation.IsValidPair()) { LogAppManifestWarning(MSBStrings.W0020); } } if (supportsIPad) { orientation = plist.GetUISupportedInterfaceOrientations(true); if (orientation == IPhoneOrientation.None) { LogAppManifestWarning(MSBStrings.W0021); } else if (!orientation.IsValidPair()) { LogAppManifestWarning(MSBStrings.W0022); } } } } }
bool Compile(PDictionary plist) { var currentSDK = IPhoneSdks.GetSdk(Framework); if (!currentSDK.SdkIsInstalled(sdkVersion, SdkIsSimulator)) { Log.LogError(null, null, null, null, 0, 0, 0, 0, "The {0} SDK for '{1}' is not installed.", Framework, sdkVersion); return(false); } supportedDevices = plist.GetUIDeviceFamily(); if (!IsWatchApp) { var version = IPhoneSdks.MonoTouch.ExtendedVersion; // This key is our supported way of determining if an app // was built with Xamarin, so it needs to be present in all apps. var dict = new PDictionary(); dict.Add("Version", new PString(string.Format("{0} ({1}: {2})", version.Version, version.Branch, version.Hash))); plist.Add("com.xamarin.ios", dict); } var sdkSettings = currentSDK.GetSdkSettings(sdkVersion, SdkIsSimulator); var dtSettings = currentSDK.GetDTSettings(); SetValue(plist, ManifestKeys.BuildMachineOSBuild, dtSettings.BuildMachineOSBuild); // We have an issue here, this is for consideration by the platform: // CFLocaleCopyCurrent(), used in the mono code to get the current locale (locale.c line 421), will return the value of the application's CFBundleDevelopmentRegion Info.plist key if all of the following conditions are true: // // * CFBundleDevelopmentRegion is present in the Info.plist // * The CFBundleDevelopmentRegion language is in the list of preferred languages on the iOS device, but isn't the first one // * There are no localized resources (i.e. no .lproj directory) in the app for the first preferred locale // // This differs from iOS 10 where the presence of the CFBundleDevelopmentRegion key had no effect. Commenting this line out, ensures that CurrentCulture is correct and behaves like the iOS 10 version. // plist.SetIfNotPresent (ManifestKeys.CFBundleDevelopmentRegion, "en"); plist.SetIfNotPresent(ManifestKeys.CFBundleExecutable, AssemblyName); if (IsIOS) { var executable = plist.GetCFBundleExecutable(); if (executable.EndsWith(".app", StringComparison.Ordinal)) { LogAppManifestError("The executable (CFBundleExecutable) name ({0}) cannot end with '.app', because iOS may fail to launch the app.", executable); } } if (IsIOS) { if (minimumOSVersion < IPhoneSdkVersion.V5_0 && plist.GetUIMainStoryboardFile(true) != null) { LogAppManifestError("Applications using a storyboard as the Main Interface must have a deployment target greater than 5.0"); } if (!plist.ContainsKey(ManifestKeys.CFBundleName)) { plist [ManifestKeys.CFBundleName] = plist.ContainsKey(ManifestKeys.CFBundleDisplayName) ? plist.GetString(ManifestKeys.CFBundleDisplayName).Clone() : new PString(AppBundleName); } } else { plist.SetIfNotPresent(ManifestKeys.CFBundleName, AppBundleName); } plist.SetIfNotPresent(ManifestKeys.CFBundleIdentifier, BundleIdentifier); plist.SetIfNotPresent(ManifestKeys.CFBundleInfoDictionaryVersion, "6.0"); plist.SetIfNotPresent(ManifestKeys.CFBundlePackageType, IsAppExtension ? "XPC!" : "APPL"); if (!string.IsNullOrEmpty(ResourceRules)) { plist.SetIfNotPresent(ManifestKeys.CFBundleResourceSpecification, Path.GetFileName(ResourceRules)); } plist.SetIfNotPresent(ManifestKeys.CFBundleSignature, "????"); if (!plist.ContainsKey(ManifestKeys.CFBundleSupportedPlatforms)) { plist[ManifestKeys.CFBundleSupportedPlatforms] = new PArray { SdkPlatform } } ; plist.SetIfNotPresent(ManifestKeys.CFBundleVersion, "1.0"); plist.SetIfNotPresent(ManifestKeys.CFBundleShortVersionString, plist.GetCFBundleVersion()); string dtCompiler = null; string dtPlatformBuild = null; string dtSDKBuild = null; string dtPlatformName = null; string dtPlatformVersion = null; string dtXcode = null; string dtXcodeBuild = null; if (!SdkIsSimulator) { dtCompiler = sdkSettings.DTCompiler; dtPlatformBuild = dtSettings.DTPlatformBuild; dtSDKBuild = sdkSettings.DTSDKBuild; } dtPlatformName = SdkPlatform.ToLowerInvariant(); if (!SdkIsSimulator) { dtPlatformVersion = dtSettings.DTPlatformVersion; } var dtSDKName = sdkSettings.CanonicalName; // older sdksettings didn't have a canonicalname for sim if (SdkIsSimulator && string.IsNullOrEmpty(dtSDKName)) { var deviceSdkSettings = currentSDK.GetSdkSettings(sdkVersion, false); dtSDKName = deviceSdkSettings.AlternateSDK; } if (!SdkIsSimulator) { dtXcode = AppleSdkSettings.DTXcode; dtXcodeBuild = dtSettings.DTXcodeBuild; } if (UseFakeWatchOS4_3Sdk) { // This is a workaround for https://github.com/xamarin/xamarin-macios/issues/4810 if (Framework == PlatformFramework.WatchOS) { if (dtPlatformBuild != null) { dtPlatformBuild = "15T212"; } if (dtPlatformVersion != null) { dtPlatformVersion = "4.3"; } if (dtSDKBuild != null) { dtSDKBuild = "15T212"; } if (dtSDKName != null) { dtSDKName = "watchos4.3"; } if (dtXcode != null) { dtXcode = "0940"; } if (dtXcodeBuild != null) { dtXcodeBuild = "9F1027a"; } } else { Log.LogWarning("Can only fake the watchOS 4.3 SDK when building for watchOS."); } } SetValueIfNotNull(plist, "DTCompiler", dtCompiler); SetValueIfNotNull(plist, "DTPlatformBuild", dtPlatformBuild); SetValueIfNotNull(plist, "DTSDKBuild", dtSDKBuild); plist.SetIfNotPresent("DTPlatformName", dtPlatformName); SetValueIfNotNull(plist, "DTPlatformVersion", dtPlatformVersion); SetValue(plist, "DTSDKName", dtSDKName); SetValueIfNotNull(plist, "DTXcode", dtXcode); SetValueIfNotNull(plist, "DTXcodeBuild", dtXcodeBuild); SetDeviceFamily(plist); plist.SetIfNotPresent(ManifestKeys.MinimumOSVersion, minimumOSVersion.ToString()); if (IsWatchExtension) { // Note: Only watchOS1 Extensions target Xamarin.iOS if (Framework == PlatformFramework.iOS) { PObject value; if (!plist.TryGetValue(ManifestKeys.UIRequiredDeviceCapabilities, out value)) { var capabilities = new PArray(); capabilities.Add(new PString("watch-companion")); plist.Add(ManifestKeys.UIRequiredDeviceCapabilities, capabilities); } else if (value is PDictionary) { var capabilities = (PDictionary)value; if (!capabilities.ContainsKey("watch-companion")) { capabilities.Add("watch-companion", new PBoolean(true)); } } else { var capabilities = (PArray)value; bool exists = false; foreach (var capability in capabilities.OfType <PString> ()) { if (capability.Value != "watch-companion") { continue; } exists = true; break; } if (!exists) { capabilities.Add(new PString("watch-companion")); } } } if (Debug) { SetAppTransportSecurity(plist); } } // Remove any Xamarin Studio specific keys plist.Remove(ManifestKeys.XSLaunchImageAssets); plist.Remove(ManifestKeys.XSAppIconAssets); // Merge with any partial plists generated by the Asset Catalog compiler... MergePartialPlistTemplates(plist); SetRequiredArchitectures(plist); if (IsIOS) { Validation(plist); } CompiledAppManifest = new TaskItem(Path.Combine(AppBundleDir, "Info.plist")); plist.Save(CompiledAppManifest.ItemSpec, true, true); return(!Log.HasLoggedErrors); } void SetValueIfNotNull(PDictionary dict, string key, string value) { if (value == null) { return; } SetValue(dict, key, value); } void SetRequiredArchitectures(PDictionary plist) { PObject capabilities; if (plist.TryGetValue(ManifestKeys.UIRequiredDeviceCapabilities, out capabilities)) { if (capabilities is PArray) { var architectureValues = new HashSet <string> (new[] { "armv6", "armv7", "arm64" }); var array = (PArray)capabilities; // Remove any architecture values for (int i = 0; i < array.Count; i++) { var value = array[i] as PString; if (value == null || !architectureValues.Contains(value.Value)) { continue; } array.RemoveAt(i); } // If-and-only-if the TargetArchitecture is a single architecture, set it as a required device capability switch (architectures) { case TargetArchitecture.ARM64: array.Add(new PString("arm64")); break; case TargetArchitecture.ARMv7: array.Add(new PString("armv7")); break; } } else if (capabilities is PDictionary) { var dict = (PDictionary)capabilities; switch (architectures) { case TargetArchitecture.ARM64: dict["arm64"] = new PBoolean(true); dict.Remove("armv6"); dict.Remove("armv7"); break; case TargetArchitecture.ARMv7: dict["armv7"] = new PBoolean(true); dict.Remove("armv6"); dict.Remove("arm64"); break; default: dict.Remove("armv6"); dict.Remove("armv7"); dict.Remove("arm64"); break; } } } else { var array = new PArray(); // If-and-only-if the TargetArchitecture is a single architecture, set it as a required device capability switch (architectures) { case TargetArchitecture.ARM64: array.Add(new PString("arm64")); break; case TargetArchitecture.ARMv7: array.Add(new PString("armv7")); break; } if (array.Count > 0) { plist.Add(ManifestKeys.UIRequiredDeviceCapabilities, array); } } } void SetDeviceFamily(PDictionary plist) { switch (Framework) { case PlatformFramework.iOS: SetIOSDeviceFamily(plist); break; case PlatformFramework.WatchOS: plist.SetUIDeviceFamily(IPhoneDeviceType.Watch); break; case PlatformFramework.TVOS: plist.SetUIDeviceFamily(IPhoneDeviceType.TV); break; } } void SetIOSDeviceFamily(PDictionary plist) { if (IsWatchApp) { if (SdkIsSimulator) { plist.SetUIDeviceFamily(IPhoneDeviceType.IPhone | IPhoneDeviceType.Watch); } else { plist.SetUIDeviceFamily(IPhoneDeviceType.Watch); } } else { if (!IsAppExtension) { plist.SetIfNotPresent(ManifestKeys.LSRequiresIPhoneOS, true); } if (minimumOSVersion >= IPhoneSdkVersion.V3_2 && supportedDevices == IPhoneDeviceType.NotSet) { plist.SetUIDeviceFamily(IPhoneDeviceType.IPhone); } } } void SetAppTransportSecurity(PDictionary plist) { // Debugging over http has a couple of gotchas: // * We can't use https, because that requires a valid server certificate, // which we can't ensure. // It would also require a hostname for the mac, which it might not have either. // * NSAppTransportSecurity/NSExceptionDomains does not allow exceptions based // on IP address (only hostname). // * Which means the only way to make sure watchOS allows connections from // the app on device to the mac is to disable App Transport Security altogether. // Good news: watchOS 3 will apparently not apply ATS when connecting // directly to IP addresses, which means we won't have to do this at all // (sometime in the future). PDictionary ats; if (!plist.TryGetValue(ManifestKeys.NSAppTransportSecurity, out ats)) { plist.Add(ManifestKeys.NSAppTransportSecurity, ats = new PDictionary()); } if (ats.GetBoolean(ManifestKeys.NSAllowsArbitraryLoads)) { Log.LogMessage(MessageImportance.Low, "All http loads are already allowed."); } else { Log.LogMessage(MessageImportance.Low, "Allowed arbitrary HTTP loads to support debugging."); ats.SetBooleanOrRemove(ManifestKeys.NSAllowsArbitraryLoads, true); } } void Validation(PDictionary plist) { var supportsIPhone = (supportedDevices & IPhoneDeviceType.IPhone) != 0 || supportedDevices == IPhoneDeviceType.NotSet; var supportsIPad = (supportedDevices & IPhoneDeviceType.IPad) != 0; // Validation... if (!IsAppExtension && sdkVersion >= IPhoneSdkVersion.V3_2) { IPhoneOrientation orientation; if (supportsIPhone) { orientation = plist.GetUISupportedInterfaceOrientations(false); if (orientation == IPhoneOrientation.None) { LogAppManifestWarning("Supported iPhone orientations have not been set"); } else if (!orientation.IsValidPair()) { LogAppManifestWarning("Supported iPhone orientations are not matched pairs"); } } if (supportsIPad) { orientation = plist.GetUISupportedInterfaceOrientations(true); if (orientation == IPhoneOrientation.None) { LogAppManifestWarning("Supported iPad orientations have not been set"); } else if (!orientation.IsValidPair()) { LogAppManifestWarning("Supported iPad orientations are not matched pairs"); } } } } }
protected abstract Node_Boolean parseBoolean(PBoolean node);
public static PBoolean XNor(PBoolean b1, PBoolean b2) { return(Not(Xor(b1, b2))); }
public static PBoolean Xor(PBoolean b1, PBoolean b2) { return(And(Or(b1, b2), Nand(b1, b2))); }
public static PBoolean Nand(PBoolean b1, PBoolean b2) { return(Not(And(b1, b2))); }
public static PBoolean Not(PBoolean b1) { return(new PBoolean(!b1.Value)); }
public static PBoolean Or(PBoolean b1, PBoolean b2) { return(new PBoolean(b1.Value && b2.Value)); }
public Environment() { Output = new Output(); EmptyArgs = new SArgs(this); True = new LBoolean(this, true); False = new LBoolean(this, false); Undefined = new LUndefined(this); Null = new LNull(this); GlobalObject = new BGlobal(this); GlobalEnvironment = new SLexicalEnvironment(this, new SObjectEnvironmentRecord(this, GlobalObject, false), null); MathObject = new BMath(this); JsonObject = new BJson(this); ObjectConstructor = new CObject(this); FunctionConstructor = new CFunction(this); ArrayConstructor = new CArray(this); StringConstructor = new CString(this); BooleanConstructor = new CBoolean(this); NumberConstructor = new CNumber(this); DateConstructor = new CDate(this); RegExpConstructor = new CRegExp(this); ErrorConstructor = new CError(this); EvalErrorConstructor = new CEvalError(this); RangeErrorConstructor = new CRangeError(this); ReferenceErrorConstructor = new CReferenceError(this); SyntaxErrorConstructor = new CSyntaxError(this); TypeErrorConstructor = new CTypeError(this); UriErrorConstructor = new CUriError(this); ObjectPrototype = new PObject(this); FunctionPrototype = new PFunction(this); ArrayPrototype = new PArray(this); StringPrototype = new PString(this); BooleanPrototype = new PBoolean(this); NumberPrototype = new PNumber(this); DatePrototype = new PDate(this); RegExpPrototype = new PRegExp(this); ErrorPrototype = new PError(this); EvalErrorPrototype = new PEvalError(this); RangeErrorPrototype = new PRangeError(this); ReferenceErrorPrototype = new PReferenceError(this); SyntaxErrorPrototype = new PSyntaxError(this); TypeErrorPrototype = new PTypeError(this); UriErrorPrototype = new PUriError(this); GlobalObject.Initialize(); MathObject.Initialize(); JsonObject.Initialize(); ObjectConstructor.Initialize(); FunctionConstructor.Initialize(); ArrayConstructor.Initialize(); StringConstructor.Initialize(); BooleanConstructor.Initialize(); NumberConstructor.Initialize(); DateConstructor.Initialize(); RegExpConstructor.Initialize(); ErrorConstructor.Initialize(); EvalErrorConstructor.Initialize(); RangeErrorConstructor.Initialize(); ReferenceErrorConstructor.Initialize(); SyntaxErrorConstructor.Initialize(); TypeErrorConstructor.Initialize(); UriErrorConstructor.Initialize(); ObjectPrototype.Initialize(); FunctionPrototype.Initialize(); ArrayPrototype.Initialize(); StringPrototype.Initialize(); BooleanPrototype.Initialize(); NumberPrototype.Initialize(); DatePrototype.Initialize(); RegExpPrototype.Initialize(); ErrorPrototype.Initialize(); EvalErrorPrototype.Initialize(); RangeErrorPrototype.Initialize(); ReferenceErrorPrototype.Initialize(); SyntaxErrorPrototype.Initialize(); TypeErrorPrototype.Initialize(); UriErrorPrototype.Initialize(); }