public void start(VZDownloadCallback l) { updatePath = AppDomain.CurrentDomain.BaseDirectory + @"\Update\" + VZ_AppHelper.GetInstance().systemInfo.updateBuild + @"\"; if (l != null) { callback = l; } if (fileList != null && fileList.Count > 0) { if (downloadThread == null) { downloadThread = new Thread(new ThreadStart(() => { int progress = 0; for (;;) { if (fileList.Count <= 0) { //Properties.Settings.Default.isUpdateReady = true; //Properties.Settings.Default.updatelist = ""; //Properties.Settings.Default.Save(); if (callback != null) { callback.VZDownloadAllComplete(); } break; } else { VZ_FileInfos infos = fileList[0]; try { if (oldFileDic.ContainsKey(infos.path)) { if (oldFileDic[infos.path].Equals(infos.md5)) { if (callback != null) { callback.VZDownloadComplete(infos); } fileList.Remove(infos); continue; } } downloadFile(infos, infos.url, updatePath + infos.path, ref progress); } catch (Exception ex) { Scratch.Log.LogConfig.Logger.Error("出错:", ex); break; } fileList.Remove(infos); } } })); downloadThread.Start(); } else { return; } } }
public void setListener(VZDownloadCallback l) { callback = l; }