diff options
author | sr55 <[email protected]> | 2008-01-16 16:17:37 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2008-01-16 16:17:37 +0000 |
commit | 2e27262728fa74a19b2b0e815591e7d5dd21c780 (patch) | |
tree | 4c809cff2149e476f6a1b5ac80da01aefa8e431b /win/C#/frmDownload.cs | |
parent | 5cec8595f538606d4aca41d341fab20d2601b803 (diff) |
WinGui:
- Tested and fixed a few issues with the appcast updater.
- Fixed a small issue where dropdowns wouldn't have a default value on startup if presets.dat was missing and user defaults was turned off.
- Disabled loose anamorphic for ffmpeg and xvid encodes.
- Added a useful error message to the presets bar when presets.dat is missing.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1203 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/frmDownload.cs')
-rw-r--r-- | win/C#/frmDownload.cs | 42 |
1 files changed, 25 insertions, 17 deletions
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 |