summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-03-02 19:38:24 +0000
committersr55 <[email protected]>2013-03-02 19:38:24 +0000
commit76d7ab1861dbc85eb3e8ad35d365a35b4b681a96 (patch)
tree4c56986f82d4336cce37960fc8be15969bb576d0 /win
parent09843340c7c998e360bcc879674c0646f379077d (diff)
WinGui: Update the scan parser to handle the new scan progress meter.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5283 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs6
-rw-r--r--win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs13
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs6
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs4
4 files changed, 19 insertions, 10 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs b/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs
index fd0d01fe3..ff84bd7d5 100644
--- a/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs
+++ b/win/CS/HandBrake.ApplicationServices/EventArgs/ScanProgressEventArgs.cs
@@ -29,5 +29,11 @@ namespace HandBrake.ApplicationServices.EventArgs
/// </summary>
[DataMember]
public int Titles { get; set; }
+
+ /// <summary>
+ /// Gets or sets the percentage.
+ /// </summary>
+ [DataMember]
+ public decimal Percentage { get; set; }
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs
index f17a6a51b..82b339278 100644
--- a/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs
+++ b/win/CS/HandBrake.ApplicationServices/Parsing/Parser.cs
@@ -28,7 +28,8 @@ namespace HandBrake.ApplicationServices.Parsing
/// <param name="sender">The object who's raising the event</param>
/// <param name="currentTitle">The title number currently being processed</param>
/// <param name="titleCount">The total number of titiles to be processed</param>
- public delegate void ScanProgressEventHandler(object sender, int currentTitle, int titleCount);
+ /// <param name="percentage">Percentage complete.</param>
+ public delegate void ScanProgressEventHandler(object sender, int currentTitle, int titleCount, decimal percentage);
/// <summary>
/// A delegate to handle encode progress updates // EXPERIMENTAL
@@ -97,18 +98,18 @@ namespace HandBrake.ApplicationServices.Parsing
{
string tmp = base.ReadLine();
- buffer.Append(tmp + Environment.NewLine);
-
Match m = null;
- if (tmp.Contains("Scanning title"))
- m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)");
+ if (tmp != null && tmp.Contains("Scanning title"))
+ m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)([a-z0-9 ,]*), ([0-9.]*)");
+ else if (!string.IsNullOrEmpty(tmp))
+ buffer.Append(tmp + Environment.NewLine);
if (OnReadLine != null)
OnReadLine(this, tmp);
if (m != null)
if (m.Success && OnScanProgress != null)
- OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
+ OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value), decimal.Parse(m.Groups[4].Value));
return tmp;
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index cc99b916b..40329f14d 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -370,12 +370,14 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="sender">the sender</param>
/// <param name="currentTitle">the current title being scanned</param>
/// <param name="titleCount">the total number of titles</param>
- private void OnScanProgress(object sender, int currentTitle, int titleCount)
+ /// <param name="percentage">The Percentage</param>
+ private void OnScanProgress(object sender, int currentTitle, int titleCount, decimal percentage)
{
ScanProgressEventArgs eventArgs = new ScanProgressEventArgs
{
CurrentTitle = currentTitle,
- Titles = titleCount
+ Titles = titleCount,
+ Percentage = percentage
};
if (this.ScanStatusChanged != null)
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 3ae4f9d58..c837627c4 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -1703,8 +1703,8 @@ namespace HandBrakeWPF.ViewModels
/// </param>
private void ScanStatusChanged(object sender, HandBrake.ApplicationServices.EventArgs.ScanProgressEventArgs e)
{
- this.SourceLabel = "Scanning Title " + e.CurrentTitle + " of " + e.Titles;
- this.StatusLabel = "Scanning Title " + e.CurrentTitle + " of " + e.Titles;
+ this.SourceLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage);
+ this.StatusLabel = string.Format("Scanning Title {0} of {1} ({2}%)", e.CurrentTitle, e.Titles, e.Percentage);
}
/// <summary>