diff options
author | sr55 <[email protected]> | 2012-10-07 19:04:49 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2012-10-07 19:04:49 +0000 |
commit | 6171d00692520927dc2fcc9bb43106bda15803b6 (patch) | |
tree | 3c9e846fa904ad66789d8104fe86acbbaffe034e | |
parent | 5a3ba3bfe9121d14a691441093f0d191d4410be5 (diff) |
WinGui: API Tidyup Part 1 of many
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5007 b64f7644-9d1e-0410-96f1-a4d463321fa5
8 files changed, 28 insertions, 75 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs index 6806e2844..3ddae9b1f 100644 --- a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs +++ b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs @@ -146,16 +146,6 @@ namespace HandBrake.ApplicationServices.Isolation }
/// <summary>
- /// Attempt to Safely kill a DirectRun() CLI
- /// NOTE: This will not work with a MinGW CLI
- /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
- /// </summary>
- public void SafelyStop()
- {
- ThreadPool.QueueUserWorkItem(delegate { this.Service.StopEncode(); });
- }
-
- /// <summary>
/// Start with a LibHb EncodeJob Object
/// </summary>
/// <param name="job">
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Source.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Source.cs index 7b63ec149..93aa13a0c 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Source.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Source.cs @@ -49,18 +49,20 @@ namespace HandBrake.ApplicationServices.Parsing /// <param name="output">
/// The output.
/// </param>
- /// <param name="userSettingService"> </param>
+ /// <param name="isDvdNavDisabled">
+ /// The is Dvd Nav Disabled.
+ /// </param>
/// <returns>
/// A DVD object which contains a list of title inforamtion
/// </returns>
- public static Source Parse(StreamReader output, IUserSettingService userSettingService)
+ public static Source Parse(StreamReader output, bool isDvdNavDisabled)
{
var thisDVD = new Source();
while (!output.EndOfStream)
{
if ((char) output.Peek() == '+')
- thisDVD.Titles.AddRange(Title.ParseList(output.ReadToEnd(), userSettingService));
+ thisDVD.Titles.AddRange(Title.ParseList(output.ReadToEnd(), isDvdNavDisabled));
else
output.ReadLine();
}
diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs index f19861cfd..04d00c1f2 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Title.cs @@ -123,13 +123,13 @@ namespace HandBrake.ApplicationServices.Parsing /// <param name="output">
/// A StringReader of output data
/// </param>
- /// <param name="userSettingService">
- /// The user Setting Service.
+ /// <param name="isDvdNavDisabled">
+ /// The is Dvd Nav Disabled.
/// </param>
/// <returns>
/// A Title Object
/// </returns>
- public static Title Parse(StringReader output, IUserSettingService userSettingService)
+ public static Title Parse(StringReader output, bool isDvdNavDisabled)
{
var thisTitle = new Title();
string nextLine = output.ReadLine();
@@ -172,7 +172,7 @@ namespace HandBrake.ApplicationServices.Parsing }
// Multi-Angle Support if LibDvdNav is enabled
- if (!userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav))
+ if (!isDvdNavDisabled)
{
m = Regex.Match(nextLine, @" \+ angle\(s\) ([0-9])");
if (m.Success)
@@ -229,13 +229,13 @@ namespace HandBrake.ApplicationServices.Parsing /// <param name="output">
/// The Output
/// </param>
- /// <param name="userSettingService">
- /// The user Setting Service.
+ /// <param name="isDvdNavDisabled">
+ /// The is Dvd Nav Disabled.
/// </param>
/// <returns>
/// A List of titles
/// </returns>
- public static Title[] ParseList(string output, IUserSettingService userSettingService)
+ public static Title[] ParseList(string output, bool isDvdNavDisabled)
{
var titles = new List<Title>();
var sr = new StringReader(output);
@@ -246,7 +246,7 @@ namespace HandBrake.ApplicationServices.Parsing if (sr.Peek() == ' ') // If the character is a space, then chances are it's the combing detected line.
sr.ReadLine(); // Skip over it
else
- titles.Add(Parse(sr, userSettingService));
+ titles.Add(Parse(sr, isDvdNavDisabled));
}
return titles.ToArray();
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs index ced71d4eb..6a9717ef8 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs @@ -147,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services.Base /// <param name="e">
/// The EncodeProgressEventArgs.
/// </param>
- public void Invoke_encodeStatusChanged(EncodeProgressEventArgs e)
+ public void InvokeEncodeStatusChanged(EncodeProgressEventArgs e)
{
EncodeProgessStatus handler = this.EncodeStatusChanged;
if (handler != null)
@@ -162,7 +162,7 @@ namespace HandBrake.ApplicationServices.Services.Base /// <param name="e">
/// The EncodeCompletedEventArgs.
/// </param>
- public void Invoke_encodeCompleted(EncodeCompletedEventArgs e)
+ public void InvokeEncodeCompleted(EncodeCompletedEventArgs e)
{
EncodeCompletedStatus handler = this.EncodeCompleted;
if (handler != null)
@@ -177,7 +177,7 @@ namespace HandBrake.ApplicationServices.Services.Base /// <param name="e">
/// The EventArgs.
/// </param>
- public void Invoke_encodeStarted(EventArgs e)
+ public void InvokeEncodeStarted(EventArgs e)
{
EventHandler handler = this.EncodeStarted;
if (handler != null)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs index 49ff66bd2..18457af85 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs @@ -195,12 +195,12 @@ namespace HandBrake.ApplicationServices.Services }
// Fire the Encode Started Event
- this.Invoke_encodeStarted(EventArgs.Empty);
+ this.InvokeEncodeStarted(EventArgs.Empty);
}
catch (Exception exc)
{
encodeQueueTask.Status = QueueItemStatus.Error;
- this.Invoke_encodeCompleted(
+ this.InvokeEncodeCompleted(
new EncodeCompletedEventArgs(
false, null, "An Error occured when trying to encode this source. "));
throw;
@@ -236,35 +236,13 @@ namespace HandBrake.ApplicationServices.Services // No need to report anything to the user. If it fails, it's probably already stopped.
}
- this.Invoke_encodeCompleted(
+ this.InvokeEncodeCompleted(
exc == null
? new EncodeCompletedEventArgs(true, null, string.Empty)
: new EncodeCompletedEventArgs(false, exc, "An Unknown Error has occured when trying to Stop this encode."));
}
/// <summary>
- /// Attempt to Safely kill a DirectRun() CLI
- /// NOTE: This will not work with a MinGW CLI
- /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
- /// </summary>
- public void SafelyStop()
- {
- if ((int)this.processHandle == 0)
- return;
-
- // Allow the CLI to exit cleanly
- Win32.SetForegroundWindow((int)this.processHandle);
- SendKeys.Send("^C");
- SendKeys.Flush();
-
- /*/if (HbProcess != null)
- //{
- // HbProcess.StandardInput.AutoFlush = true;
- // HbProcess.StandardInput.WriteLine("^c^z");
- //}*/
- }
-
- /// <summary>
/// Shutdown the service.
/// </summary>
public void Shutdown()
@@ -314,7 +292,7 @@ namespace HandBrake.ApplicationServices.Services }
this.currentTask.Status = QueueItemStatus.Completed;
- this.Invoke_encodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty));
+ this.InvokeEncodeCompleted(new EncodeCompletedEventArgs(true, null, string.Empty));
}
/// <summary>
@@ -399,7 +377,7 @@ namespace HandBrake.ApplicationServices.Services ElapsedTime = DateTime.Now - this.startTime,
};
- this.Invoke_encodeStatusChanged(eventArgs);
+ this.InvokeEncodeStatusChanged(eventArgs);
if (this.WindowsSeven.IsWindowsSeven)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs index eddc49d9b..915d66788 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs @@ -83,13 +83,6 @@ namespace HandBrake.ApplicationServices.Services.Interfaces void Stop();
/// <summary>
- /// Attempt to Safely kill a DirectRun() CLI
- /// NOTE: This will not work with a MinGW CLI
- /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
- /// </summary>
- void SafelyStop();
-
- /// <summary>
/// Copy the log file to the desired destinations
/// </summary>
/// <param name="destination">
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs index 5c3deb80f..eb0657cba 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs @@ -160,11 +160,11 @@ namespace HandBrake.ApplicationServices.Services }
// Fire the Encode Started Event
- this.Invoke_encodeStarted(EventArgs.Empty);
+ this.InvokeEncodeStarted(EventArgs.Empty);
}
catch (Exception exc)
{
- this.Invoke_encodeCompleted(new EncodeCompletedEventArgs(false, exc, "An Error has occured."));
+ this.InvokeEncodeCompleted(new EncodeCompletedEventArgs(false, exc, "An Error has occured."));
}
}
@@ -195,23 +195,13 @@ namespace HandBrake.ApplicationServices.Services // Do Nothing.
}
- this.Invoke_encodeCompleted(
+ this.InvokeEncodeCompleted(
exc == null
? new EncodeCompletedEventArgs(true, null, string.Empty)
: new EncodeCompletedEventArgs(false, exc, "An Error has occured."));
}
/// <summary>
- /// Attempt to Safely kill a DirectRun() CLI
- /// NOTE: This will not work with a MinGW CLI
- /// Note: http://www.cygwin.com/ml/cygwin/2006-03/msg00330.html
- /// </summary>
- public void SafelyStop()
- {
- throw new NotImplementedException("This Method is not used in the LibEncode service. You should use the Stop() method instead! ");
- }
-
- /// <summary>
/// Shutdown the service.
/// </summary>
public void Shutdown()
@@ -281,7 +271,7 @@ namespace HandBrake.ApplicationServices.Services ElapsedTime = DateTime.Now - this.startTime,
};
- this.Invoke_encodeStatusChanged(args);
+ this.InvokeEncodeStatusChanged(args);
if (this.WindowsSeven.IsWindowsSeven)
{
@@ -305,7 +295,7 @@ namespace HandBrake.ApplicationServices.Services {
this.IsEncoding = false;
- this.Invoke_encodeCompleted(
+ this.InvokeEncodeCompleted(
e.Error
? new EncodeCompletedEventArgs(false, null, string.Empty)
: new EncodeCompletedEventArgs(true, null, string.Empty));
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs index 020aaf0ad..acfb4d6d6 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs @@ -186,7 +186,7 @@ namespace HandBrake.ApplicationServices.Services {
StreamReader parseLog = new StreamReader(path);
this.readData = new Parser(parseLog.BaseStream);
- this.SouceData = Source.Parse(this.readData, this.userSettingService);
+ this.SouceData = Source.Parse(this.readData, this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));
this.SouceData.ScanPath = path;
if (this.ScanCompleted != null)
@@ -301,7 +301,7 @@ namespace HandBrake.ApplicationServices.Services this.readData = new Parser(this.hbProc.StandardError.BaseStream);
this.readData.OnScanProgress += this.OnScanProgress;
- this.SouceData = Source.Parse(this.readData, this.userSettingService);
+ this.SouceData = Source.Parse(this.readData, this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));
this.SouceData.ScanPath = (string)sourcePath;
// Write the Buffer out to file.
|