private void FeatureDataGridView_SelectionChanged(object sender, EventArgs e)
        {
            // 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)
            {
                if (_oEac3toInfo.IsBusy()) // disallow selection change
                {
                    this.FeatureDataGridView.SelectionChanged -= new System.EventHandler(this.FeatureDataGridView_SelectionChanged);

                    FeatureDataGridView.CurrentRow.Selected = false;
                    FeatureDataGridView.Rows[int.Parse(FeatureDataGridView.Tag.ToString())].Selected = true;

                    this.FeatureDataGridView.SelectionChanged += new System.EventHandler(this.FeatureDataGridView_SelectionChanged);
                }
                else // backgroundworker is not busy, allow selection change
                {
                    Feature feature = FeatureDataGridView.SelectedRows[0].DataBoundItem as Feature;

                    // Check for Streams
                    if (feature.Streams == null || feature.Streams.Count == 0)
                    {
                        //args.workingFolder = string.IsNullOrEmpty(FolderOutputTextBox.Text) ? FolderOutputTextBox.Text : System.IO.Path.GetDirectoryName(args.eac3toPath);

                        // create dummy input string for megui job
                        if (feature.Description.Contains("EVO"))
                        {
                            if (FolderInputTextBox.Text.ToUpper(System.Globalization.CultureInfo.InvariantCulture).Contains("HVDVD_TS"))
                            {
                                dummyInput = FolderInputTextBox.Text + 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"))
                        {
                            if (FolderInputTextBox.Text.ToUpper(System.Globalization.CultureInfo.InvariantCulture).Contains("BDMV\\PLAYLIST"))
                            {
                                dummyInput = FolderInputTextBox.Text + feature.Description.Substring(0, feature.Description.IndexOf(" ("));
                            }
                            else if (FolderInputTextBox.Text.ToUpper(System.Globalization.CultureInfo.InvariantCulture).Contains("BDMV\\STREAM"))
                            {
                                dummyInput = FolderInputTextBox.Text.Substring(0, FolderInputTextBox.Text.LastIndexOf("BDMV")) + "BDMV\\PLAYLIST\\" + feature.Description.Substring(0, feature.Description.IndexOf(" ("));
                            }
                            else
                            {
                                dummyInput = FolderInputTextBox.Text + "BDMV\\PLAYLIST\\" + feature.Description.Substring(0, feature.Description.IndexOf(" ("));
                            }
                        }
                        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
                            {
                                if (FolderInputTextBox.Text.ToUpper(System.Globalization.CultureInfo.InvariantCulture).Contains("BDMV\\STREAM"))
                                {
                                    dummyInput = FolderInputTextBox.Text.Substring(0, FolderInputTextBox.Text.IndexOf("BDMV")) + "BDMV\\PLAYLIST\\" + feature.Description.Substring(0, feature.Description.IndexOf(","));
                                }
                                else
                                {
                                    dummyInput = FolderInputTextBox.Text + "BDMV\\PLAYLIST\\" + feature.Description.Substring(0, feature.Description.IndexOf(","));
                                }
                            }
                            else
                            {
                                if (FolderInputTextBox.Text.ToUpper(System.Globalization.CultureInfo.InvariantCulture).Contains("BDMV\\STREAM"))
                                {
                                    dummyInput = FolderInputTextBox.Text + des;
                                }
                                else
                                {
                                    dummyInput = FolderInputTextBox.Text + "BDMV\\STREAM\\" + des;
                                }
                            }
                        }
                        else
                        {
                            if (FolderInputTextBox.Text.ToUpper(System.Globalization.CultureInfo.InvariantCulture).Contains("BDMV\\PLAYLIST"))
                            {
                                dummyInput = FolderInputTextBox.Text + feature.Description.Substring(0, feature.Description.IndexOf(","));
                            }
                            else
                            {
                                dummyInput = FolderInputTextBox.Text + "BDMV\\PLAYLIST\\" + feature.Description.Substring(0, feature.Description.IndexOf(","));
                            }
                        }

                        Cursor = Cursors.WaitCursor;
                        _oEac3toInfo.FetchStreamInformation(((Feature)FeatureDataGridView.SelectedRows[0].DataBoundItem).Number);
                    }
                    else // use already collected streams
                    {
                        StreamDataGridView.DataSource = feature.Streams;
                        SelectTracks();
                    }
                }
            }
        }
Beispiel #2
0
        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);
        }