private void buttonImport_Click(object sender, EventArgs e) { using (var openFileDialog = new OpenFileDialog { Filter = "se-job files|*.se-job" }) { if (openFileDialog.ShowDialog() != DialogResult.OK) { return; } var seJob = SeJobHandler.LoadSeJob(FileUtil.ReadAllBytesShared(openFileDialog.FileName)); if (seJob == null) { return; } textBoxJobId.Text = seJob.JobId; textBoxJobName.Text = seJob.JobName; textBoxJobDescription.Text = seJob.Message; textBoxSubtitleFileName.Text = seJob.SubtitleFileName; textBoxVideoUrl.Text = seJob.VideoStreamingUrl; checkBoxIncludeWaveform.Checked = seJob.Waveform?.PeakMins.Count > 0; checkBoxIncludeShotChanges.Checked = seJob.ShotChanges?.Count > 0; _waveform = seJob.Waveform; _shotChanges = seJob.ShotChanges; checkBoxIncludeRules.Checked = seJob.Rules != null; if (seJob.Rules != null) { numericUpDownMaxNumberOfLines.Value = seJob.Rules.MaxNumberOfLines; numericUpDownSubtitleLineMaximumLength.Value = seJob.Rules.SubtitleLineMaximumLength; numericUpDownMaxCharsSec.Value = seJob.Rules.SubtitleMaximumCharactersPerSeconds; numericUpDownDurationMin.Value = seJob.Rules.SubtitleMinimumDisplayMilliseconds; numericUpDownDurationMax.Value = seJob.Rules.SubtitleMaximumDisplayMilliseconds; numericUpDownMinGapMs.Value = seJob.Rules.MinimumMillisecondsBetweenLines; numericUpDownMaxWordsMin.Value = seJob.Rules.SubtitleMaximumWordsPerMinute; numericUpDownOptimalCharsSec.Value = seJob.Rules.SubtitleOptimalCharactersPerSeconds; } _subtitle = new Subtitle(); if (!string.IsNullOrEmpty(seJob.SubtitleFileFormat) && !string.IsNullOrEmpty(seJob.SubtitleContent)) { var format = SubtitleFormat.AllSubtitleFormats.FirstOrDefault(p => p.Name == seJob.SubtitleFileFormat); format?.LoadSubtitle(_subtitle, seJob.SubtitleContent.SplitToLines(), string.Empty); } if (!string.IsNullOrEmpty(seJob.SubtitleFileFormat) && !string.IsNullOrEmpty(seJob.SubtitleContentOriginal)) { _subtitleOriginal = new Subtitle(); var format = SubtitleFormat.AllSubtitleFormats.FirstOrDefault(p => p.Name == seJob.SubtitleFileFormat); format?.LoadSubtitle(_subtitleOriginal, seJob.SubtitleContentOriginal.SplitToLines(), string.Empty); } UpdateUiAfterLoad(); } }
public SeJobExport( Subtitle subtitle, Subtitle subtitleOriginal, SubtitleFormat subtitleFormat, string videoFileName, WavePeakData waveform, List <double> shotChanges) { InitializeComponent(); _subtitle = subtitle; _subtitleOriginal = subtitleOriginal; _subtitleFormat = subtitleFormat; _videoFileName = videoFileName; if (waveform != null) { _waveform = new SeJobWaveform { SampleRate = waveform.SampleRate, HighestPeak = waveform.HighestPeak, PeakMins = waveform.Peaks.Select(p => p.Min).ToList(), PeakMaxs = waveform.Peaks.Select(p => p.Max).ToList(), }; } _shotChanges = shotChanges; textBoxJobId.Text = Guid.NewGuid().ToString(); textBoxSubtitleFileName.Text = Path.GetFileName(_subtitle?.FileName); numericUpDownMaxNumberOfLines.Value = Configuration.Settings.General.MaxNumberOfLines; numericUpDownSubtitleLineMaximumLength.Value = Configuration.Settings.General.SubtitleLineMaximumLength; numericUpDownMaxCharsSec.Value = (decimal)Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds; numericUpDownDurationMin.Value = Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds; numericUpDownDurationMax.Value = Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds; numericUpDownMinGapMs.Value = Configuration.Settings.General.MinimumMillisecondsBetweenLines; numericUpDownMaxWordsMin.Value = (decimal)Configuration.Settings.General.SubtitleMaximumWordsPerMinute; numericUpDownOptimalCharsSec.Value = (decimal)Configuration.Settings.General.SubtitleOptimalCharactersPerSeconds; UpdateUiAfterLoad(); }