private void SaveScriptAs(frmDocument docToSave) { if (docToSave == null) { MessageBox.Show(this, "Failed to get active document", "Save Failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (string.IsNullOrEmpty(docToSave.ScriptText)) { MessageBox.Show(this, "No script to save", "Cannot Save Script", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } saveFileDialog1.Filter = SCRIPTFILEFILTER; saveFileDialog1.FilterIndex = 0; saveFileDialog1.Title = "Save Script File"; if (saveFileDialog1.ShowDialog(this) == DialogResult.OK) { if (IsFileLoaded(saveFileDialog1.FileName, true)) { return; } docToSave.SaveScriptFile(saveFileDialog1.FileName); } }
private void SaveScript(frmDocument docToSave) { if (docToSave == null) { MessageBox.Show(this, "Failed to get active document", "Save Failed", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (string.IsNullOrEmpty(docToSave.FileName) || docToSave.FileName.StartsWith(NEWSCRIPTFORMATSTRINGPREFIX)) { SaveScriptAs(docToSave); return; } docToSave.SaveScriptFile(); }