public bool SaveFile( bool saveAs)
{
string filepath = null;
if (string.IsNullOrEmpty(CurrentFilePath) || saveAs)
{
using (SaveFileDialog sfd = new SaveFileDialog())
{
sfd.Filter = "ReoScript(*.reo)|*.reo|All Files(*.*)|*.*";
if (sfd.ShowDialog() == DialogResult.OK)
{
filepath = sfd.FileName;
}
else
return false;
}
}
if (string.IsNullOrEmpty(filepath)) return false;
using (StreamWriter sw = new StreamWriter(new FileStream(filepath, FileMode.Create)))
{
sw.Write(editor.Text);
}
CurrentFilePath = filepath;
return true;
}