diff options
author | sr55 <[email protected]> | 2009-12-19 00:00:41 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-12-19 00:00:41 +0000 |
commit | ee7dc8b072afd25fb0180f22658d4a772f2068b7 (patch) | |
tree | 42a1b44782541430c795037a97345bd63b4e0d97 | |
parent | ce825a48b43c003f45ace85a2711925a695ffdf0 (diff) |
WinGui:
- Shave ~0.5s of the application startup time by not initialising an XmlSerializer when it's not needed. This is quite expensive.
- Make sure the Activity window is initialised before we try set it's title.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3035 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | win/C#/EncodeQueue/EncodeAndQueueHandler.cs | 11 | ||||
-rw-r--r-- | win/C#/frmActivityWindow.cs | 4 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 30 |
3 files changed, 25 insertions, 20 deletions
diff --git a/win/C#/EncodeQueue/EncodeAndQueueHandler.cs b/win/C#/EncodeQueue/EncodeAndQueueHandler.cs index db91e6d90..17db75293 100644 --- a/win/C#/EncodeQueue/EncodeAndQueueHandler.cs +++ b/win/C#/EncodeQueue/EncodeAndQueueHandler.cs @@ -18,7 +18,7 @@ namespace Handbrake.EncodeQueue {
public class EncodeAndQueueHandler
{
- private static XmlSerializer serializer = new XmlSerializer(typeof(List<Job>));
+ private static XmlSerializer serializer;
private List<Job> queue = new List<Job>();
private int nextJobId;
@@ -148,6 +148,8 @@ namespace Handbrake.EncodeQueue {
using (FileStream strm = new FileStream(tempPath, FileMode.Create, FileAccess.Write))
{
+ if (serializer == null)
+ serializer = new XmlSerializer(typeof(List<Job>));
serializer.Serialize(strm, queue);
strm.Close();
strm.Dispose();
@@ -215,6 +217,9 @@ namespace Handbrake.EncodeQueue {
if (strm.Length != 0)
{
+ if (serializer == null)
+ serializer = new XmlSerializer(typeof(List<Job>));
+
List<Job> list = serializer.Deserialize(strm) as List<Job>;
if (list != null)
@@ -325,7 +330,7 @@ namespace Handbrake.EncodeQueue hbProcess.Close();
hbProcess.Dispose();
-
+
isEncoding = false;
//Growl
@@ -383,7 +388,7 @@ namespace Handbrake.EncodeQueue Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.
hbProcess = Process.Start(cliStart);
- processID = Main.getCliProcess(before);
+ processID = Main.getCliProcess(before);
currentQuery = query;
if (hbProcess != null)
processHandle = hbProcess.MainWindowHandle; // Set the process Handle
diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index 5f41c799b..9d004ffc7 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -28,14 +28,14 @@ namespace Handbrake public frmActivityWindow(string mode)
{
+ InitializeComponent();
+
_kilLThread = false;
_position = 0;
if (mode == "scan")
SetScanMode();
else
SetEncodeMode();
-
- InitializeComponent();
}
private void NewActivityWindow_Load(object sender, EventArgs e)
{
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index c6fb58e60..87ea63e92 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -192,8 +192,8 @@ namespace Handbrake {
return this.dvdDriveLabel;
}
-
- if(Path.GetFileNameWithoutExtension(this.sourcePath) != "VIDEO_TS")
+
+ if (Path.GetFileNameWithoutExtension(this.sourcePath) != "VIDEO_TS")
return Path.GetFileNameWithoutExtension(this.sourcePath);
return Path.GetFileNameWithoutExtension(Path.GetDirectoryName(this.sourcePath));
@@ -789,19 +789,19 @@ namespace Handbrake {
if (ActivityWindow == null || !ActivityWindow.IsHandleCreated)
ActivityWindow = new frmActivityWindow(lastAction);
-
- switch (lastAction)
- {
- case "scan":
- ActivityWindow.SetScanMode();
- break;
- case "encode":
- ActivityWindow.SetEncodeMode();
- break;
- default:
- ActivityWindow.SetEncodeMode();
- break;
- }
+ else
+ switch (lastAction)
+ {
+ case "scan":
+ ActivityWindow.SetScanMode();
+ break;
+ case "encode":
+ ActivityWindow.SetEncodeMode();
+ break;
+ default:
+ ActivityWindow.SetEncodeMode();
+ break;
+ }
ActivityWindow.Show();
ActivityWindow.Activate();
|