示例#1
0
        private void btnChooseOutput_Click(object sender, EventArgs e)
        {
            PresetDescriptor preset = comboPresets.SelectedItem as PresetDescriptor;

            SaveFileDialog dlg = new SaveFileDialog();

            string filter = string.Empty;

            if (!string.IsNullOrEmpty(preset.FileExtension))
            {
                dlg.DefaultExt = preset.FileExtension;

                filter = string.Format("(*.{0})|*.{0}|", preset.FileExtension);
            }

            filter             += "All files (*.*)|*.*";
            dlg.Filter          = filter;
            dlg.OverwritePrompt = true;

            if (txtOutput.Text.Length > 0)
            {
                dlg.FileName         = System.IO.Path.GetFileName(txtOutput.Text);
                dlg.InitialDirectory = System.IO.Path.GetDirectoryName(txtOutput.Text);
            }

            if (DialogResult.OK != dlg.ShowDialog())
            {
                return;
            }

            txtOutput.Text = dlg.FileName;
        }
示例#2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (m_working)
            {
                return;
            }

            if (!ValidateInputData())
            {
                return;
            }

            PresetDescriptor preset = comboPresets.SelectedItem as PresetDescriptor;

            m_outputPreset  = preset.Name;
            m_inputFile     = txtInput.Text;
            m_outputFile    = txtOutput.Text;
            m_stopRequested = false;
            m_working       = true;

            UpdateControls();

            try
            {
                System.IO.File.Delete(txtOutput.Text);
            }
            catch { }

            Thread convertThread = new Thread(this.Convert);

            convertThread.Start();
        }
示例#3
0
        private void comboPresets_SelectedIndexChanged(object sender, EventArgs e)
        {
            PresetDescriptor preset = comboPresets.SelectedItem as PresetDescriptor;

            if (string.IsNullOrEmpty(preset.FileExtension) || txtOutput.Text.Length == 0)
            {
                return;
            }

            string newExt = "." + preset.FileExtension;
            string oldExt = System.IO.Path.GetExtension(txtOutput.Text);

            if (oldExt == newExt)
            {
                return;
            }

            string newFile = System.IO.Path.ChangeExtension(txtOutput.Text, newExt);

            if (System.IO.File.Exists(newFile))
            {
                string prompt = string.Format("{0} already exists. Do you want to replace the file?", newFile);
                if (DialogResult.Yes != MessageBox.Show(prompt, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                {
                    return;
                }
            }

            txtOutput.Text = newFile;
        }
示例#4
0
        private void ConverterForm_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < AvbTranscoder.Presets.Length; ++i)
            {
                PresetDescriptor preset = AvbTranscoder.Presets[i];

                if ((preset.AudioOnly && ConverterConfig.ProduceAudio) ||
                    (!preset.AudioOnly && ConverterConfig.ProduceVideo))
                {
                    comboPresets.Items.Add(preset);
                }
            }

            comboPresets.SelectedIndex = 0;
            UpdateControls();
        }