diff options
author | brianmario <[email protected]> | 2007-07-18 19:24:04 +0000 |
---|---|---|
committer | brianmario <[email protected]> | 2007-07-18 19:24:04 +0000 |
commit | a86e63089a22839b51890db36481c88e25a0a0c6 (patch) | |
tree | 837935de2c825a1b47bb8dae89cfaa2f34ddda11 /win/C#/Parsing/Parser.cs | |
parent | cdac5d3a33743512011783afc9dd7f90c4f3a762 (diff) |
WinGui:
added OnScanProgress event to Parser class which is raised upon noticing "Scanning title # of #..." in the output
added progress bar to frmReadDVD to give better visual notification of scan progress
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@711 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Parsing/Parser.cs')
-rw-r--r-- | win/C#/Parsing/Parser.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs index 8c3c24b3e..ef6476f78 100644 --- a/win/C#/Parsing/Parser.cs +++ b/win/C#/Parsing/Parser.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic;
using System.Text;
using System.IO;
+using System.Text.RegularExpressions;
namespace Handbrake.Parsing
{
@@ -12,6 +13,8 @@ namespace Handbrake.Parsing /// <param name="Data">The data parsed from the stream</param>
public delegate void DataReadEventHandler(object Sender, string Data);
+ public delegate void ScanProgressEventHandler(object Sender, int CurrentTitle, int TitleCount);
+
/// <summary>
/// A simple wrapper around a StreamReader to keep track of the entire output from a cli process
/// </summary>
@@ -39,6 +42,8 @@ namespace Handbrake.Parsing /// </summary>
public static event DataReadEventHandler OnReadToEnd;
+ public static event ScanProgressEventHandler OnScanProgress;
+
/// <summary>
/// Default constructor for this object
/// </summary>
@@ -52,10 +57,15 @@ namespace Handbrake.Parsing {
string tmp = base.ReadLine();
this.m_buffer += tmp;
+ Match m = Regex.Match(tmp, "^Scanning title ([0-9]*) of ([0-9]*)");
if (OnReadLine != null)
{
OnReadLine(this, tmp);
}
+ if (m.Success && OnScanProgress != null)
+ {
+ OnScanProgress(this, int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
+ }
return tmp;
}
|