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; } }
void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled && _log != null) { _log.Error("Work was cancelled"); } if (e.Error != null && _log != null) { _log.LogValue("Error running job", e); } if (e.Result != null) { if (_log != null) { _log.LogEvent(Extensions.GetStringValue(((ResultState)e.Result))); } if (bFetchAll) { if (features.Count > 0 && iFeatureToFetch < features.Count) { FetchStreamInformation(++iFeatureToFetch); return; } else { bFetchAll = false; } } } if (this.FetchInformationCompleted != null) { this.FetchInformationCompleted.Invoke(this, e); } }
private string GenerateArguments() { StringBuilder sb = new StringBuilder(); foreach (DataGridViewRow row in StreamDataGridView.Rows) { Stream stream = row.DataBoundItem as Stream; DataGridViewCheckBoxCell extractStream = row.Cells["StreamExtractCheckBox"] as DataGridViewCheckBoxCell; if (extractStream.Value != null && int.Parse(extractStream.Value.ToString()) == 1) { if (row.Cells["StreamExtractAsComboBox"].Value == null) { throw new ApplicationException(string.Format("Specify an extraction type for stream:\r\n\n\t{0}: {1}", stream.Number, stream.Name)); } if (FolderSelection.Checked) { sb.Append(string.Format("{0}:\"{1}\" {2} ", stream.Number, System.IO.Path.Combine(FolderOutputTextBox.Text, string.Format("F{0}_T{1}_{2} - {3}.{4}", ((Feature)FeatureDataGridView.SelectedRows[0].DataBoundItem).Number, stream.Number, Extensions.GetStringValue(stream.Type), row.Cells["languageDataGridViewTextBoxColumn"].Value, (row.Cells["StreamExtractAsComboBox"].Value).ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture))), row.Cells["StreamAddOptionsTextBox"].Value).Trim()); } else { sb.Append(string.Format("{0}:\"{1}\" {2} ", stream.Number, System.IO.Path.Combine(FolderOutputTextBox.Text, string.Format("T{0}_{1} - {2}.{3}", stream.Number, Extensions.GetStringValue(stream.Type), row.Cells["languageDataGridViewTextBoxColumn"].Value, (row.Cells["StreamExtractAsComboBox"].Value).ToString().ToLower(System.Globalization.CultureInfo.InvariantCulture))), row.Cells["StreamAddOptionsTextBox"].Value).Trim()); } if (row.Cells["StreamExtractAsComboBox"].Value.Equals(AudioCodec.DTS.ID)) { sb.Append(" -core"); } sb.Append(" "); } } return(sb.ToString()); }
private string GenerateArguments() { string filePrefix = string.Empty; if (MainForm.Instance.Settings.Eac3toAddPrefix) { if (FolderSelection.Checked) { filePrefix = MeGUI.core.util.FileUtil.GetOutputFilePrefix(dummyInput); } else { filePrefix = System.IO.Path.GetFileNameWithoutExtension(input[0]) + "_"; } } StringBuilder sb = new StringBuilder(); foreach (DataGridViewRow row in StreamDataGridView.Rows) { Stream stream = row.DataBoundItem as Stream; if (stream.Type == eac3to.StreamType.Unknown) { continue; } DataGridViewCheckBoxCell extractStream = row.Cells["StreamExtractCheckBox"] as DataGridViewCheckBoxCell; if (extractStream.Value == null || int.Parse(extractStream.Value.ToString()) != 1) { continue; } string strExtension = row.Cells["StreamExtractAsComboBox"].Value.ToString().ToLowerInvariant(); if (strExtension.ToUpperInvariant().EndsWith("_CORE")) { strExtension = strExtension.Substring(0, strExtension.Length - 5); } if (row.Cells["StreamExtractAsComboBox"].Value == null) { throw new ApplicationException(string.Format("Specify an extraction type for stream:\r\n\n\t{0}: {1}", stream.Number, stream.Description)); } if (FolderSelection.Checked) { sb.Append(string.Format("{0}:\"{1}\" {2} ", stream.Number, System.IO.Path.Combine(FolderOutputTextBox.Text, string.Format("{0}F{1}_T{2}_{3} - {4}.{5}", filePrefix, ((Feature)FeatureDataGridView.SelectedRows[0].DataBoundItem).Number, stream.Number, Extensions.GetStringValue(stream.Type), row.Cells["languageDataGridViewTextBoxColumn"].Value, strExtension)), row.Cells["StreamAddOptionsTextBox"].Value).Trim()); } else { sb.Append(string.Format("{0}:\"{1}\" {2} ", stream.Number, System.IO.Path.Combine(FolderOutputTextBox.Text, string.Format("{0}T{1}_{2} - {3}.{4}", filePrefix, stream.Number, Extensions.GetStringValue(stream.Type), row.Cells["languageDataGridViewTextBoxColumn"].Value, strExtension)), row.Cells["StreamAddOptionsTextBox"].Value).Trim()); } if (stream.Type == eac3to.StreamType.Audio) { if (((string)row.Cells["StreamExtractAsComboBox"].Value).EndsWith("_CORE")) { sb.Append(" -core"); } else if (((AudioStream)stream).HasDialNorm) { sb.Append(" -keepDialnorm"); } } sb.Append(" "); } return(sb.ToString()); }