|
@@ -205,19 +205,27 @@ namespace MOKA_Factory_Tools
|
|
|
//request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";
|
|
|
response = request.GetResponse() as HttpWebResponse;
|
|
|
ns = response.GetResponseStream();
|
|
|
- nreadsize = ns.Read(nbytes, 0, nbytes.Length);
|
|
|
+
|
|
|
int preocess = 0;
|
|
|
- while (nreadsize > 0)
|
|
|
+ long recSize = 0;
|
|
|
+
|
|
|
+ do
|
|
|
{
|
|
|
+ nreadsize = ns.Read(nbytes, 0, nbytes.Length);
|
|
|
+ if (nreadsize == 0)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ recSize += (long)nreadsize;
|
|
|
fs.Write(nbytes, 0, nreadsize);
|
|
|
- //formm.recevMsg.Items.Add("线程" + threadIndex.ToString() + "已下载字节:" + Math.Ceiling(nreadsize / 1024.0f) + "KB");
|
|
|
- nreadsize = ns.Read(nbytes, 0, nbytes.Length);
|
|
|
+ fs.Flush();
|
|
|
+
|
|
|
preocess += (int)Math.Ceiling(nreadsize / 1024.0f);
|
|
|
- if(preocess<= formm.ProgressBar1.Maximum)
|
|
|
+ if (preocess <= formm.ProgressBar1.Maximum)
|
|
|
{
|
|
|
formm.ProgressBar1.Value = preocess;
|
|
|
}
|
|
|
- }
|
|
|
+ } while (recSize != response.ContentLength);
|
|
|
+
|
|
|
fs.Close();
|
|
|
ns.Close();
|
|
|
response.Close();
|
|
@@ -287,6 +295,7 @@ namespace MOKA_Factory_Tools
|
|
|
|
|
|
string keyinfo = "";
|
|
|
string downloadMD5 = GetMD5.GetMD5HashFromFile(filenamea);
|
|
|
+ Log.WriteInfoLog("downloadMD5:" + downloadMD5 + "formm.packet_md5:" + formm.packet_md5);
|
|
|
if (downloadMD5 == formm.packet_md5)
|
|
|
{
|
|
|
try
|