public void ExportSvgToPngs(IconInfo iconInfo) { foreach (var pngFileInfo in iconInfo.PngFiles) { if (iconInfo.NeedUpdate(pngFileInfo)) { ExportSvgToPng(iconInfo.SvgFile, pngFileInfo); } else { _logger.Info("Png up to date: " + pngFileInfo.FullName); } } }
public void CreateIconFromPngFilesFromSvg(IconInfo iconInfo) { if (iconInfo.NeedUpdate()) { using (var imageCollection = new MagickImageCollection()) { foreach (var iconInfoPngFile in iconInfo.PngFiles) { var image = new MagickImage(iconInfoPngFile.FullName); imageCollection.Add(image); } imageCollection.Write(iconInfo.IconFile.FullName); } } }
public Result <int> ConvertSvgToIco(string svgFileName, int[] sizes, bool refresh) { var exitCode = 0; VerifySvgFile(svgFileName); var iconInfo = new IconInfo(svgFileName, sizes); if (refresh || iconInfo.NeedUpdate()) { _inkscapeProvider.ExportSvgToPngs(iconInfo); _imageMagicProvider.CreateIconFromPngFilesFromSvg(iconInfo); } else { _logger.Info("Icon up to date: " + iconInfo.IconFile.FullName); } return(Result.Ok(exitCode)); }