diff options
author | brianmario <[email protected]> | 2007-07-13 21:11:32 +0000 |
---|---|---|
committer | brianmario <[email protected]> | 2007-07-13 21:11:32 +0000 |
commit | 95596c211c49e94f13ab67351de18b7e18baf887 (patch) | |
tree | 86c6ddf196de02dbae5f4e9357e8a80615b91282 /win/C#/Parsing | |
parent | 8cdcc31ffe5c609137526931a0bc2015c7a11bc2 (diff) |
forgot to check this in
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@678 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Parsing')
-rw-r--r-- | win/C#/Parsing/Parser.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/win/C#/Parsing/Parser.cs b/win/C#/Parsing/Parser.cs new file mode 100644 index 000000000..7cda4178c --- /dev/null +++ b/win/C#/Parsing/Parser.cs @@ -0,0 +1,56 @@ +using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+
+namespace Handbrake.Parsing
+{
+ public delegate void DataReadEventHandler(object Sender, string Data);
+ /// <summary>
+ /// A simple wrapper around a StreamReader to keep track of the entire output from a cli process
+ /// </summary>
+ internal class Parser : StreamReader
+ {
+ /// <summary>
+ /// The output from the CLI process
+ /// </summary>
+ private string m_buffer;
+ public string Buffer
+ {
+ get
+ {
+ return this.m_buffer;
+ }
+ }
+
+ public static event DataReadEventHandler OnReadLine;
+ public static event DataReadEventHandler OnReadToEnd;
+
+ public Parser(Stream baseStream) : base(baseStream)
+ {
+ this.m_buffer = string.Empty;
+ }
+
+ public override string ReadLine()
+ {
+ string tmp = base.ReadLine();
+ this.m_buffer += tmp;
+ if (OnReadLine != null)
+ {
+ OnReadLine(this, tmp);
+ }
+ return tmp;
+ }
+
+ public override string ReadToEnd()
+ {
+ string tmp = base.ReadToEnd();
+ this.m_buffer += tmp;
+ if (OnReadToEnd != null)
+ {
+ OnReadToEnd(this, tmp);
+ }
+ return tmp;
+ }
+ }
+}
|