public static void RemoveInvalidAssetBundleInner(string path, AssetDataTable table)
        {
            string[] dirs = Directory.GetDirectories(path);
            if (dirs != null && dirs.Length > 0)
            {
                for (int i = 0; i < dirs.Length; ++i)
                {
                    RemoveInvalidAssetBundleInner(dirs[i], table);
                }
            }

            string[] files = Directory.GetFiles(path);
            if (files != null && files.Length > 0)
            {
                for (int i = 0; i < files.Length; ++i)
                {
                    string p = AssetBundlePath2ABName(files[i]);

                    if (!AssetFileFilter.IsAssetBundle(p))
                    {
                        continue;
                    }
                    if (table.GetABUnit(p) == null)
                    {
                        File.Delete(files[i]);
                        File.Delete(files[i] + ".meta");
                        File.Delete(files[i] + ".manifest");
                        File.Delete(files[i] + ".manifest.meta");
                        Log.e("#Delete Invalid AB:" + p);
                    }
                }

                files = Directory.GetFiles(path);
                if (files == null || files.Length == 0)
                {
                    Directory.Delete(path);
                }
            }
            else
            {
                Directory.Delete(path);
            }
        }
Exemple #2
0
        public static void BuildFolderData()
        {
            //Debug.LogError("BuildFolderData");
            FolderDataTable.S.Clear();
            string targetPath = ProjectPathConfig.FileAssetRelativePath;

            //DirectoryInfo directory = new DirectoryInfo(targetPath);

            string[] files = Directory.GetFiles(targetPath, "*.*", SearchOption.AllDirectories);
            for (int i = 0; i < files.Length; i++)
            {
                if (AssetFileFilter.IsAsset(files[i]))
                {
                    FolderDataTable.S.AddFolderData(files[i]);
                }
            }

            FolderDataTable.S.Save();
        }