private static void FreshWebCollection() { window.multyDrawersInfo.selfInfos.Clear(); window.multyDrawersInfo.infos.Clear(); HttpPkg.GetPkgInfoList((m) => { var datas = m.data; List <PkgInfoListModel.Data> localDatas = new List <PkgInfoListModel.Data>(); if (File.Exists(pkgjsonPath)) { localDatas = JsonUtility.FromJson <PkgInfoListModel>(File.ReadAllText(pkgjsonPath)).data; } File.WriteAllText(pkgjsonPath, JsonUtility.ToJson(m, true)); for (int i = 0; i < datas.Count; i++) { var _data = datas[i]; var _tmp = localDatas.Find((d) => { return(d.pkg_name == _data.pkg_name && d.last_time == _data.last_time && d.last_version == _data.last_version); }); localDatas.RemoveAll((d) => { return(d.pkg_name == _data.pkg_name); }); if (_tmp != null) { string path = Path.Combine(pkgversionjsonPath, _data.pkg_name + ".json"); WebCollectionInfo info = JsonUtility.FromJson <WebCollectionInfo>(File.ReadAllText(path)); TryFinish(info, localDatas, datas); } else { HttpPkg.GetPkgInfos(_data.pkg_name, (model) => { WebCollectionInfo info = new WebCollectionInfo() { name = model.data[0].pkg_name, author = model.data[0].author, }; WebCollectionInfo.Version[] versions = new WebCollectionInfo.Version[model.data.Count]; for (int j = 0; j < model.data.Count; j++) { versions[j] = new WebCollectionInfo.Version() { version = model.data[j].version, describtion = model.data[j].describtion, dependences = model.data[j].GetDependences().ToArray(), helpurl = model.data[j].help_url, unityVersion = model.data[j].unity_version, assetPath = model.data[j].pkg_path, }; } info.versions = versions; File.WriteAllText(Path.Combine(pkgversionjsonPath, info.name + ".json"), JsonUtility.ToJson(info, true)); TryFinish(info, localDatas, datas); }); } } }); }