private void Resize(string path, string colorIconName, FileInfo file, int size, RequiredColor?requiredColor, string resolutionFolder) { string destinationIconPath = Path.Combine(path, colorIconName); _resizer.Resize(file.FullName, destinationIconPath, size, size, requiredColor?.ColorHexValue); string relativeIconPath = Path.Combine("Resources", resolutionFolder, colorIconName); _projectFileUpdater.AddIcon(relativeIconPath); }
private void CreateIcons(string[] resolutionFolders, string baseIconName, int requiredSize, FileInfo file, IList <Image> imagesInfo, string destinationPath, RequiredColor color = null) { string folderName = $"{Path.GetFileNameWithoutExtension(baseIconName)}.imageset"; string folderPath = Path.Combine(destinationPath, folderName); EnsureDirectoryExists(folderPath); foreach (string scaleFactorString in resolutionFolders) { string finalIconName = _imageRenamer.AddPostfix(baseIconName, $"_{scaleFactorString}"); string destinationIconPath = Path.Combine(folderPath, finalIconName); int size = (int)(requiredSize * ResNameAssociation[scaleFactorString]); _resizer.Resize(file.FullName, destinationIconPath, size, size, color?.ColorHexValue); Image image = new Image { Appearances = new string[] { }, Scale = scaleFactorString, Idiom = "universal", FileName = finalIconName, }; imagesInfo.Add(image); string relativeIconPath = Path.Combine("Assets.xcassets", folderName, finalIconName); _projectFileUpdater.AddIcon(relativeIconPath); } CreateContentJson(folderPath, imagesInfo); string relativeContentFilePath = Path.Combine("Assets.xcassets", folderName, "Contents.json"); _projectFileUpdater.AddIcon(relativeContentFilePath); }