Example #1
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(currentFile))
            {
                SaveToFile_Click(null, null);
                return;
            }

            string output = RichTextBoxFormatter.GetFormattedCode(shellTab.GetHistoryCodeWithEnd());

            File.WriteAllText(currentFile, output);
        }
Example #2
0
        private void SaveToFile_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "Text file (*.txt)|*.txt|Script file (*.script)|*.script";
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            if (saveFileDialog.ShowDialog() == true)
            {
                string output = RichTextBoxFormatter.GetFormattedCode(shellTab.GetHistoryCodeWithEnd());
                File.WriteAllText(saveFileDialog.FileName, output);
                currentFile = saveFileDialog.FileName;
            }
        }