private void backgroundWorkerMain_DoWork(object sender, DoWorkEventArgs e) { BackGroundWorkerInitInfo initInfo = (BackGroundWorkerInitInfo)e.Argument; TransportStreamParser tsParser = new TransportStreamParser(); tsParser.Parse(initInfo.SourceFile, (pos, total) => UpdateProgressBackground(pos, total, "Parsing Transport Stream file. Please wait...")); if (initInfo.CreateHtmlFiles) { foreach (KeyValuePair <int, List <DvbSubPes> > item in tsParser.SubtitlesLookup) { string res = "<html><body>"; res += GetHtmlPid(item); res += "</body></html>"; //TODO change to "next to video file" string outFile = Path.GetDirectoryName(initInfo.SourceFile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(initInfo.SourceFile) + "_(PID" + item.Key.ToString() + ").html"; File.WriteAllText(outFile, res); } } e.Result = tsParser; }
private void DoIt(string Filepath) { // check that the file is there if (!(File.Exists(Filepath))) { MessageBox.Show("File not found \"" + Filepath + "\""); return; } this.splitContainerMaIN.Visible = false; this.progressBarLoading.Value = this.progressBarLoading.Minimum; this.progressBarLoading.Visible = true; _currentFile = Filepath; this.Text = TITLEBAR + " - Opening " + _currentFile; // run in background BackGroundWorkerInitInfo initInfo = new BackGroundWorkerInitInfo { SourceFile = Filepath, CreateHtmlFiles = this.checkBoxCreateHTML.Checked }; this.backgroundWorkerMain.RunWorkerAsync(initInfo); }