- 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
{\r
public class EncodeAndQueueHandler\r
{\r
- private static XmlSerializer serializer = new XmlSerializer(typeof(List<Job>));\r
+ private static XmlSerializer serializer;\r
private List<Job> queue = new List<Job>();\r
private int nextJobId;\r
\r
{\r
using (FileStream strm = new FileStream(tempPath, FileMode.Create, FileAccess.Write))\r
{\r
+ if (serializer == null)\r
+ serializer = new XmlSerializer(typeof(List<Job>));\r
serializer.Serialize(strm, queue);\r
strm.Close();\r
strm.Dispose();\r
{\r
if (strm.Length != 0)\r
{\r
+ if (serializer == null)\r
+ serializer = new XmlSerializer(typeof(List<Job>));\r
+\r
List<Job> list = serializer.Deserialize(strm) as List<Job>;\r
\r
if (list != null)\r
\r
hbProcess.Close();\r
hbProcess.Dispose();\r
- \r
+\r
isEncoding = false;\r
\r
//Growl\r
\r
Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
hbProcess = Process.Start(cliStart);\r
- processID = Main.getCliProcess(before); \r
+ processID = Main.getCliProcess(before);\r
currentQuery = query;\r
if (hbProcess != null)\r
processHandle = hbProcess.MainWindowHandle; // Set the process Handle\r
\r
public frmActivityWindow(string mode)\r
{\r
+ InitializeComponent();\r
+\r
_kilLThread = false;\r
_position = 0;\r
if (mode == "scan")\r
SetScanMode();\r
else\r
SetEncodeMode();\r
-\r
- InitializeComponent();\r
}\r
private void NewActivityWindow_Load(object sender, EventArgs e)\r
{\r
{\r
return this.dvdDriveLabel;\r
}\r
- \r
- if(Path.GetFileNameWithoutExtension(this.sourcePath) != "VIDEO_TS")\r
+\r
+ if (Path.GetFileNameWithoutExtension(this.sourcePath) != "VIDEO_TS")\r
return Path.GetFileNameWithoutExtension(this.sourcePath);\r
\r
return Path.GetFileNameWithoutExtension(Path.GetDirectoryName(this.sourcePath));\r
{\r
if (ActivityWindow == null || !ActivityWindow.IsHandleCreated)\r
ActivityWindow = new frmActivityWindow(lastAction);\r
-\r
- switch (lastAction)\r
- {\r
- case "scan":\r
- ActivityWindow.SetScanMode();\r
- break;\r
- case "encode":\r
- ActivityWindow.SetEncodeMode();\r
- break;\r
- default:\r
- ActivityWindow.SetEncodeMode();\r
- break;\r
- }\r
+ else\r
+ switch (lastAction)\r
+ {\r
+ case "scan":\r
+ ActivityWindow.SetScanMode();\r
+ break;\r
+ case "encode":\r
+ ActivityWindow.SetEncodeMode();\r
+ break;\r
+ default:\r
+ ActivityWindow.SetEncodeMode();\r
+ break;\r
+ }\r
\r
ActivityWindow.Show();\r
ActivityWindow.Activate();\r