Ejemplo n.º 1
0
        /// <summary>
        /// 自動分割保存
        /// </summary>
        private void ButtonSplitOut_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(TextBoxSrcFile.Text) == true)
            {
                MessageBox.Show("対象ファイルを設定してください");
                return;
            }
            if (string.IsNullOrEmpty(TextBoxSrcFile.Text) == true)
            {
                MessageBox.Show("保存ファイルを設定してください");
                return;
            }


            // 軽量化
            svgo.ExePath        = AppDomain.CurrentDomain.BaseDirectory + SVGO_EXE_PATH_CURRENT;
            svgo.InputFilePath  = TextBoxSrcFile.Text;
            svgo.OutputFilePath = TextBoxDstFile.Text;
            svgo.Precision      = (Int32)SliderPrecision.Value;
            svgo.ExecSvgo(null, null);

            //軽量化したSVG(path)を分割する
            SvgXml svgXml = new SvgXml();

            svgXml.SaveSplitSvg(TextBoxDstFile.Text, long.Parse(TextBoxSplitSize.Text, NumberStyles.AllowThousands));

            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// SVGO実行
        /// </summary>
        public void ExecSvgo(object source, FileSystemEventArgs e)
        {
            if (UpdateConfigFile() == false)
            {
                return;
            }

            string workFilePath = DeleteRasterImage(InputFilePath);

            // SVGO実行
            ProcessStartInfo psInfo = new ProcessStartInfo
            {
                FileName = ExePath,

                Arguments              = GetArgument(workFilePath),
                CreateNoWindow         = true,
                UseShellExecute        = false,
                RedirectStandardOutput = true
            };
            Process p = Process.Start(psInfo);

            p.WaitForExit();
            p.Dispose();

            File.Delete(workFilePath);

            // 分割された要素を一つにまとめて保存

            if (JoinGradient == true)
            {
                SvgXml svgXml = new SvgXml();
                svgXml.SaveJoinSvg(OutputFilePath);
            }

            UpdateSizeWindow();
            previewWindow.PreviewRefresh();
        }