private void LoadRemoteVersionData() { DownloadTask _tempTask = new DownloadTask(); _tempTask.Url = this.m_remoteUrl + m_versionTxtName; DownloadMgr.GetInstance().InitDownloadCallBacks(this.ParseRemoteVersionData, this.OneTaskProgressChanged, null); DownloadMgr.GetInstance().AsynDownLoadText(_tempTask); }
/// <summary> /// 抛给下载器进行下载 /// </summary> private void PushDownloadTask() { DownloadTask firstTask = this.m_needDownloadTasks.Peek(); this.m_currTask = firstTask; firstTask.Url = this.m_remoteUrl + firstTask.FileName; //设置保存本地的目录 firstTask.FileName = this.m_localPath + firstTask.FileName; string path = Path.GetDirectoryName(firstTask.FileName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } DownloadMgr.GetInstance().InitDownloadCallBacks(null, this.OneTaskProgressChanged, this.OneTaskFinished); DownloadMgr.GetInstance().AsynDownLoadFile(firstTask); }
//所有的下载任务都完成了 private void AllDownloadTaskFinished(bool updateVersionTxt) { Debug.Log("All Task Finish"); if (updateVersionTxt) { //替换本地的Version.txt为web服务器上的,保持版本最新 Util.CreateFile(this.m_localPath, m_versionTxtName, this.m_remoteVersionData); Debug.Log(m_versionTxtName + "已更新"); } this.m_localVersion = null; this.m_remoteVersion = null; this.m_remoteVersionData = null; //释放downloadmgr DownloadMgr.GetInstance().Dispose(); if (m_versionMgrCallback != null) { this.m_versionMgrCallback(); } }