Ejemplo n.º 1
0
        // 收集冗余文件
        private void CollectRedundantFiles()
        {
            List <string> allFilePath = new List <string>();

            List <string> versionFilePath = ABHelper.GetAllFilesPathInDir(ABVersion.LocalStorgePath);

            foreach (string path in versionFilePath)
            {
                allFilePath.Add(path.Replace("\\", "/"));
            }

            List <string> imageFilePath = ABHelper.GetAllFilesPathInDir(ABHttpImg.LocalStorgePath);

            foreach (string path in imageFilePath)
            {
                allFilePath.Add(path.Replace("\\", "/"));
            }

            List <string> needFilePath = new List <string>();

            if (null != ABVersion.CurVersionInfo)
            {
                needFilePath.Add(ABVersion.CurVersionInfo.VersionFilePath);
                foreach (var value in ABVersion.CurVersionInfo.VersionInfoList)
                {
                    if (int.Parse(value.Value[1]) <= ABVersion.OriginalVersionId.Id3rd)
                    {
                        continue;
                    }
                    bool   fromNativePath = true;
                    string path           = ABVersion.CurVersionInfo.GetABFullPath(value.Key, ref fromNativePath);
                    if (!fromNativePath && !string.IsNullOrEmpty(path))
                    {
                        needFilePath.Add(path);
                    }
                }
            }

            foreach (var value in allFilePath)
            {
                if (!needFilePath.Contains(value))
                {
                    deleteFiles.Add(value);
                }
            }

            List <int> versionList = new List <int>(ABVersion.LocalVersionList.Keys);

            foreach (var value in versionList)
            {
                if (value != ABVersion.ServerVersionId.Id3rd)
                {
                    ABVersion.LocalVersionList.Remove(value);
                }
            }
        }
Ejemplo n.º 2
0
        public static void Collect()
        {
            if (!Directory.Exists(m_exportPath))
            {
                Directory.CreateDirectory(m_exportPath);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("return {\n");

            foreach (string v in m_forwardLua)
            {
                sb.Append("\t\"" + v + "\",\n");
            }

            List <string> list = new List <string>();

            foreach (string v in m_folderLua)
            {
                list.AddRange(ABHelper.GetAllFilesPathInDir("Assets/Lua/" + v));
            }
            foreach (string v in list)
            {
                if (!v.EndsWith(".lua"))
                {
                    continue;
                }

                string nv = v.Replace("Assets/Lua/", "");
                nv = nv.Replace(@"/", ".");
                nv = nv.Replace(@"\", ".");
                nv = nv.Replace(".lua", "");

                if (m_exclusiveLua.Contains(nv) || m_forwardLua.Contains(nv) || m_backLua.Contains(nv))
                {
                    continue;
                }

                sb.Append("\t\"" + nv + "\",\n");
            }

            foreach (string v in m_backLua)
            {
                sb.Append("\t\"" + v + "\",\n");
            }

            sb.Append("}");

            string filePath = m_exportPath + m_configName;

            ABHelper.WriteFile(filePath, sb.ToString());

            Debug.Log(string.Format("已存储在路径{0}", filePath));
        }
Ejemplo n.º 3
0
        private static void CreatVersionTxt()
        {
            // 版号文件
            string fileUrl = CreatFileUrlMd5(ABHelper.VersionNumFileName);

            ABHelper.WriteVersionNumFile(CurVersionABExportPath + fileUrl, ABHelper.VersionNumCombine(TheVersionNum[0], TheVersionNum[1], CurVersionNum.ToString(), TheVersionNum[3]));
            // ab的依赖文件
            fileUrl = CreatFileUrlMd5(ABHelper.ManifestFileName);
            ABHelper.WriteManifestFile(CurVersionABExportPath + fileUrl, ResFolder, CurVersionManifestList);
            // 创建版本文件
            CurVersionList = ABHelper.ReadVersionFile(PlatformABExportPath + "/" + (CurVersionNum - 1) + "/" + ABHelper.VersionFileName);
            List <string> filePaths = ABHelper.GetAllFilesPathInDir(CurVersionABExportPath);

            foreach (string path in filePaths)
            {
                if (path.EndsWith(".manifest"))
                {
                    continue;
                }
                string path2 = path.Replace("\\", "/").Replace(CurVersionABExportPath, "").ToLower();
                if (path2.Equals(CurVersionNum.ToString()) || path2.Equals(ABHelper.DependFileName) || path2.Equals(ABHelper.Md5FileName))
                {
                    continue;
                }

                string value = CurVersionFileUrlMd5[path2].ToLower();
                if (CurVersionList.ContainsKey(value))
                {
                    CurVersionList.Remove(value);
                }
                CurVersionList.Add(value, new List <string>()
                {
                    ABHelper.BuildMD5ByFile(path), CurVersionNum.ToString(), ABHelper.FileSize(path).ToString(), path2
                });
            }
            ABHelper.WriteVersionFile(CurVersionABExportPath + ABHelper.VersionFileName, CurVersionList);
        }
Ejemplo n.º 4
0
        private static void CreatHotterZip(int preVersionNum)
        {
            if (preVersionNum == CurVersionNum || preVersionNum < int.Parse(TheVersionNum[2]))
            {
                return;
            }
            Debug.Log("Update Version From :" + preVersionNum + " to " + CurVersionNum);

            Dictionary <string, List <string> > preVersionMd5 = ABHelper.ReadVersionFile(PlatformABExportPath + "/" + preVersionNum.ToString() + "/" + ABHelper.VersionFileName);

            // 需要更新的文件
            Dictionary <string, string> updateFiles = new Dictionary <string, string>();

            foreach (KeyValuePair <string, List <string> > pair in CurVersionList)
            {
                string        path       = pair.Key;
                string        md5        = pair.Value[0];
                string        verId      = pair.Value[1];
                string        name       = pair.Value[3];
                List <string> oldMd5Info = null;
                if (preVersionMd5.TryGetValue(path, out oldMd5Info))
                {
                    if (oldMd5Info[0] != md5 || oldMd5Info[1] != verId)
                    {
                        updateFiles.Add(name, verId);
                    }
                }
                else
                {
                    updateFiles.Add(name, verId);
                }
            }
            // version添加进来
            if (File.Exists(CurVersionABExportPath + ABHelper.VersionFileName) && !updateFiles.ContainsKey(ABHelper.VersionFileName))
            {
                updateFiles.Add(ABHelper.VersionFileName, CurVersionNum.ToString());
            }

            // 生成更新文件夹
            string zipFolder = ABExportHotterZipPath + preVersionNum + "-" + CurVersionNum;

            if (Directory.Exists(zipFolder))
            {
                Directory.Delete(zipFolder, true);
            }
            Directory.CreateDirectory(zipFolder);

            // 复制到更新文件夹下
            foreach (var fileInfo in updateFiles)
            {
                string sourceFile = PlatformABExportPath + "/" + fileInfo.Value + "/" + fileInfo.Key;
                string copyFile   = zipFolder + "/" + fileInfo.Value + "/" + fileInfo.Key;
                if (File.Exists(copyFile))
                {
                    File.Delete(copyFile);
                }
                string copyPath = Path.GetDirectoryName(copyFile);
                if (!Directory.Exists(copyPath))
                {
                    Directory.CreateDirectory(copyPath);
                }
                // 资源拷贝
                File.Copy(sourceFile, copyFile, true);
            }

            // 压缩
            string zipFullName = zipFolder + ".zip";

            zipFolder = zipFolder.Replace("\\", "/");
            DirectoryInfo sourzeZipFolder = new DirectoryInfo(zipFolder);

            FastZipEvents zipEvents = new FastZipEvents();

            zipEvents.DirectoryFailure = DirectoryFailureHandler;
            zipEvents.FileFailure      = FileFailureHandler;
            zipEvents.Progress         = ProgressHandler;

            // 压缩前的文件大小
            filePreSize = 0;
            fileZipSize = 0;
            foreach (var path in ABHelper.GetAllFilesPathInDir(sourzeZipFolder.FullName))
            {
                FileInfo fileInfo = new FileInfo(path);
                filePreSize += fileInfo.Length;
            }

            // 进行压缩
            ZipSuccess = true;
            ABHelper.ZipFile(zipFullName, sourzeZipFolder.FullName, zipEvents);
            while (!ZipSuccess)
            {
                ZipSuccess = true;
                ABHelper.ZipFile(zipFullName, sourzeZipFolder.FullName, zipEvents);
            }
            EditorUtility.ClearProgressBar();

            // 压缩后的文件大小
            // 1-2.ini
            FileInfo zipfile = new FileInfo(zipFullName);

            ABHelper.WriteFile(zipFolder + ".ini", ("zipsize:" + zipfile.Length + ":" + filePreSize));
        }
Ejemplo n.º 5
0
        private static bool CreatABPacker(BuildTarget platform)
        {
            List <string> updateFileList   = new List <string>();
            List <string> updateScriptList = new List <string>();

            Dictionary <string, string>         lastVersionMd5List          = ABHelper.ReadMd5File(PlatformABExportPath + "/" + (CurVersionNum - 1) + "/" + ABHelper.Md5FileName);
            Dictionary <string, List <string> > lastVersionDependenciesList = ABHelper.ReadDependFile(PlatformABExportPath + "/" + (CurVersionNum - 1) + "/" + ABHelper.DependFileName);

            foreach (KeyValuePair <string, List <string> > pair in CurVersionDependenciesList)
            {
                string pathName = pair.Key;
                if (!lastVersionDependenciesList.ContainsKey(pathName.ToLower()))
                {
                    if (IsScriptFileRes(pathName))
                    {
                        updateScriptList.Add(pathName);
                    }
                    else
                    {
                        updateFileList.Add(pathName);
                    }
                    continue;
                }
                foreach (string depend in pair.Value)
                {
                    if (!lastVersionDependenciesList[pathName.ToLower()].Contains(depend.ToLower()))
                    {
                        if (IsScriptFileRes(pathName))
                        {
                            updateScriptList.Add(pathName);
                        }
                        else
                        {
                            updateFileList.Add(pathName);
                        }
                        break;
                    }
                    else if (CurVersionMd5List[depend].ToLower() != lastVersionMd5List[depend.ToLower()])
                    {
                        if (IsScriptFileRes(pathName))
                        {
                            updateScriptList.Add(pathName);
                        }
                        else
                        {
                            updateFileList.Add(pathName);
                        }
                        break;
                    }
                }
            }

            // 检测cs和dll脚本
            if (updateScriptList.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var pair in updateScriptList)
                {
                    sb.AppendLine(pair);
                }
                if (EditorUtility.DisplayDialog("提示", "检测到有cs等脚本的更新!!\n “停止”则中断打包,“忽略”则继续。如下:\n" + sb, "停止", "忽略"))
                {
                    throw new Exception("打包中断!!!!!!!!!!");
                }
            }

            if (updateFileList.Count > 0)
            {
                ClearAssetBundlesName();
                AssetDatabase.Refresh();

                foreach (string path in updateFileList)
                {
                    string fileName;
                    switch (CurVersionFileType[path])
                    {
                    case "0":
                        foreach (string path2 in CurVersionDependenciesList[path])
                        {
                            fileName = (ABHelper.GetFileFolderPath(path2).Replace(ResFolder, "")) + ".ab";
                            fileName = CreatFileUrlMd5(fileName);
                            AssetImporter.GetAtPath(path2).assetBundleName = fileName;
                        }
                        break;

                    case "1":
                        CopyLuaFiles(path);
                        break;

                    case "2":
                        fileName = (ABHelper.GetFileFullPathWithoutFtype(path).Replace(ResFolder, "")) + ".ab";
                        fileName = CreatFileUrlMd5(fileName);
                        AssetImporter.GetAtPath(path).assetBundleName = fileName;
                        break;

                    case "3":
                        fileName = (ABHelper.GetFileFullPathWithoutFtype(path).Replace(ResFolder, "")) + ".ab";
                        fileName = CreatFileUrlMd5(fileName);
                        AssetImporter.GetAtPath(path).assetBundleName = fileName;
                        break;

                    default: break;
                    }
                }
                try
                {
                    // 生成ab文件
                    BuildPipeline.BuildAssetBundles(CurVersionABExportPath, BuildAssetBundleOptions.ChunkBasedCompression | BuildAssetBundleOptions.DeterministicAssetBundle, platform);
                }
                catch (Exception e)
                {
                    BuildFailure();
                    Debug.LogError("打包异常!!" + e.Message);
                }
                System.Threading.Thread.Sleep(1000);

                ClearAssetBundlesName();
                AssetDatabase.Refresh();
            }
            else
            {
                BuildFailure();
            }

            bool result = updateFileList.Count > 0;

            if (result)
            {
                // 删除不用的manifest
                List <string> allFiles = ABHelper.GetAllFilesPathInDir(PlatformABExportPath);
                foreach (string path in allFiles)
                {
                    if (path.EndsWith(".manifest"))
                    {
                        File.Delete(path);
                    }
                    if (path.EndsWith(CurVersionNum.ToString()))
                    {
                        File.Delete(path);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
        private static void CreatFileDependencies()
        {
            List <string> scriptPathList       = new List <string>();
            List <string> folderBundlePathList = new List <string>();
            List <string> fileBundlePathList   = new List <string>();
            List <string> sceneBundlePathList  = new List <string>();
            List <string> luaPathList          = new List <string>();

            foreach (string path in ScriptFolderPath)
            {
                string fullPath = AssetFolder + path;
                scriptPathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            foreach (string path in BundleFolderPath)
            {
                string fullPath = ResFolder + path;
                folderBundlePathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            foreach (string path in BundleFilePath)
            {
                string fullPath = ResFolder + path;
                fileBundlePathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            foreach (string path in BundleScenePath)
            {
                string fullPath = AssetFolder + path;
                sceneBundlePathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            foreach (string path in BundleLuaPath)
            {
                string fullPath = AssetFolder + path;
                luaPathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            CurVersionFileType         = new Dictionary <string, string>();
            CurVersionDependenciesList = new Dictionary <string, List <string> >();
            CurVersionManifestList     = new Dictionary <string, List <string> >();
            CurVersionMd5List          = new Dictionary <string, string>();
            foreach (string path in scriptPathList)
            {
                if (!IsScriptFileRes(path))
                {
                    continue;
                }
                string filePath = path.Replace("\\", "/");
                if (!CurVersionMd5List.ContainsKey(filePath))
                {
                    CurVersionMd5List.Add(filePath, ABHelper.BuildMD5ByFile(filePath));
                }
                if (!CurVersionDependenciesList.ContainsKey(filePath))
                {
                    CurVersionDependenciesList.Add(filePath, new List <string>());
                    CurVersionFileType.Add(filePath, "4");
                }
                CurVersionDependenciesList[filePath].Add(filePath);
            }
            foreach (string path in folderBundlePathList)
            {
                if (!IsNeedFileRes(path))
                {
                    continue;
                }
                string filePath = path.Replace("\\", "/");
                if (!CurVersionMd5List.ContainsKey(filePath))
                {
                    CurVersionMd5List.Add(filePath, ABHelper.BuildMD5ByFile(filePath));
                }

                string filePath2 = ABHelper.GetFileFolderPath(filePath);
                if (!CurVersionDependenciesList.ContainsKey(filePath2))
                {
                    CurVersionDependenciesList.Add(filePath2, new List <string>());
                    CurVersionFileType.Add(filePath2, "0");
                }
                CurVersionDependenciesList[filePath2].Add(filePath);
            }
            foreach (string path in luaPathList)
            {
                if (!path.EndsWith(".lua"))
                {
                    continue;
                }
                string filePath = path.Replace("\\", "/");
                if (!CurVersionMd5List.ContainsKey(filePath))
                {
                    CurVersionMd5List.Add(filePath, ABHelper.BuildMD5ByFile(filePath));
                }
                if (!CurVersionDependenciesList.ContainsKey(filePath))
                {
                    CurVersionDependenciesList.Add(filePath, new List <string>());
                    CurVersionFileType.Add(filePath, "1");
                }
                CurVersionDependenciesList[filePath].Add(filePath);
            }
            foreach (string path in fileBundlePathList)
            {
                if (!IsNeedFileRes(path))
                {
                    continue;
                }
                string   filePath    = path.Replace("\\", "/");
                string[] dependPaths = AssetDatabase.GetDependencies(filePath);
                if (dependPaths.Length > 0)
                {
                    CurVersionDependenciesList.Add(filePath, new List <string>(dependPaths));
                    CurVersionFileType.Add(filePath, "2");
                    foreach (string path1 in dependPaths)
                    {
                        if (!CurVersionMd5List.ContainsKey(path1))
                        {
                            CurVersionMd5List.Add(path1, ABHelper.BuildMD5ByFile(path1));
                        }
                        if (path1.Contains(ResFolder) && filePath != path1)
                        {
                            if (!CurVersionManifestList.ContainsKey(filePath))
                            {
                                CurVersionManifestList.Add(filePath, new List <string>());
                            }
                            CurVersionManifestList[filePath].Add(path1);
                        }
                    }
                }
            }
            foreach (string path in sceneBundlePathList)
            {
                if (!path.EndsWith(".unity"))
                {
                    continue;
                }
                string   filePath    = path.Replace("\\", "/");
                string[] dependPaths = AssetDatabase.GetDependencies(filePath);
                if (dependPaths.Length > 0)
                {
                    CurVersionDependenciesList.Add(filePath, new List <string>(dependPaths));
                    CurVersionFileType.Add(filePath, "3");
                    foreach (string path1 in dependPaths)
                    {
                        if (!CurVersionMd5List.ContainsKey(path1))
                        {
                            CurVersionMd5List.Add(path1, ABHelper.BuildMD5ByFile(path1));
                        }
                        if (path1.Contains(ResFolder) && filePath != path1)
                        {
                            if (!CurVersionManifestList.ContainsKey(filePath))
                            {
                                CurVersionManifestList.Add(filePath, new List <string>());
                            }
                            CurVersionManifestList[filePath].Add(path1);
                        }
                    }
                }
            }

            // 版本所需资源的md5码保存
            ABHelper.WriteMd5File(CurVersionABExportPath + ABHelper.Md5FileName, CurVersionMd5List);
            // 文件的依赖关系
            ABHelper.WriteDependFile(CurVersionABExportPath + ABHelper.DependFileName, CurVersionDependenciesList);
        }
Ejemplo n.º 7
0
        public static bool BuildNativeAB(string platformName)
        {
            System.GC.Collect();
            System.GC.Collect();

            ReadFile();
            ParseAllDir();
            RootFolderNmae();
            ParseTheVersion();
            FilesFilter();

            string nativePath = string.Format("{0}/{1}", ABHelper.AppNativeVersionPath, ABHelper.NativeFileName);

            // 删
            List <string> nativeList = ABHelper.ReadNativeFileByPath(nativePath);

            foreach (var v in nativeList)
            {
                string p = string.Format("{0}/{1}", ABHelper.AppNativeVersionPath, v);
                if (File.Exists(p))
                {
                    File.Delete(p);
                }
            }
            if (File.Exists(nativePath))
            {
                File.Delete(nativePath);
            }

            // 增
            string path = string.Format("{0}/../../../assetBundle/{1}/{2}/{3}.{4}/HotterZip/{5}-{6}/", Application.dataPath, TheRootFolderName, platformName, TheVersionNum[0], TheVersionNum[1], -1, TheVersionNum[2]);

            if (!Directory.Exists(path))
            {
                Debug.LogError("路径不存在:" + path);
                return(false);
            }
            if (!Directory.Exists(ABHelper.AppNativeVersionPath))
            {
                Directory.CreateDirectory(ABHelper.AppNativeVersionPath);
            }
            Dictionary <string, string> versionInfo = ReadVersionFileByPath(path + TheVersionNum[2] + "/version.ini");
            List <string> files = ABHelper.GetAllFilesPathInDir(path);

            nativeList.Clear();
            string name1 = "";
            string path1 = "";
            string path2 = "";

            foreach (var v in files)
            {
                // 过滤 ui,lua和audio文件
                path1 = v.Replace("\\", "/");
                name1 = ABHelper.GetFileName(path1);
                if (versionInfo.ContainsKey(name1))
                {
                    if (!CheckRemoveDir(versionInfo[name1]))
                    {
                        continue;
                    }
                }

                path2 = ABHelper.AppNativeVersionPath + "/" + name1;
                File.Copy(path1, path2, true);

                if (!v.EndsWith("version.ini"))
                {
                    nativeList.Add(name1);
                }
            }
            // version.ini 放置尾包!!
            nativeList.Add("version.ini");

            // 生成列表文件
            ABHelper.WriteNativeFile(nativePath, nativeList);
            AssetDatabase.Refresh();

            System.GC.Collect();
            Debug.Log("streamingAssets文件生成成功!!文件源路径:" + path);
            return(true);
        }
Ejemplo n.º 8
0
        private static void CreatPacker(BuildTarget platform)
        {
            ClearAssetBundlesName();
            AssetDatabase.Refresh();

            CurVersionManifestList = new Dictionary <string, List <string> >();
            List <string> folderBundlePathList = new List <string>();
            List <string> fileBundlePathList   = new List <string>();
            List <string> sceneBundlePathList  = new List <string>();
            List <string> luaPathList          = new List <string>();

            foreach (string path in BundleFolderPath)
            {
                string fullPath = ResFolder + path;
                folderBundlePathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            foreach (string path in BundleFilePath)
            {
                string fullPath = ResFolder + path;
                fileBundlePathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            foreach (string path in BundleScenePath)
            {
                string fullPath = AssetFolder + path;
                sceneBundlePathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }
            foreach (string path in BundleLuaPath)
            {
                string fullPath = AssetFolder + path;
                luaPathList.AddRange(ABHelper.GetAllFilesPathInDir(fullPath));
            }

            foreach (string path in folderBundlePathList)
            {
                if (!IsNeedFileRes(path))
                {
                    continue;
                }
                // "Assets/Resources/UI/Tips/Tips.bytes"
                string assetPath = path.Replace("\\", "/");
                string abName    = ABHelper.GetFileFolderPath(assetPath.Replace(ResFolder, "")) + ".ab";
                AssetImporter.GetAtPath(assetPath).assetBundleName = CreatFileUrlMd5(abName);
            }
            foreach (string path in fileBundlePathList)
            {
                if (!IsNeedFileRes(path))
                {
                    continue;
                }
                string assetPath = path.Replace("\\", "/");
                string abName    = ABHelper.GetFileFullPathWithoutFtype(assetPath.Replace(ResFolder, "")) + ".ab";
                AssetImporter.GetAtPath(assetPath).assetBundleName = CreatFileUrlMd5(abName);

                // 依赖文件
                string[] dependPaths = AssetDatabase.GetDependencies(assetPath);
                if (dependPaths.Length > 0)
                {
                    foreach (string path1 in dependPaths)
                    {
                        if (path1.Contains(ResFolder) && assetPath != path1)
                        {
                            assetPath = assetPath.Replace(ResFolder, "");
                            if (!CurVersionManifestList.ContainsKey(assetPath))
                            {
                                CurVersionManifestList.Add(assetPath, new List <string>());
                            }
                            CurVersionManifestList[assetPath].Add(path1.Replace(ResFolder, ""));
                        }
                    }
                }
            }
            foreach (string path in sceneBundlePathList)
            {
                if (!path.EndsWith(".unity"))
                {
                    continue;
                }
                string assetPath = path.Replace("\\", "/");
                string abName    = ABHelper.GetFileFullPathWithoutFtype(assetPath.Replace(ResFolder, "") + ".ab");
                AssetImporter.GetAtPath(assetPath).assetBundleName = CreatFileUrlMd5(abName);

                // 依赖文件
                string[] dependPaths = AssetDatabase.GetDependencies(assetPath);
                if (dependPaths.Length > 0)
                {
                    foreach (string path1 in dependPaths)
                    {
                        if (path1.Contains(ResFolder) && assetPath != path1)
                        {
                            assetPath = assetPath.Replace(AssetFolder, "");
                            if (!CurVersionManifestList.ContainsKey(assetPath))
                            {
                                CurVersionManifestList.Add(assetPath, new List <string>());
                            }
                            CurVersionManifestList[assetPath].Add(path1.Replace(ResFolder, ""));
                        }
                    }
                }
            }
            foreach (string path in luaPathList)
            {
                if (!path.EndsWith(".lua"))
                {
                    continue;
                }
                string filePath = path.Replace("\\", "/");
                CopyLuaFiles(filePath);
            }

            System.GC.Collect();
            BuildPipeline.BuildAssetBundles(PlatformABExportPath, BuildAssetBundleOptions.ChunkBasedCompression | BuildAssetBundleOptions.DeterministicAssetBundle, platform);

            ClearAssetBundlesName();
            AssetDatabase.Refresh();

            // ab的依赖文件
            string fileUrl = CreatFileUrlMd5(ABHelper.ManifestFileName);

            ABHelper.WriteManifestFile(PlatformABExportPath + "/" + fileUrl, CurVersionManifestList);

            // 删除不用的manifest
            List <string> allFiles = ABHelper.GetAllFilesPathInDir(PlatformABExportPath);

            foreach (string path in allFiles)
            {
                if (path.EndsWith(".manifest"))
                {
                    File.Delete(path);
                }
                if (ABHelper.GetFileNameWithoutSuffix(path.Replace("\\", "/")) == PlatformName)
                {
                    File.Delete(path);
                }
            }

            // 写入文件
            StringBuilder txt = new StringBuilder();

            foreach (var pair in CurVersionFileUrlMd5)
            {
                txt.Append(pair.Value + ":" + pair.Key + "\r");
            }
            ABHelper.WriteFileByBytes(PlatformABExportPath + "/" + ABHelper.VersionFileName, Encoding.UTF8.GetBytes(txt.ToString().TrimEnd().ToLower()));
        }