diff options
Diffstat (limited to 'win/C#')
-rw-r--r-- | win/C#/Functions/RssReader.cs | 2 | ||||
-rw-r--r-- | win/C#/frmDownload.cs | 42 | ||||
-rw-r--r-- | win/C#/frmMain.Designer.cs | 48 | ||||
-rw-r--r-- | win/C#/frmMain.cs | 72 | ||||
-rw-r--r-- | win/C#/frmMain.resx | 6 |
5 files changed, 93 insertions, 77 deletions
diff --git a/win/C#/Functions/RssReader.cs b/win/C#/Functions/RssReader.cs index 4a184de0d..c8aa5a74d 100644 --- a/win/C#/Functions/RssReader.cs +++ b/win/C#/Functions/RssReader.cs @@ -28,7 +28,7 @@ namespace Handbrake.Functions private string readRss()
{
- rssReader = new XmlTextReader("http://handbrake.m0k.org/appcast.xml");
+ rssReader = new XmlTextReader("http://handbrake.fr/appcast.xml");
rssDoc = new XmlDocument();
rssDoc.Load(rssReader);
diff --git a/win/C#/frmDownload.cs b/win/C#/frmDownload.cs index 69c079ab9..73020ff1b 100644 --- a/win/C#/frmDownload.cs +++ b/win/C#/frmDownload.cs @@ -51,9 +51,13 @@ namespace Handbrake {
Functions.RssReader rssRead = new Functions.RssReader();
- string appPath = Application.StartupPath.ToString() + "\\";
- string hbUpdate = rssRead.downloadFile();
- string downloadPath = appPath + "Handbrake-win.exe";
+ string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe");
+
+ if (File.Exists(tempPath))
+ File.Delete(tempPath);
+
+ string hbUpdate = rssRead.downloadFile();
+
WebClient wcDownload = new WebClient();
try
{
@@ -63,7 +67,7 @@ namespace Handbrake Int64 fileSize = webResponse.ContentLength;
responceStream = wcDownload.OpenRead(hbUpdate);
- loacalStream = new FileStream(downloadPath, FileMode.Create, FileAccess.Write, FileShare.None);
+ loacalStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None);
int bytesSize = 0;
byte[] downBuffer = new byte[2048];
@@ -110,14 +114,11 @@ namespace Handbrake lblProgress.Text = "Download Complete";
btn_cancel.Text = "Close";
- string appPath = Application.StartupPath.ToString() + "\\";
-
- Process hbproc = Process.Start(appPath + "Handbrake-win.exe");
- hbproc.WaitForExit();
- hbproc.Dispose();
- hbproc.Close();
+ string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe");
+ Process startInstall = Process.Start(tempPath);
this.Close();
+ Application.Exit();
}
private void downloadFailed()
@@ -128,13 +129,20 @@ namespace Handbrake private void btn_cancel_Click(object sender, EventArgs e)
{
- webResponse.Close();
- responceStream.Close();
- loacalStream.Close();
- downloadThread.Abort();
- progress_download.Value = 0;
- lblProgress.Text = "Download Stopped";
- this.Close();
+ try
+ {
+ webResponse.Close();
+ responceStream.Close();
+ loacalStream.Close();
+ downloadThread.Abort();
+ progress_download.Value = 0;
+ lblProgress.Text = "Download Stopped";
+ this.Close();
+ }
+ catch (Exception)
+ {
+ // Do nothing
+ }
}
}
}
\ No newline at end of file diff --git a/win/C#/frmMain.Designer.cs b/win/C#/frmMain.Designer.cs index 736775435..814ff1f6b 100644 --- a/win/C#/frmMain.Designer.cs +++ b/win/C#/frmMain.Designer.cs @@ -37,7 +37,7 @@ namespace Handbrake this.components = new System.ComponentModel.Container();
System.Windows.Forms.Label Label38;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.DVD_Save = new System.Windows.Forms.SaveFileDialog();
this.File_Save = new System.Windows.Forms.SaveFileDialog();
this.ToolTip = new System.Windows.Forms.ToolTip(this.components);
@@ -133,7 +133,6 @@ namespace Handbrake this.label25 = new System.Windows.Forms.Label();
this.lbl_vfr = new System.Windows.Forms.Label();
this.check_iPodAtom = new System.Windows.Forms.CheckBox();
- this.check_grayscale = new System.Windows.Forms.CheckBox();
this.lbl_largeMp4Warning = new System.Windows.Forms.Label();
this.Label22 = new System.Windows.Forms.Label();
this.check_2PassEncode = new System.Windows.Forms.CheckBox();
@@ -142,6 +141,7 @@ namespace Handbrake this.SliderValue = new System.Windows.Forms.Label();
this.Label46 = new System.Windows.Forms.Label();
this.Label40 = new System.Windows.Forms.Label();
+ this.check_grayscale = new System.Windows.Forms.CheckBox();
this.TabPage1 = new System.Windows.Forms.TabPage();
this.text_bottom = new System.Windows.Forms.NumericUpDown();
this.text_top = new System.Windows.Forms.NumericUpDown();
@@ -441,7 +441,7 @@ namespace Handbrake this.check_largeFile.AutoSize = true;
this.check_largeFile.BackColor = System.Drawing.Color.Transparent;
this.check_largeFile.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.check_largeFile.Location = new System.Drawing.Point(16, 107);
+ this.check_largeFile.Location = new System.Drawing.Point(16, 80);
this.check_largeFile.Name = "check_largeFile";
this.check_largeFile.Size = new System.Drawing.Size(170, 17);
this.check_largeFile.TabIndex = 4;
@@ -456,7 +456,7 @@ namespace Handbrake this.check_turbo.BackColor = System.Drawing.Color.Transparent;
this.check_turbo.Enabled = false;
this.check_turbo.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.check_turbo.Location = new System.Drawing.Point(37, 84);
+ this.check_turbo.Location = new System.Drawing.Point(37, 57);
this.check_turbo.Name = "check_turbo";
this.check_turbo.Size = new System.Drawing.Size(122, 17);
this.check_turbo.TabIndex = 3;
@@ -1260,7 +1260,6 @@ namespace Handbrake this.TabPage3.Controls.Add(this.label25);
this.TabPage3.Controls.Add(this.lbl_vfr);
this.TabPage3.Controls.Add(this.check_iPodAtom);
- this.TabPage3.Controls.Add(this.check_grayscale);
this.TabPage3.Controls.Add(this.lbl_largeMp4Warning);
this.TabPage3.Controls.Add(this.check_largeFile);
this.TabPage3.Controls.Add(this.check_turbo);
@@ -1289,7 +1288,7 @@ namespace Handbrake this.lbl_ipodAtom.BackColor = System.Drawing.Color.Transparent;
this.lbl_ipodAtom.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl_ipodAtom.ForeColor = System.Drawing.Color.Red;
- this.lbl_ipodAtom.Location = new System.Drawing.Point(132, 151);
+ this.lbl_ipodAtom.Location = new System.Drawing.Point(132, 124);
this.lbl_ipodAtom.Name = "lbl_ipodAtom";
this.lbl_ipodAtom.Size = new System.Drawing.Size(91, 12);
this.lbl_ipodAtom.TabIndex = 29;
@@ -1324,7 +1323,7 @@ namespace Handbrake this.check_iPodAtom.AutoSize = true;
this.check_iPodAtom.BackColor = System.Drawing.Color.Transparent;
this.check_iPodAtom.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.check_iPodAtom.Location = new System.Drawing.Point(16, 146);
+ this.check_iPodAtom.Location = new System.Drawing.Point(16, 119);
this.check_iPodAtom.Name = "check_iPodAtom";
this.check_iPodAtom.Size = new System.Drawing.Size(110, 17);
this.check_iPodAtom.TabIndex = 26;
@@ -1332,24 +1331,12 @@ namespace Handbrake this.check_iPodAtom.UseVisualStyleBackColor = false;
this.check_iPodAtom.CheckedChanged += new System.EventHandler(this.check_iPodAtom_CheckedChanged);
//
- // check_grayscale
- //
- this.check_grayscale.AutoSize = true;
- this.check_grayscale.BackColor = System.Drawing.Color.Transparent;
- this.check_grayscale.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.check_grayscale.Location = new System.Drawing.Point(16, 38);
- this.check_grayscale.Name = "check_grayscale";
- this.check_grayscale.Size = new System.Drawing.Size(138, 17);
- this.check_grayscale.TabIndex = 1;
- this.check_grayscale.Text = "Grayscale Encoding";
- this.check_grayscale.UseVisualStyleBackColor = false;
- //
// lbl_largeMp4Warning
//
this.lbl_largeMp4Warning.AutoSize = true;
this.lbl_largeMp4Warning.BackColor = System.Drawing.Color.Transparent;
this.lbl_largeMp4Warning.Font = new System.Drawing.Font("Verdana", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbl_largeMp4Warning.Location = new System.Drawing.Point(35, 127);
+ this.lbl_largeMp4Warning.Location = new System.Drawing.Point(35, 100);
this.lbl_largeMp4Warning.Name = "lbl_largeMp4Warning";
this.lbl_largeMp4Warning.Size = new System.Drawing.Size(241, 12);
this.lbl_largeMp4Warning.TabIndex = 5;
@@ -1371,7 +1358,7 @@ namespace Handbrake this.check_2PassEncode.AutoSize = true;
this.check_2PassEncode.BackColor = System.Drawing.Color.Transparent;
this.check_2PassEncode.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.check_2PassEncode.Location = new System.Drawing.Point(16, 61);
+ this.check_2PassEncode.Location = new System.Drawing.Point(16, 34);
this.check_2PassEncode.Name = "check_2PassEncode";
this.check_2PassEncode.Size = new System.Drawing.Size(119, 17);
this.check_2PassEncode.TabIndex = 2;
@@ -1434,6 +1421,18 @@ namespace Handbrake this.Label40.TabIndex = 13;
this.Label40.Text = "Constant Quality:";
//
+ // check_grayscale
+ //
+ this.check_grayscale.AutoSize = true;
+ this.check_grayscale.BackColor = System.Drawing.Color.Transparent;
+ this.check_grayscale.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.check_grayscale.Location = new System.Drawing.Point(16, 217);
+ this.check_grayscale.Name = "check_grayscale";
+ this.check_grayscale.Size = new System.Drawing.Size(138, 17);
+ this.check_grayscale.TabIndex = 1;
+ this.check_grayscale.Text = "Grayscale Encoding";
+ this.check_grayscale.UseVisualStyleBackColor = false;
+ //
// TabPage1
//
this.TabPage1.BackColor = System.Drawing.SystemColors.ControlLight;
@@ -1441,6 +1440,7 @@ namespace Handbrake this.TabPage1.Controls.Add(this.text_top);
this.TabPage1.Controls.Add(this.text_left);
this.TabPage1.Controls.Add(this.text_right);
+ this.TabPage1.Controls.Add(this.check_grayscale);
this.TabPage1.Controls.Add(this.label26);
this.TabPage1.Controls.Add(this.Label56);
this.TabPage1.Controls.Add(this.lbl_Aspect);
@@ -1883,9 +1883,9 @@ namespace Handbrake //
// number
//
- dataGridViewCellStyle2.Format = "N0";
- dataGridViewCellStyle2.NullValue = null;
- this.number.DefaultCellStyle = dataGridViewCellStyle2;
+ dataGridViewCellStyle1.Format = "N0";
+ dataGridViewCellStyle1.NullValue = null;
+ this.number.DefaultCellStyle = dataGridViewCellStyle1;
this.number.HeaderText = "Chapter Number";
this.number.MaxInputLength = 3;
this.number.Name = "number";
diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index 8e69a8f2c..8d80d0362 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -105,9 +105,10 @@ namespace Handbrake Thread.Sleep(100);
}
- // Make sure a default cropping option is selected. Not sure why this is not defaulting like the other checkdowns,
- // Can fix it later.
- drp_crop.SelectedItem = "Automatic";
+ // Set some defaults for the dropdown menus. Just incase the normal or user presets dont load.
+ drp_crop.SelectedIndex = 0;
+ drp_videoEncoder.SelectedIndex = 2;
+ drp_audioCodec.SelectedIndex = 0;
//Finished Loading
lblStatus.Text = "Loading Complete!";
@@ -902,6 +903,8 @@ namespace Handbrake check_iPodAtom.Checked = false;
lbl_ipodAtom.Visible = false;
check_optimiseMP4.Enabled = false;
+ check_lAnamorphic.Enabled = false;
+ check_lAnamorphic.Checked = false;
}
else
{
@@ -912,6 +915,7 @@ namespace Handbrake check_iPodAtom.Enabled = true;
lbl_ipodAtom.Visible = false;
check_optimiseMP4.Enabled = true;
+ check_lAnamorphic.Enabled = true;
}
}
@@ -990,16 +994,21 @@ namespace Handbrake // Function to select the default preset.
private void loadNormalPreset()
{
- int normal = 0;
- foreach (TreeNode treenode in treeView_presets.Nodes)
+ string appPath = Application.StartupPath.ToString() + "\\presets.dat";
+ if (File.Exists(appPath))
{
- if (treenode.ToString().Equals("TreeNode: Normal"))
- normal = treenode.Index;
- }
- TreeNode np = treeView_presets.Nodes[normal];
+ int normal = 0;
+ foreach (TreeNode treenode in treeView_presets.Nodes)
+ {
+ if (treenode.ToString().Equals("TreeNode: Normal"))
+ normal = treenode.Index;
+ }
- treeView_presets.SelectedNode = np;
+ TreeNode np = treeView_presets.Nodes[normal];
+
+ treeView_presets.SelectedNode = np;
+ }
}
// Buttons
@@ -1020,33 +1029,38 @@ namespace Handbrake try
{
- string appPath = Application.StartupPath.ToString() + "\\";
- StreamReader presetInput = new StreamReader(appPath + "presets.dat");
-
- while (!presetInput.EndOfStream)
+ string appPath = Application.StartupPath.ToString() + "\\presets.dat";
+ if (File.Exists(appPath))
{
- if ((char)presetInput.Peek() == '+')
+ StreamReader presetInput = new StreamReader(appPath);
+ while (!presetInput.EndOfStream)
{
- string preset = presetInput.ReadLine().Replace("+ ", "");
- Regex r = new Regex("(: )"); // Split on hyphens.
- string[] presetName = r.Split(preset);
+ if ((char)presetInput.Peek() == '+')
+ {
+ string preset = presetInput.ReadLine().Replace("+ ", "");
+ Regex r = new Regex("(: )"); // Split on hyphens.
+ string[] presetName = r.Split(preset);
- if (selectedPreset == presetName[0])
- {
- // Need to disable anamorphic now, otherwise it may overide the width / height values later.
- CheckPixelRatio.CheckState = CheckState.Unchecked;
+ if (selectedPreset == presetName[0])
+ {
+ // Need to disable anamorphic now, otherwise it may overide the width / height values later.
+ CheckPixelRatio.CheckState = CheckState.Unchecked;
- // Send the query from the file to the Query Parser class
- Functions.QueryParser presetQuery = Functions.QueryParser.Parse(preset);
+ // Send the query from the file to the Query Parser class
+ Functions.QueryParser presetQuery = Functions.QueryParser.Parse(preset);
- // Now load the preset
- hb_common_func.presetLoader(this, presetQuery, selectedPreset);
+ // Now load the preset
+ hb_common_func.presetLoader(this, presetQuery, selectedPreset);
+ }
}
-
+ else
+ presetInput.ReadLine();
}
- else
- presetInput.ReadLine();
+ }
+ else
+ {
+ 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);
}
}
catch (Exception exc)
diff --git a/win/C#/frmMain.resx b/win/C#/frmMain.resx index 7964e91b4..3dee6a589 100644 --- a/win/C#/frmMain.resx +++ b/win/C#/frmMain.resx @@ -189,12 +189,6 @@ Best used in conjunction with forced subtitles.</value> <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
- <metadata name="number.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>True</value>
- </metadata>
- <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>True</value>
- </metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>731, 18</value>
</metadata>
|