diff --git a/Paint_2/Form1.cs b/Paint_2/Form1.cs index 821b72c..2dc7dbf 100644 --- a/Paint_2/Form1.cs +++ b/Paint_2/Form1.cs @@ -471,7 +471,22 @@ namespace Paint_2 private void btnSvgExport_Click(object sender, EventArgs e) { - Project.ConvertToSVG(); + FolderBrowserDialog fbd = new FolderBrowserDialog(); + fbd.Description = "Custom Description"; + + if (fbd.ShowDialog() == DialogResult.OK) + { + string SelectedPath = fbd.SelectedPath; + + if (Project.SaveSvg(SelectedPath,tbxProjectName.Text)) + { + MessageBox.Show("Svg saved at "+ SelectedPath); + } + else + { + MessageBox.Show("Ooops, could not save the SVG in " + SelectedPath); + } + } } } } diff --git a/Paint_2/Project.cs b/Paint_2/Project.cs index cae4ece..cb9da13 100644 --- a/Paint_2/Project.cs +++ b/Paint_2/Project.cs @@ -417,7 +417,7 @@ namespace Paint_2 return result; } - public void ConvertToSVG() + public string ConvertToSVG() { string fileContent = ""; string newLine = Environment.NewLine; @@ -434,6 +434,20 @@ namespace Paint_2 fileContent += newLine; fileContent += ""; + return fileContent; + } + public bool SaveSvg(string path,string fileName) + { + bool result = false; + if (Directory.Exists(path)) + { + using (StreamWriter sw = File.CreateText(path + "\\" + fileName + ".svg")) + { + sw.WriteLine(ConvertToSVG()); + result = true; + } + } + return result; } } }