/// <summary> /// Saves the current file /// </summary> private void SaveFile(int index) { _currentFile = _documents[index] as VirtualFile; if (_currentFile.FileName.Length == 0) { saveFileDialog1.Title = "Save " + tbDocuments.TabPages[index].Text + " As"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { _currentFile.WriteFile(saveFileDialog1.FileName); tbDocuments.TabPages[index].Text = saveFileDialog1.FileName; } } else { _currentFile.WriteFile((_documents[TabIndex] as VirtualFile).FileName); } }
/// <summary> /// Saves the current file /// </summary> private void SaveCurrentFile() { _currentFile = _documents[tbDocuments.TabIndex] as VirtualFile; if (_currentFile.FileName.Length == 0) { saveFileDialog1.Title = "Save " + tbDocuments.TabPages[tbDocuments.TabIndex].Text + " As"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { SaveTextSurface(tbDocuments.TabIndex); _currentFile.WriteFile(saveFileDialog1.FileName); tbDocuments.TabPages[tbDocuments.TabIndex].Text = StripPath(saveFileDialog1.FileName); } } else { SaveTextSurface(tbDocuments.TabIndex); _currentFile.WriteFile((_documents[tbDocuments.TabIndex] as VirtualFile).FileName); } }