Exemple #1
0
        private void saveButton_Click(object sender, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(output.Text))
            {
                btOutput_Click(null, null);
                if (String.IsNullOrEmpty(output.Text))
                {
                    MessageBox.Show("Please select the output file first", "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (!Directory.Exists(Path.GetDirectoryName(output.Text)))
            {
                btOutput_Click(null, null);
                if (!Directory.Exists(Path.GetDirectoryName(output.Text)))
                {
                    return;
                }
            }

            if (rbQPF.Checked && fpsChooserIn.Value == null)
            {
                MessageBox.Show("The FPS value for the input file is unknown.\nPlease make sure that the correct value for the input is selected.", "FPS unknown", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (rbQPF.Checked && fpsChooserOut.Value == null)
            {
                MessageBox.Show("The FPS value for the output file is unknown.\nPlease make sure that the correct value for the output is selected.", "FPS unknown", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!FileUtil.IsDirWriteable(Path.GetDirectoryName(output.Text)))
            {
                MessageBox.Show("MeGUI cannot write to the path " + Path.GetDirectoryName(output.Text) + "\n" +
                                "Please select another output path to save your file.", "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!pgc.HasChapters)
            {
                MessageBox.Show("Please add at least one chapter.", "Missing Chapter", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            ChapterInfo oChapterSave = new ChapterInfo(pgc);

            if (fpsChooserOut.Value != null)
            {
                oChapterSave.ChangeFps((double)fpsChooserOut.Value);
            }
            if (rbQPF.Checked)
            {
                oChapterSave.SaveQpfile(output.Text);
            }
            else if (rbXML.Checked)
            {
                oChapterSave.SaveXml(output.Text);
            }
            else
            {
                oChapterSave.SaveText(output.Text);
            }

            if (this.closeOnQueue.Checked)
            {
                this.Close();
            }
        }