예제 #1
0
        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);
            }
        }
예제 #2
0
        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();
        }