示例#1
0
 protected override void Thread_Looping()
 {
     base.Thread_Looping();
     if (resourceURLListEnumerator.MoveNext() && relativePathListEnumerator.MoveNext())
     {
         URLWithCDN urlTemp      = resourceURLListEnumerator.Current;
         string     relativePath = relativePathListEnumerator.Current;
         if (urlTemp == null)
         {
             return;
         }
         if (urlTemp.IsLocal)
         {
             connection = new LocalConnect(urlTemp.ToString(), Global.Instance.CombineFullPath(downloadPath.URL, relativePath));
         }
         else
         {
             connection = new HttpConnect(urlTemp.ToString(), Global.Instance.CombineFullPath(downloadPath.URL, relativePath), string.Empty);
         }
         connection.DownloadResource(delegate(bool result, object log)
         {
             AppendMissionLog(log);
             if (result)
             {
                 urlSucceedNumber++;
             }
             else
             {
                 urlFailedNumber++;
             }
             SetMissionProgress((urlSumNumber == 0) ? (0) : ((urlFailedNumber + urlSucceedNumber) / ((float)urlSumNumber)));
         });
     }
     else
     {
         EndMissionThread();
     }
 }
示例#2
0
 protected override void Thread_Looping()
 {
     base.Thread_Looping();
     if (resourceURLListEnumerator.MoveNext())
     {
         URLWithCDN urlTemp = resourceURLListEnumerator.Current;
         if (urlTemp == null)
         {
             return;
         }
         if (urlTemp.IsLocal)
         {
             connection = new LocalConnect(urlTemp.ToString());
         }
         else
         {
             connection = new HttpConnect(urlTemp.ToString());
         }
         connection.CheckResource(delegate(bool result, object log)
         {
             AppendMissionLog(log);
             if (result)
             {
                 urlSucceedNumber++;
             }
             else
             {
                 urlFailedNumber++;
             }
             SetMissionProgress((urlSumNumber == 0) ? (0) : ((urlFailedNumber + urlSucceedNumber) / ((float)urlSumNumber)));
         });
     }
     else
     {
         EndMissionThread();
     }
 }