private void button_Convert_Click(object sender, EventArgs e)
        {
            switch (currentMode)
            {
            case CurrentMode.Text:
                try
                {
                    textBox_Content.Text = Converter.Convert(textBox_Content.Text, configFileName);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }

                break;

            case CurrentMode.FileList:
                FileListUtility.ConvertAndStoreFilesInList(fileListItems, configFileName);
                break;
            }
        }
Example #2
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog      fileBrowser   = new OpenFileDialog();
            FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
            DialogResult        dialogResult  = DialogResult.None;

            switch (currentMode)
            {
            case CurrentMode.Text:
                dialogResult = fileBrowser.ShowDialog();
                break;

            case CurrentMode.FileList:
                dialogResult = folderBrowser.ShowDialog();
                break;
            }

            if (dialogResult == DialogResult.OK)
            {
                switch (currentMode)
                {
                case CurrentMode.Text:
                    try
                    {
                        string result = Converter.Convert(textBox_Content.Text, configFileName);
                        System.IO.File.WriteAllText(fileBrowser.FileName, result, Encoding.UTF8);
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }

                    break;

                case CurrentMode.FileList:
                    FileListUtility.ConvertAndStoreFilesInList(fileListItems, configFileName, folderBrowser.SelectedPath);
                    break;
                }
            }
        }