private bool AppIconCatalogueSetName(bool touched, Dictionary <string, object> plist, ITaskItem assetCatalogueNameField) { var appIconCatalogueNameField = PackagingFields .FirstOrDefault(x => FieldType.FromValue(x.ItemSpec) == FieldType.PackagingIosAppIconXcAssetsName); if (assetCatalogueNameField != null && assetCatalogueNameField.IsEnabled() && !String.IsNullOrEmpty(assetCatalogueNameField.GetMetadata("Value")) && appIconCatalogueNameField != null && appIconCatalogueNameField.IsEnabled() && !String.IsNullOrEmpty(appIconCatalogueNameField.GetMetadata("Value")) ) { var appIconSetPath = Path.Combine(assetCatalogueNameField.GetMetadata("Value").ApplyXcAssetsExt() , appIconCatalogueNameField.GetMetadata("Value").ApplyAppiconsetExt()); LogDebug("Package app icon catalogue found, check against resource value {0}", appIconSetPath); if (plist.ContainsKey("XSAppIconAssets")) { var xsAppIconAssets = (string)plist["XSAppIconAssets"]; if (xsAppIconAssets != appIconSetPath) { plist["XSAppIconAssets"] = appIconSetPath; LogInformation("Package app icon catalogue changed to '{0}', setting Plist", plist["XSAppIconAssets"]); touched = true; } else { LogInformation("Package app icon catalogue unchanged, skipping"); } } else { plist.Add("XSAppIconAssets", appIconSetPath); touched = true; LogInformation("Package app icon catalogue not found in Plist, creating with value '{0}'", plist["XSAppIconAssets"]); } } else if (assetCatalogueNameField != null && assetCatalogueNameField.IsDisabled()) { LogWarning("Asset catalogue name is disabled, cannot set app icon catalogue set name in plist"); } else if (appIconCatalogueNameField != null && appIconCatalogueNameField.IsDisabled()) { LogWarning("AppIcon catalogue set name is disabled, cannot set app icon catalogue set name in plist"); } else { LogWarning("Package app icon catalogue not found in packaging fields"); } return(touched); }
private bool LaunchCatalogueSetName(bool touched, Dictionary <string, object> plist, ITaskItem assetCatalogueNameField) { var launchCatalogueNameField = PackagingFields .FirstOrDefault(x => FieldType.FromValue(x.ItemSpec) == FieldType.PackagingIosLaunchImageXcAssetsName); if (assetCatalogueNameField != null && assetCatalogueNameField.IsEnabled() && !String.IsNullOrEmpty(assetCatalogueNameField.GetMetadata("Value")) && launchCatalogueNameField != null && launchCatalogueNameField.IsEnabled() && !String.IsNullOrEmpty(launchCatalogueNameField.GetMetadata("Value")) ) { var setPath = Path.Combine(assetCatalogueNameField.GetMetadata("Value").ApplyXcAssetsExt() , launchCatalogueNameField.GetMetadata("Value").ApplyLaunchimageExt()); LogDebug("Package image catalogue found, check against resource value {0}", setPath); if (plist.ContainsKey("XSLaunchImageAssets")) { var plistKey = (string)plist["XSLaunchImageAssets"]; if (plistKey != setPath) { plist["XSLaunchImageAssets"] = setPath; LogInformation("Package image catalogue changed to '{0}', setting Plist", plist["XSLaunchImageAssets"]); touched = true; } else { LogInformation("Package app icon catalogue unchanged, skipping"); } } else { plist.Add("XSLaunchImageAssets", setPath); touched = true; LogInformation("Package image catalogue not found in Plist, creating with value '{0}'", plist["XSLaunchImageAssets"]); } } else if (assetCatalogueNameField != null && assetCatalogueNameField.IsDisabled()) { LogWarning("Asset catalogue name is disabled, cannot set launch image catalogue set name in plist"); } //remove key for launch image catalogue if using storyboard - maybe, or maybe just make sure it's set, and //if a launchstoryboard name is set it'll overwrite it. then we could drop that field else if ((launchCatalogueNameField != null && launchCatalogueNameField.IsDisabled())) { if (plist.ContainsKey("XSLaunchImageAssets")) { plist.Remove("XSLaunchImageAssets"); touched = true; LogWarning("Launch image catalogue set name is disabled, removing from plist"); } else { LogWarning("Launch image catalogue set name is disabled, but not set in plist, no changing"); } } else { LogWarning("Package launch image catalogue not found in packaging fields"); } return(touched); }