From 0ed5feb96b620d4e5c75e6a1891052cc6c7274d5 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 10 Mar 2021 19:11:31 -0800 Subject: [PATCH] Support a new Matcher for DIC DVD --- CHANGELIST.md | 1 + MPF/UserControls/LogOutput.xaml.cs | 34 +++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 3619f93a..56eecb1a 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -37,6 +37,7 @@ - VideoNow discs are audio only - Hook up default system in options - Make inner and outer layers in UI and outputs more clear +- Program output to log by default, setting otherwise ### 1.18 (2020-11-10) - Add more information extraction and generation for Aaru diff --git a/MPF/UserControls/LogOutput.xaml.cs b/MPF/UserControls/LogOutput.xaml.cs index 09a9a394..3032b46d 100644 --- a/MPF/UserControls/LogOutput.xaml.cs +++ b/MPF/UserControls/LogOutput.xaml.cs @@ -16,6 +16,8 @@ namespace MPF.UserControls private Paragraph _paragraph; private readonly List _matchers; + private const string DiscImageCreatorProgressPattern = @"\s*(\d+)\/\s*(\d+)$"; + public LogOutput() { InitializeComponent(); @@ -77,7 +79,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Checking SubQ adr (Track)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -89,7 +91,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Checking SubQ ctl (Track)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -101,7 +103,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Checking SubRtoW (Track)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -111,13 +113,25 @@ namespace MPF.UserControls } })); + _matchers.Add(new Matcher( + "Reading DirectoryRecord", + DiscImageCreatorProgressPattern, + match => { + if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) + { + float percentProgress = (current / (float)total) * 100; + ProgressBar.Value = percentProgress; + ProgressLabel.Text = string.Format("Reading directory records... ({0:##.##}%)", percentProgress); + } + })); + #endregion #region Dumping _matchers.Add(new Matcher( @"Creating iso(LBA)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -129,7 +143,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( @"Creating .scm (LBA)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -145,7 +159,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Descrambling data sector of img (LBA)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -157,7 +171,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Checking sectors (LBA)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -169,7 +183,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Creating bin (Track)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -181,7 +195,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Creating cue and ccd (Track)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) { @@ -193,7 +207,7 @@ namespace MPF.UserControls _matchers.Add(new Matcher( "Scanning sector (LBA)", - @"\s*(\d+)\/\s*(\d+)$", + DiscImageCreatorProgressPattern, match => { if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total)) {