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