{\r
Functions.RssReader rssRead = new Functions.RssReader();\r
\r
- string appPath = Application.StartupPath.ToString() + "\\";\r
- string hbUpdate = rssRead.downloadFile(); \r
- string downloadPath = appPath + "Handbrake-win.exe";\r
+ string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe");\r
+\r
+ if (File.Exists(tempPath))\r
+ File.Delete(tempPath);\r
+\r
+ string hbUpdate = rssRead.downloadFile();\r
+\r
WebClient wcDownload = new WebClient();\r
try\r
{\r
Int64 fileSize = webResponse.ContentLength;\r
\r
responceStream = wcDownload.OpenRead(hbUpdate);\r
- loacalStream = new FileStream(downloadPath, FileMode.Create, FileAccess.Write, FileShare.None);\r
+ loacalStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None);\r
\r
int bytesSize = 0;\r
byte[] downBuffer = new byte[2048];\r
lblProgress.Text = "Download Complete";\r
btn_cancel.Text = "Close";\r
\r
- string appPath = Application.StartupPath.ToString() + "\\";\r
- \r
- Process hbproc = Process.Start(appPath + "Handbrake-win.exe");\r
- hbproc.WaitForExit();\r
- hbproc.Dispose();\r
- hbproc.Close();\r
+ string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe");\r
\r
+ Process startInstall = Process.Start(tempPath);\r
this.Close();\r
+ Application.Exit();\r
}\r
\r
private void downloadFailed()\r
\r
private void btn_cancel_Click(object sender, EventArgs e)\r
{\r
- webResponse.Close();\r
- responceStream.Close();\r
- loacalStream.Close();\r
- downloadThread.Abort();\r
- progress_download.Value = 0;\r
- lblProgress.Text = "Download Stopped";\r
- this.Close();\r
+ try\r
+ {\r
+ webResponse.Close();\r
+ responceStream.Close();\r
+ loacalStream.Close();\r
+ downloadThread.Abort();\r
+ progress_download.Value = 0;\r
+ lblProgress.Text = "Download Stopped";\r
+ this.Close();\r
+ }\r
+ catch (Exception)\r
+ {\r
+ // Do nothing\r
+ }\r
}\r
}\r
}
\ No newline at end of file
this.components = new System.ComponentModel.Container();\r
System.Windows.Forms.Label Label38;\r
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
this.DVD_Save = new System.Windows.Forms.SaveFileDialog();\r
this.File_Save = new System.Windows.Forms.SaveFileDialog();\r
this.ToolTip = new System.Windows.Forms.ToolTip(this.components);\r
this.label25 = new System.Windows.Forms.Label();\r
this.lbl_vfr = new System.Windows.Forms.Label();\r
this.check_iPodAtom = new System.Windows.Forms.CheckBox();\r
- this.check_grayscale = new System.Windows.Forms.CheckBox();\r
this.lbl_largeMp4Warning = new System.Windows.Forms.Label();\r
this.Label22 = new System.Windows.Forms.Label();\r
this.check_2PassEncode = new System.Windows.Forms.CheckBox();\r
this.SliderValue = new System.Windows.Forms.Label();\r
this.Label46 = new System.Windows.Forms.Label();\r
this.Label40 = new System.Windows.Forms.Label();\r
+ this.check_grayscale = new System.Windows.Forms.CheckBox();\r
this.TabPage1 = new System.Windows.Forms.TabPage();\r
this.text_bottom = new System.Windows.Forms.NumericUpDown();\r
this.text_top = new System.Windows.Forms.NumericUpDown();\r
this.check_largeFile.AutoSize = true;\r
this.check_largeFile.BackColor = System.Drawing.Color.Transparent;\r
this.check_largeFile.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.check_largeFile.Location = new System.Drawing.Point(16, 107);\r
+ this.check_largeFile.Location = new System.Drawing.Point(16, 80);\r
this.check_largeFile.Name = "check_largeFile";\r
this.check_largeFile.Size = new System.Drawing.Size(170, 17);\r
this.check_largeFile.TabIndex = 4;\r
this.check_turbo.BackColor = System.Drawing.Color.Transparent;\r
this.check_turbo.Enabled = false;\r
this.check_turbo.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.check_turbo.Location = new System.Drawing.Point(37, 84);\r
+ this.check_turbo.Location = new System.Drawing.Point(37, 57);\r
this.check_turbo.Name = "check_turbo";\r
this.check_turbo.Size = new System.Drawing.Size(122, 17);\r
this.check_turbo.TabIndex = 3;\r
this.TabPage3.Controls.Add(this.label25);\r
this.TabPage3.Controls.Add(this.lbl_vfr);\r
this.TabPage3.Controls.Add(this.check_iPodAtom);\r
- this.TabPage3.Controls.Add(this.check_grayscale);\r
this.TabPage3.Controls.Add(this.lbl_largeMp4Warning);\r
this.TabPage3.Controls.Add(this.check_largeFile);\r
this.TabPage3.Controls.Add(this.check_turbo);\r
this.lbl_ipodAtom.BackColor = System.Drawing.Color.Transparent;\r
this.lbl_ipodAtom.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
this.lbl_ipodAtom.ForeColor = System.Drawing.Color.Red;\r
- this.lbl_ipodAtom.Location = new System.Drawing.Point(132, 151);\r
+ this.lbl_ipodAtom.Location = new System.Drawing.Point(132, 124);\r
this.lbl_ipodAtom.Name = "lbl_ipodAtom";\r
this.lbl_ipodAtom.Size = new System.Drawing.Size(91, 12);\r
this.lbl_ipodAtom.TabIndex = 29;\r
this.check_iPodAtom.AutoSize = true;\r
this.check_iPodAtom.BackColor = System.Drawing.Color.Transparent;\r
this.check_iPodAtom.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.check_iPodAtom.Location = new System.Drawing.Point(16, 146);\r
+ this.check_iPodAtom.Location = new System.Drawing.Point(16, 119);\r
this.check_iPodAtom.Name = "check_iPodAtom";\r
this.check_iPodAtom.Size = new System.Drawing.Size(110, 17);\r
this.check_iPodAtom.TabIndex = 26;\r
this.check_iPodAtom.UseVisualStyleBackColor = false;\r
this.check_iPodAtom.CheckedChanged += new System.EventHandler(this.check_iPodAtom_CheckedChanged);\r
// \r
- // check_grayscale\r
- // \r
- this.check_grayscale.AutoSize = true;\r
- this.check_grayscale.BackColor = System.Drawing.Color.Transparent;\r
- this.check_grayscale.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.check_grayscale.Location = new System.Drawing.Point(16, 38);\r
- this.check_grayscale.Name = "check_grayscale";\r
- this.check_grayscale.Size = new System.Drawing.Size(138, 17);\r
- this.check_grayscale.TabIndex = 1;\r
- this.check_grayscale.Text = "Grayscale Encoding";\r
- this.check_grayscale.UseVisualStyleBackColor = false;\r
- // \r
// lbl_largeMp4Warning\r
// \r
this.lbl_largeMp4Warning.AutoSize = true;\r
this.lbl_largeMp4Warning.BackColor = System.Drawing.Color.Transparent;\r
this.lbl_largeMp4Warning.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.lbl_largeMp4Warning.Location = new System.Drawing.Point(35, 127);\r
+ this.lbl_largeMp4Warning.Location = new System.Drawing.Point(35, 100);\r
this.lbl_largeMp4Warning.Name = "lbl_largeMp4Warning";\r
this.lbl_largeMp4Warning.Size = new System.Drawing.Size(241, 12);\r
this.lbl_largeMp4Warning.TabIndex = 5;\r
this.check_2PassEncode.AutoSize = true;\r
this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent;\r
this.check_2PassEncode.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.check_2PassEncode.Location = new System.Drawing.Point(16, 61);\r
+ this.check_2PassEncode.Location = new System.Drawing.Point(16, 34);\r
this.check_2PassEncode.Name = "check_2PassEncode";\r
this.check_2PassEncode.Size = new System.Drawing.Size(119, 17);\r
this.check_2PassEncode.TabIndex = 2;\r
this.Label40.TabIndex = 13;\r
this.Label40.Text = "Constant Quality:";\r
// \r
+ // check_grayscale\r
+ // \r
+ this.check_grayscale.AutoSize = true;\r
+ this.check_grayscale.BackColor = System.Drawing.Color.Transparent;\r
+ this.check_grayscale.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.check_grayscale.Location = new System.Drawing.Point(16, 217);\r
+ this.check_grayscale.Name = "check_grayscale";\r
+ this.check_grayscale.Size = new System.Drawing.Size(138, 17);\r
+ this.check_grayscale.TabIndex = 1;\r
+ this.check_grayscale.Text = "Grayscale Encoding";\r
+ this.check_grayscale.UseVisualStyleBackColor = false;\r
+ // \r
// TabPage1\r
// \r
this.TabPage1.BackColor = System.Drawing.SystemColors.ControlLight;\r
this.TabPage1.Controls.Add(this.text_top);\r
this.TabPage1.Controls.Add(this.text_left);\r
this.TabPage1.Controls.Add(this.text_right);\r
+ this.TabPage1.Controls.Add(this.check_grayscale);\r
this.TabPage1.Controls.Add(this.label26);\r
this.TabPage1.Controls.Add(this.Label56);\r
this.TabPage1.Controls.Add(this.lbl_Aspect);\r
// \r
// number\r
// \r
- dataGridViewCellStyle2.Format = "N0";\r
- dataGridViewCellStyle2.NullValue = null;\r
- this.number.DefaultCellStyle = dataGridViewCellStyle2;\r
+ dataGridViewCellStyle1.Format = "N0";\r
+ dataGridViewCellStyle1.NullValue = null;\r
+ this.number.DefaultCellStyle = dataGridViewCellStyle1;\r
this.number.HeaderText = "Chapter Number";\r
this.number.MaxInputLength = 3;\r
this.number.Name = "number";\r
Thread.Sleep(100);\r
}\r
\r
- // Make sure a default cropping option is selected. Not sure why this is not defaulting like the other checkdowns,\r
- // Can fix it later.\r
- drp_crop.SelectedItem = "Automatic";\r
+ // Set some defaults for the dropdown menus. Just incase the normal or user presets dont load.\r
+ drp_crop.SelectedIndex = 0;\r
+ drp_videoEncoder.SelectedIndex = 2;\r
+ drp_audioCodec.SelectedIndex = 0;\r
\r
//Finished Loading\r
lblStatus.Text = "Loading Complete!";\r
check_iPodAtom.Checked = false;\r
lbl_ipodAtom.Visible = false;\r
check_optimiseMP4.Enabled = false;\r
+ check_lAnamorphic.Enabled = false;\r
+ check_lAnamorphic.Checked = false;\r
}\r
else\r
{\r
check_iPodAtom.Enabled = true;\r
lbl_ipodAtom.Visible = false;\r
check_optimiseMP4.Enabled = true;\r
+ check_lAnamorphic.Enabled = true;\r
}\r
\r
}\r
// Function to select the default preset.\r
private void loadNormalPreset()\r
{\r
- int normal = 0;\r
- foreach (TreeNode treenode in treeView_presets.Nodes)\r
+ string appPath = Application.StartupPath.ToString() + "\\presets.dat";\r
+ if (File.Exists(appPath))\r
{\r
- if (treenode.ToString().Equals("TreeNode: Normal"))\r
- normal = treenode.Index;\r
- }\r
\r
- TreeNode np = treeView_presets.Nodes[normal];\r
+ int normal = 0;\r
+ foreach (TreeNode treenode in treeView_presets.Nodes)\r
+ {\r
+ if (treenode.ToString().Equals("TreeNode: Normal"))\r
+ normal = treenode.Index;\r
+ }\r
\r
- treeView_presets.SelectedNode = np;\r
+ TreeNode np = treeView_presets.Nodes[normal];\r
+\r
+ treeView_presets.SelectedNode = np;\r
+ }\r
}\r
\r
// Buttons\r
\r
try\r
{\r
- string appPath = Application.StartupPath.ToString() + "\\";\r
- StreamReader presetInput = new StreamReader(appPath + "presets.dat");\r
-\r
- while (!presetInput.EndOfStream)\r
+ string appPath = Application.StartupPath.ToString() + "\\presets.dat";\r
+ if (File.Exists(appPath))\r
{\r
- if ((char)presetInput.Peek() == '+')\r
+ StreamReader presetInput = new StreamReader(appPath);\r
+ while (!presetInput.EndOfStream)\r
{\r
- string preset = presetInput.ReadLine().Replace("+ ", "");\r
- Regex r = new Regex("(: )"); // Split on hyphens. \r
- string[] presetName = r.Split(preset);\r
+ if ((char)presetInput.Peek() == '+')\r
+ {\r
+ string preset = presetInput.ReadLine().Replace("+ ", "");\r
+ Regex r = new Regex("(: )"); // Split on hyphens. \r
+ string[] presetName = r.Split(preset);\r
\r
\r
- if (selectedPreset == presetName[0])\r
- {\r
- // Need to disable anamorphic now, otherwise it may overide the width / height values later.\r
- CheckPixelRatio.CheckState = CheckState.Unchecked;\r
+ if (selectedPreset == presetName[0])\r
+ {\r
+ // Need to disable anamorphic now, otherwise it may overide the width / height values later.\r
+ CheckPixelRatio.CheckState = CheckState.Unchecked;\r
\r
- // Send the query from the file to the Query Parser class\r
- Functions.QueryParser presetQuery = Functions.QueryParser.Parse(preset);\r
+ // Send the query from the file to the Query Parser class\r
+ Functions.QueryParser presetQuery = Functions.QueryParser.Parse(preset);\r
\r
- // Now load the preset\r
- hb_common_func.presetLoader(this, presetQuery, selectedPreset);\r
+ // Now load the preset\r
+ hb_common_func.presetLoader(this, presetQuery, selectedPreset);\r
+ }\r
}\r
-\r
+ else\r
+ presetInput.ReadLine();\r
}\r
- else\r
- presetInput.ReadLine();\r
+ }\r
+ else\r
+ {\r
+ MessageBox.Show("Unable to load the presets.dat file. Please select \"Update Built-in Presets\" from the Presets Menu \nMake sure you are running the program in Admin mode if running on Vista. See Windows FAQ for details!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
catch (Exception exc)\r