summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-06-15 14:56:23 +0000
committersr55 <[email protected]>2009-06-15 14:56:23 +0000
commit24780596a9e62e823d619792445a784094f904a2 (patch)
tree79909eb55db5bf00acd2466a32d7da343949d8f5 /win/C#/Functions
parentb023bb532c17e1284230172b660baa32b5750318 (diff)
WinGui:
- Picture Settings: Height of 0 allows for no -l to be passed to the CLI - Picture Settings / pre-sets now set 0 when no Height specified. Prevents the panel from using incorrect values when pre-sets are selected. - Simplified the Encode.cs set-up. Includes changes to QueueHandler git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2534 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r--win/C#/Functions/Main.cs20
-rw-r--r--win/C#/Functions/PresetLoader.cs5
-rw-r--r--win/C#/Functions/QueryGenerator.cs7
-rw-r--r--win/C#/Functions/Win32.cs14
4 files changed, 27 insertions, 19 deletions
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs
index 84ba26398..9d936cd25 100644
--- a/win/C#/Functions/Main.cs
+++ b/win/C#/Functions/Main.cs
@@ -19,7 +19,7 @@ namespace Handbrake.Functions
static class Main
{
// Private Variables
- private static readonly XmlSerializer ser = new XmlSerializer(typeof(List<QueueItem>));
+ private static readonly XmlSerializer ser = new XmlSerializer(typeof(List<Job>));
/// <summary>
/// Calculate the duration of the selected title and chapters
@@ -259,7 +259,11 @@ namespace Handbrake.Functions
Properties.Settings.Default.hb_version = arr[0];
}
if (cliProcess.TotalProcessorTime.Seconds > 10) // Don't wait longer than 10 seconds.
- killCLI(cliProcess.Id);
+ {
+ Process cli = Process.GetProcessById(cliProcess.Id);
+ if (!cli.HasExited)
+ cli.Kill();
+ }
}
}
catch (Exception e)
@@ -269,16 +273,6 @@ namespace Handbrake.Functions
}
/// <summary>
- /// Search through the running processes on the system and kill HandBrakeCLI
- /// </summary>
- private static void killCLI(int id)
- {
- Process cli = Process.GetProcessById(id);
- if (!cli.HasExited)
- cli.Kill();
- }
-
- /// <summary>
/// Check if the queue recovery file contains records.
/// If it does, it means the last queue did not complete before HandBrake closed.
/// So, return a boolean if true.
@@ -292,7 +286,7 @@ namespace Handbrake.Functions
{
using (FileStream strm = new FileStream(tempPath, FileMode.Open, FileAccess.Read))
{
- List<QueueItem> list = ser.Deserialize(strm) as List<QueueItem>;
+ List<Job> list = ser.Deserialize(strm) as List<Job>;
if (list != null)
if (list.Count != 0)
return true;
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs
index 15eb741a8..f6ea60e57 100644
--- a/win/C#/Functions/PresetLoader.cs
+++ b/win/C#/Functions/PresetLoader.cs
@@ -72,7 +72,7 @@ namespace Handbrake.Functions
if (presetQuery.CropLeft == "0" && presetQuery.CropRight == "0")
mainWindow.pictureSettings.check_customCrop.Checked = true;
- if (pictureSettings)
+ if (pictureSettings) // only Load picture settings if the perset requires it
{
if (presetQuery.CropTop != null)
{
@@ -110,6 +110,8 @@ namespace Handbrake.Functions
if (presetQuery.Height != 0)
mainWindow.pictureSettings.text_height.Value = presetQuery.Height;
+ else
+ mainWindow.pictureSettings.text_height.Value = 0;
// Max Width/Height override Width/Height
if (presetQuery.MaxWidth != 0)
@@ -125,6 +127,7 @@ namespace Handbrake.Functions
}
mainWindow.pictureSettings.setMax();
+
#endregion
#region Filters
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs
index 2f6e474fa..341338d23 100644
--- a/win/C#/Functions/QueryGenerator.cs
+++ b/win/C#/Functions/QueryGenerator.cs
@@ -133,9 +133,10 @@ namespace Handbrake.Functions
// Use MaxHeight for built-in presets and height for user settings.
if (mainWindow.pictureSettings.maxHeight == 0)
{
- if (mainWindow.pictureSettings.text_height.Text != "")
- if (mainWindow.pictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.pictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic
- query += " -l " + mainWindow.pictureSettings.text_height.Text;
+ if (mainWindow.pictureSettings.text_height.Text != "0")
+ if (mainWindow.pictureSettings.text_height.Text != "")
+ if (mainWindow.pictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.pictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic
+ query += " -l " + mainWindow.pictureSettings.text_height.Text;
}
else
{
diff --git a/win/C#/Functions/Win32.cs b/win/C#/Functions/Win32.cs
index 2bc47e619..bf0bde69c 100644
--- a/win/C#/Functions/Win32.cs
+++ b/win/C#/Functions/Win32.cs
@@ -6,7 +6,7 @@ namespace Handbrake.Functions
class Win32
{
[DllImport("user32.dll")]
- public static extern int SetForegroundWindow(int hWnd);
+ public static extern bool SetForegroundWindow(int hWnd);
[DllImport("user32.dll")]
public static extern void LockWorkStation();
@@ -14,7 +14,7 @@ namespace Handbrake.Functions
[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int uFlags, int dwReason);
- public struct MEMORYSTATUS // Unused var's are requred here.
+ public struct MEMORYSTATUS // Unused var's are required here.
{
public UInt32 dwLength;
public UInt32 dwMemoryLoad;
@@ -31,5 +31,15 @@ namespace Handbrake.Functions
(
ref MEMORYSTATUS lpBuffer
);
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ public static extern bool GenerateConsoleCtrlEvent(ConsoleCtrlEvent sigevent, int dwProcessGroupId);
+
+ public enum ConsoleCtrlEvent
+ {
+ CTRL_C = 0,
+ CTRL_BREAK = 1,
+ CTRL_CLOSE = 2,
+ }
}
}