Esempio n. 1
0
 public void ResizePng(PngFileInfo sourcePngFile, PngFileInfo targetPngFile)
 {
     _logger.InfoFormat("Resizing: {0} -> {1}", sourcePngFile.Name, targetPngFile.Name);
     var sourcePngFileInfo = new FileInfo(sourcePngFile.FullName);
     using (var sourceImage = new MagickImage(sourcePngFileInfo))
     {
         sourceImage.Resize(targetPngFile.Size, targetPngFile.Size);
         var targetPngFileInfo = new FileInfo(targetPngFile.FullName);
         sourceImage.Write(targetPngFileInfo);
     }
 }
Esempio n. 2
0
 public void ExportSvgToPng(IconFileInfo svgFile, PngFileInfo pngFile)
 {
     _logger.InfoFormat("Exporting: {0}->{1}", svgFile.Name, pngFile.Name);
     var incscapeExe = GetInkscapeExe();
     var arguments = string.Format("-z -e \"{0}\" -w {2} -h {2} \"{1}\" ", pngFile.FullName, svgFile.FullName, pngFile.Size);
     var exitCode = _processProvider.StartProcess(incscapeExe, arguments);
     if (exitCode != 0)
     {
         throw new NMultiToolException("Failed to export svg to png file. Exit code: " + exitCode);
     }
     if (!pngFile.Exists)
     {
         throw new NMultiToolException("Failed to export svg to png. Png file has not been created: " + pngFile.FullName);
     }
     pngFile.ModfiedTime = svgFile.ModfiedTime;
 }
Esempio n. 3
0
        public bool NeedUpdate(PngFileInfo pngFile)
        {
            var pngFileIsMissing = !pngFile.Exists;

            if (pngFileIsMissing)
            {
                return(true);
            }

            var modifyDateDifferent = pngFile.ModfiedTime < SvgFile.ModfiedTime;

            if (modifyDateDifferent)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        public bool NeedUpdate(PngFileInfo pngFile)
        {
            var pngFileIsMissing = !pngFile.Exists;
            if (pngFileIsMissing)
                return true;

            var modifyDateDifferent = pngFile.ModfiedTime < SvgFile.ModfiedTime;
            if (modifyDateDifferent)
                return true;

            return false;
        }