private void HandleBtnViewLogs() { if (!this.IsScreenValid()) { return; } gbScreen.SetEnabled(false); List <X264LogFile> logFiles = new List <X264LogFile>(); foreach (X264LogFile log in _bindingListLogFiles) { logFiles.Add(new X264LogFile() { FileNameOnly = log.FileNameOnly, FilePath = log.FilePath }); } IX264LogLineItemIdentifierService x264LogLineItemIdentifierService = new X264LogLineItemIdentifierService(); X264LogFileSettings settings = new X264LogFileSettings() { BBCodeBoldLogFileName = chkBBCodeBoldLogFileName.Checked, BBCodeHiddenAroundLogs = chkBBCodeHidden.Checked }; X264LogParserService parserService = new X264LogParserService(x264LogLineItemIdentifierService, settings, logFiles); bgwLogFiles.RunWorkerAsync(parserService); }
private void bgwLogFiles_DoWork(object sender, DoWorkEventArgs e) { X264LogParserService parserService = e.Argument as X264LogParserService; parserService.GetLogs(); e.Result = parserService; }
private void bgwLogFiles_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { string logs = string.Empty; gbScreen.SetEnabled(true); X264LogParserService parserService = e.Result as X264LogParserService; if (parserService.Errors.Count() == 0) { logs = parserService.Logs; X264LogFileDisplayForm form = new X264LogFileDisplayForm(); form.SetLogs(logs); form.ShowDialog(); } else { MessageBox.Show(parserService.Errors[0].Description, "Errors occurred", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void Main(string[] args) { //line item identifier service used to identify the line type read from log file IX264LogLineItemIdentifierService x264LogLineItemIdentifierService = new X264LogLineItemIdentifierService(); //x264 log file settings X264LogFileSettings x264LogFileSerttings = new X264LogFileSettings() { BBCodeBoldLogFileName = true, BBCodeHiddenAroundLogs = true }; //log files List <X264LogFile> logFiles = new List <X264LogFile>() { new X264LogFile() { FileNameOnly = "Les Revenants S02E01 The Child 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E01 The Child 720p BluRay DTS x264.mkv.x264.log" }, new X264LogFile() { FileNameOnly = "Les Revenants S02E02 Milan 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E02 Milan 720p BluRay DTS x264.mkv.x264.log" }, new X264LogFile() { FileNameOnly = "Les Revenants S02E03 Morgane 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E03 Morgane 720p BluRay DTS x264.mkv.x264.log" }, new X264LogFile() { FileNameOnly = "Les Revenants S02E04 Virgil 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E04 Virgil 720p BluRay DTS x264.mkv.x264.log" }, new X264LogFile() { FileNameOnly = "Les Revenants S02E05 Madame Costa 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E05 Madame Costa 720p BluRay DTS x264.mkv.x264.log" }, new X264LogFile() { FileNameOnly = "Les Revenants S02E06 Esther 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E06 Esther 720p BluRay DTS x264.mkv.x264.log" }, new X264LogFile() { FileNameOnly = "Les Revenants S02E07 Étienne 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E07 Étienne 720p BluRay DTS x264.mkv.x264.log" }, new X264LogFile() { FileNameOnly = "Les Revenants S02E08 Les Revenants 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E08 Les Revenants 720p BluRay DTS x264.mkv.x264.log" } }; //parser service IX264LogParserService parserService = new X264LogParserService(x264LogLineItemIdentifierService, x264LogFileSerttings, logFiles); Stopwatch watch = new Stopwatch(); watch.Start(); //get log text string logs = parserService.GetLogs(); if (parserService.Errors.Count() == 0) { System.Console.WriteLine(logs); } else { System.Console.WriteLine(parserService.Errors[0].Description); } watch.Stop(); System.Console.WriteLine(string.Format("The process took {0} seconds", watch.Elapsed.TotalSeconds.ToString())); System.Console.ReadLine(); }