Example #1
0
        public static async Task LoadImageFromModelString(this IconFileInfo info)
        {
            var dataBytes = Convert.FromBase64String(info.IconData);

            info.IconDataBytes = dataBytes;
            info.Image         = await dataBytes.ToBitmapAsync();
        }
Example #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;
        }