OSDN Git Service

merge 0.9.4 to jp
[handbrake-jp/handbrake-jp.git] / win / C# / frmDownload.cs
index 01c97e3..839d6ac 100644 (file)
@@ -5,7 +5,6 @@
           It may be used under the terms of the GNU General Public License. */\r
 \r
 using System;\r
-using System.Collections.Generic;\r
 using System.Windows.Forms;\r
 using System.Net;\r
 using System.IO;\r
@@ -16,7 +15,7 @@ namespace Handbrake
 {\r
     public partial class frmDownload : Form\r
     {\r
-        private Thread downloadThread;\r
+        private readonly Thread downloadThread;\r
         private Stream responceStream;\r
         private Stream loacalStream;\r
         private HttpWebRequest webRequest;\r
@@ -56,7 +55,7 @@ namespace Handbrake
                 responceStream = wcDownload.OpenRead(hbUpdate);\r
                 loacalStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None);\r
 \r
-                int bytesSize = 0;\r
+                int bytesSize;\r
                 byte[] downBuffer = new byte[2048];\r
 \r
                 long flength = 0;\r
@@ -64,16 +63,16 @@ namespace Handbrake
                 {\r
                     loacalStream.Write(downBuffer, 0, bytesSize);\r
                     flength = loacalStream.Length;\r
-                    this.Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { loacalStream.Length, fileSize });\r
+                    Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { loacalStream.Length, fileSize });\r
                 }\r
 \r
                 responceStream.Close();\r
                 loacalStream.Close();\r
 \r
                 if (flength != fileSize)\r
-                    this.Invoke(new DownloadFailedCallback(this.downloadFailed));\r
+                    Invoke(new DownloadFailedCallback(this.downloadFailed));\r
                 else\r
-                    this.Invoke(new DownloadCompleteCallback(this.downloadComplete));\r
+                    Invoke(new DownloadCompleteCallback(this.downloadComplete));\r
             }\r
             catch (Exception)\r
             {\r
@@ -92,7 +91,7 @@ namespace Handbrake
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show("Integer Convertion Error On Download \n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                MessageBox.Show("Integer Conversion Error On Download \n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
             }\r
         }\r
 \r
@@ -102,8 +101,7 @@ namespace Handbrake
             btn_cancel.Text = "\95Â\82\82é";\r
 \r
             string tempPath = Path.Combine(Path.GetTempPath(), "handbrake-setup.exe");\r
-\r
-            Process startInstall = Process.Start(tempPath);\r
+            Process.Start(tempPath);\r
             this.Close();\r
             Application.Exit();\r
         }\r