public void SetData(object sender, RunWorkerCompletedEventArgs e) { SetToolStripProgressBarValue(0); SetToolStripLabelText(Extensions.GetStringValue(((ResultState)e.Result))); if (e.Result == null) { ResetCursor(Cursors.Default); return; } switch ((ResultState)e.Result) { case ResultState.FeatureCompleted: FeatureDataGridView.DataSource = _oEac3toInfo.Features; FeatureDataGridView.SelectionChanged += new System.EventHandler(this.FeatureDataGridView_SelectionChanged); StreamDataGridView.ClearSelection(); StreamDataGridView.DataSource = null; StreamDataGridView.Rows.Clear(); StreamDataGridView.DataSource = typeof(eac3to.Stream); ResetCursor(Cursors.Default); if (_oEac3toInfo.Features.Count == 1) { FeatureDataGridView.Rows[0].Selected = true; } break; case ResultState.StreamCompleted: if (FileSelection.Checked) { StreamDataGridView.DataSource = _oEac3toInfo.Features[0].Streams; } else { StreamDataGridView.DataSource = ((eac3to.Feature)FeatureDataGridView.SelectedRows[0].DataBoundItem).Streams; } SelectTracks(); ResetCursor(Cursors.Default); break; case ResultState.ExtractCompleted: QueueButton.Enabled = true; ResetCursor(Cursors.Default); break; } }
private void FeatureDataGridView_SelectionChanged(object sender, EventArgs e) { if (_oEac3toInfo.IsBusy()) // disallow selection change { return; } // only fire after the Databind has completed on grid and a row is selected if (FeatureDataGridView.Rows.Count != _oEac3toInfo.Features.Count || FeatureDataGridView.SelectedRows.Count != 1) { return; } Feature feature = FeatureDataGridView.SelectedRows[0].DataBoundItem as Feature; // Check for Streams if (feature.Streams != null && feature.Streams.Count > 0) { // use already collected streams StreamDataGridView.DataSource = feature.Streams; SelectTracks(); return; } // reset stream view StreamDataGridView.DataSource = null; StreamDataGridView.Rows.Clear(); StreamDataGridView.ClearSelection(); // create dummy input string for megui job if (feature.Description.Contains("EVO")) { if (feature.Description.Contains("+")) { if (FolderInputTextBox.Text.ToUpperInvariant().Contains("HVDVD_TS")) { dummyInput = FolderInputTextBox.Text.Substring(0, FolderInputTextBox.Text.IndexOf("HVDVD_TS")) + "HVDVD_TS\\" + feature.Description.Substring(0, feature.Description.IndexOf("+")); } else { dummyInput = FolderInputTextBox.Text + "HVDVD_TS\\" + feature.Description.Substring(0, feature.Description.IndexOf("+")); } } else { if (FolderInputTextBox.Text.ToUpperInvariant().Contains("HVDVD_TS")) { dummyInput = FolderInputTextBox.Text.Substring(0, FolderInputTextBox.Text.IndexOf("HVDVD_TS")) + "HVDVD_TS\\" + feature.Description.Substring(0, feature.Description.IndexOf(",")); } else { dummyInput = FolderInputTextBox.Text + "HVDVD_TS\\" + feature.Description.Substring(0, feature.Description.IndexOf(",")); } } } else if (feature.Description.Contains("(angle")) { dummyInput = getBDMVPath(FolderInputTextBox.Text, feature.Description.Substring(0, feature.Description.IndexOf(" ("))); } else if (MeGUI.core.util.FileUtil.RegExMatch(feature.Description, @"\A\d{5}\.mpls,", true)) { // e.g. "00017.mpls, 00018.m2ts, 1:28:39" found string des = feature.Description.Substring(0, feature.Description.IndexOf(",")); dummyInput = getBDMVPath(FolderInputTextBox.Text, des); } else if (feature.Description.Substring(feature.Description.LastIndexOf(".") + 1, 4) == "m2ts") { string des = feature.Description.Substring(feature.Description.IndexOf(",") + 2, feature.Description.LastIndexOf(",") - feature.Description.IndexOf(",") - 2); if (des.Contains("+")) // seamless branching { dummyInput = getBDMVPath(FolderInputTextBox.Text, feature.Description.Substring(0, feature.Description.IndexOf(","))); } else { dummyInput = getBDMVPath(FolderInputTextBox.Text, des); } } else { dummyInput = getBDMVPath(FolderInputTextBox.Text, feature.Description.Substring(0, feature.Description.IndexOf(","))); } ResetCursor(Cursors.WaitCursor); _oEac3toInfo.FetchStreamInformation(((Feature)FeatureDataGridView.SelectedRows[0].DataBoundItem).Number); }
private void FolderInputSourceButton_Click(object sender, EventArgs e) { string myinput = ""; string outputFolder = ""; DialogResult dr; input.Clear(); if (FolderSelection.Checked) { folderBrowserDialog1.SelectedPath = MainForm.Instance.Settings.Eac3toLastFolderPath; folderBrowserDialog1.Description = "Choose an input directory"; folderBrowserDialog1.ShowNewFolderButton = false; dr = folderBrowserDialog1.ShowDialog(); if (dr != DialogResult.OK) { return; } MainForm.Instance.Settings.Eac3toLastFolderPath = folderBrowserDialog1.SelectedPath; inputType = 1; if (folderBrowserDialog1.SelectedPath.EndsWith(":\\")) { myinput = folderBrowserDialog1.SelectedPath; } else { myinput = folderBrowserDialog1.SelectedPath + System.IO.Path.DirectorySeparatorChar; } outputFolder = myinput.Substring(0, myinput.LastIndexOf("\\") + 1); input.Add(myinput); } else { openFileDialog1.InitialDirectory = MainForm.Instance.Settings.Eac3toLastFilePath; dr = openFileDialog1.ShowDialog(); if (dr != DialogResult.OK) { return; } MainForm.Instance.Settings.Eac3toLastFilePath = System.IO.Path.GetDirectoryName(openFileDialog1.FileName); inputType = 2; int idx = 0; foreach (String file in openFileDialog1.FileNames) { if (idx == 0) { outputFolder = System.IO.Path.GetDirectoryName(file); myinput = file; input.Add(file); } else // seamless branching { myinput += "+" + file; input.Add(file); } idx++; } } FolderInputTextBox.Text = myinput; if (String.IsNullOrEmpty(FolderInputTextBox.Text)) { return; } if (String.IsNullOrEmpty(FolderOutputTextBox.Text)) { FolderOutputTextBox.Text = MeGUI.core.util.FileUtil.GetOutputFolder(outputFolder); if (!MeGUI.core.util.FileUtil.IsDirWriteable(FolderOutputTextBox.Text) && !String.IsNullOrEmpty(MainForm.Instance.Settings.Eac3toLastDestinationPath)) { FolderOutputTextBox.Text = MainForm.Instance.Settings.Eac3toLastDestinationPath; } } FeatureDataGridView.DataSource = null; FeatureDataGridView.Rows.Clear(); FeatureDataGridView.ClearSelection(); StreamDataGridView.DataSource = null; StreamDataGridView.Rows.Clear(); StreamDataGridView.ClearSelection(); _oEac3toInfo = new Eac3toInfo(input, null, null); _oEac3toInfo.FetchInformationCompleted += new OnFetchInformationCompletedHandler(SetData); _oEac3toInfo.ProgressChanged += new OnProgressChangedHandler(SetProgress); ResetCursor(Cursors.WaitCursor); _oEac3toInfo.FetchFeatureInformation(); }