summaryrefslogtreecommitdiffstats
path: root/win/C#/EncodeQueue
diff options
context:
space:
mode:
authorsr55 <[email protected]>2009-12-19 00:00:41 +0000
committersr55 <[email protected]>2009-12-19 00:00:41 +0000
commitee7dc8b072afd25fb0180f22658d4a772f2068b7 (patch)
tree42a1b44782541430c795037a97345bd63b4e0d97 /win/C#/EncodeQueue
parentce825a48b43c003f45ace85a2711925a695ffdf0 (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
Diffstat (limited to 'win/C#/EncodeQueue')
-rw-r--r--win/C#/EncodeQueue/EncodeAndQueueHandler.cs11
1 files changed, 8 insertions, 3 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