public void Mearge(AssetBundleCollector bundleCollector)
        {
            if (bundleCollector == null || bundleCollector.IsEmpty())
            {
                return;
            }
            List <AssetBundleBuild> list = bundleCollector.GetBuildList();

            this.buildList.AddRange(list);
        }
Example #2
0
        public static VersionConfig GenerateVersionConfig(AssetBundleCollector collector)
        {
            VersionConfig vc = VersionUtil.ReadConfig("config/version") ?? new VersionConfig();

            VersionConfig newVC = new VersionConfig();

            newVC.version = vc.version + 1;

            List <AssetBundleBuild> buildList = collector.GetBuildList();

            for (int i = 0; i < buildList.Count; ++i)
            {
                AssetBundleBuild build = buildList[i];
                string           file  = Application.streamingAssetsPath.Combine(build.assetBundleName);
                if (PathUtil.ExistsFile(file))
                {
                    FileStream fs    = new FileStream(file, FileMode.Open);
                    byte[]     bytes = new byte[fs.Length];
                    fs.Read(bytes, 0, bytes.Length);
                    string md5 = CryptUtil.GetMD5(bytes);
                    fs.Close();
                    VersionFileConfig vfc = new VersionFileConfig();
                    vfc.path     = build.assetBundleName;
                    vfc.md5      = md5;
                    vfc.sizeByte = bytes.Length;
                    if (!newVC.fileDict.ContainsKey(vfc.path))
                    {
                        newVC.fileDict.Add(vfc.path, vfc);
                    }
                    else
                    {
                        Debug.LogError("重复资源:" + vfc.path);
                    }
                }
            }
            return(newVC);
        }