예제 #1
0
        public static List <string> PackZips(string outpath)
        {
            List <string> finalZipFiles = new List <string>();
            var           allDirs       = AssetDatabase.GetAllAssetPaths().Where(path => (Directory.Exists(path)));
            List <string> zipdirs       = new List <string> ();

            foreach (var k in allDirs)
            {
                UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(k, typeof(UnityEngine.Object));
                if (QAssetBundleTool.HasPTABLabel(obj, QAssetBundleTool.LABEL_ZIP))
                {
                    zipdirs.Add(k);
                }
            }
            foreach (var path in zipdirs)
            {
                string tempDir = "temp_pt";
                if (Directory.Exists(tempDir))
                {
                    Directory.Delete(tempDir, true);
                }
                Directory.CreateDirectory(tempDir);
                AssetDatabase.Refresh();

                DirectoryCopy(path, tempDir, true);
                //FileUtil.CopyFileOrDirectory(path,tempDir);
                cleanMeta(tempDir);
                PackFiles(outpath + "/" + Path.GetFileName(path) + ".zip", tempDir);
                Directory.Delete(tempDir, true);
                finalZipFiles.Add(outpath + "/" + Path.GetFileName(path) + ".zip");
            }

            return(finalZipFiles);
        }
예제 #2
0
        /// <summary>
        /// 遍历压缩所有zip文件
        /// </summary>
        /// <returns>The zips.</returns>
        /// <param name="outpath">Outpath.</param>
        public static List <string> PackZips(string outpath)
        {
            List <string> finalZipFiles = new List <string>();
            var           allDirs       = AssetDatabase.GetAllAssetPaths().Where(path => (Directory.Exists(path)));

            foreach (var path in allDirs)
            {
                UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(path, typeof(UnityEngine.Object));
                if (QAssetBundleTool.HasPTABLabel(obj, QAssetBundleTool.LABEL_ZIP))
                {
                    PackFiles(outpath + "/" + Path.GetFileName(path) + ".zip", path);
                    finalZipFiles.Add(outpath + "/" + Path.GetFileName(path) + ".zip");
                }
            }
            return(finalZipFiles);
        }
예제 #3
0
        /// <summary>
        /// 遍历复制所有标记了file的文件
        /// </summary>
        /// <returns>The point files.</returns>
        /// <param name="outpath">Outpath.</param>
        public static List <string> PackPTFiles(string outpath)
        {
            List <string> finalMarkedFiles = new List <string>();
            var           allFiles         = AssetDatabase.GetAllAssetPaths().Where(path => (File.Exists(path)));
            List <string> files            = new List <string> ();

            foreach (var k in allFiles)
            {
                UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(k, typeof(UnityEngine.Object));
                if (QAssetBundleTool.HasPTABLabel(obj, QAssetBundleTool.LABEL_FILE))
                {
                    files.Add(k);
                    FileUtil.ReplaceFile(k, outpath + "/" + Path.GetFileName(k));
                    finalMarkedFiles.Add(outpath + "/" + Path.GetFileName(k));
                }
            }

            return(finalMarkedFiles);
        }