//加载配置文件 public bool LoadConfigFile() { FilePackLocal = new XML_FilePack(ResPath.LocalPath + ResPath.CurrentPathName); PackMD5Local = new XML_PackMD5(ResPath.LocalPath + ResPath.CurrentPathName); PackDependLocal = new XML_PackDepend(ResPath.LocalPath + ResPath.CurrentPathName); return(true); }
//清除更新残留数据 public void ClearUpdateData() { if (PackMD5Remote != null) { PackMD5Remote.Clear(); PackMD5Remote = null; } if (PackMD5Local != null) { PackMD5Local.Clear(); PackMD5Local = null; } if (FilePackRemote != null) { FilePackRemote.Clear(); FilePackRemote = null; } if (FilePackLocal != null) { FilePackLocal.Clear(); FilePackLocal = null; } if (PackDependRemote != null) { PackDependRemote.Clear(); PackDependRemote = null; } if (PackDependLocal != null) { PackDependLocal.Clear(); PackDependLocal = null; } if (UpdateList != null) { UpdateList.Clear(); UpdateList = null; } if (SuccList != null) { SuccList.Clear(); SuccList = null; } if (FailList != null) { FailList.Clear(); FailList = null; } }
//协程 下载FilePack.xml IEnumerator Coroutine_DownloadFilePack() { string url = ResPath.GetServerURL(ResPath.FilePackFileName); WWW down = new WWW(url); while (!down.isDone) { yield return(down); } if (down.isDone && down.error == null) {//保存 ResUtil.SaveFile(down.bytes, ResPath.LocalTempCachePath, ResPath.FilePackFileName); } else { Debug.LogWarning("WWW failed, url:" + url + ", isDone:" + down.isDone + ", error:" + down.error); } FilePackRemote = new XML_FilePack(ResPath.LocalTempCachePath); FilePackLocal = new XML_FilePack(ResPath.LocalPath + ResPath.CurrentPathName); --DownXmlCount; }
//更新 public void Update(string packname, XML_FilePack remote) { InfoList.RemoveAll(item => item.PackName == packname); InfoList.AddRange(remote.InfoList.FindAll(item => item.PackName == packname)); }