private void backgroundWorkerMain_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; MkvExtractProgress progress = new MkvExtractProgress(); progress.MaxEpisode = selectedMkvFiles.Count; foreach (string file in selectedMkvFiles) { progress.CurEpisode++; List <MkvTrack> tracks = null; if (trackTypeToExtract == "All subtitle tracks") { tracks = UtilsMkv.getSubtitleTrackList(file); } else if (trackTypeToExtract == "All audio tracks") { tracks = UtilsMkv.getAudioTrackList(file); } else { tracks = UtilsMkv.getTrackList(file); } progress.CurTrack = 0; progress.MaxTrack = tracks.Count; foreach (MkvTrack track in tracks) { if (worker.CancellationPending) { e.Cancel = true; return; } progress.CurTrack++; worker.ReportProgress(0, progress); string displayLang = UtilsLang.LangThreeLetter2Full(track.Lang); if (displayLang == "") { displayLang = "Unknown"; } string fileName = $"{outDir}{Path.DirectorySeparatorChar}{Path.GetFileNameWithoutExtension(file)} - Track {Convert.ToInt32(track.TrackID):00} - {displayLang}.{track.Extension}"; UtilsMkv.extractTrack(file, track.TrackID, fileName); } } }
private void backgroundWorkerMain_DoWork(object sender, DoWorkEventArgs e) { string tempFileName = ConstantSettings.TempMkvExtractSubs1Filename; if (subsNum == 2) { tempFileName = ConstantSettings.TempMkvExtractSubs2Filename; } ExtractedFile = $"{Path.GetTempPath()}{tempFileName}.{selectedTrack.Extension}"; UtilsMkv.extractTrack(mvkFile, selectedTrack.TrackID, ExtractedFile); // The subs1 and subs2 textboxes, take .idx files rather than .sub files if (Path.GetExtension(ExtractedFile) == ".sub") { ExtractedFile = Path.ChangeExtension(ExtractedFile, ".idx"); } }
private void backgroundWorkerMain_DoWork(object sender, DoWorkEventArgs e) { string tempFileName = ConstantSettings.TempMkvExtractSubs1Filename; if (subsNum == 2) { tempFileName = ConstantSettings.TempMkvExtractSubs2Filename; } this.ExtractedFile = String.Format("{0}{1}.{2}", Path.GetTempPath(), tempFileName, this.selectedTrack.Extension); UtilsMkv.extractTrack(this.mvkFile, this.selectedTrack.TrackID, this.ExtractedFile); // The subs1 and subs2 textboxes, take .idx files rather than .sub files if (Path.GetExtension(this.ExtractedFile) == ".sub") { this.ExtractedFile = Path.ChangeExtension(this.ExtractedFile, ".idx"); } }