private static void BuildAudioClipsInFolder() { string folderPath = EditorUtils.GetSelectedDirAssetsPath(); DirectoryInfo dInfo = new DirectoryInfo(EditorUtils.AssetsPath2ABSPath(folderPath)); DirectoryInfo[] subFolders = dInfo.GetDirectories(); if (subFolders == null || subFolders.Length == 0) { BuildSpritesData(folderPath); } else { for (int i = 0; i < subFolders.Length; ++i) { BuildSpritesData(EditorUtils.ABSPath2AssetsPath(subFolders[i].FullName)); } BuildSpritesData(folderPath); } }
private static void ProcessTexture(string folderPath) { string workPath = EditorUtils.AssetsPath2ABSPath(folderPath); var filePaths = Directory.GetFiles(workPath); for (int i = 0; i < filePaths.Length; ++i) { string relPath = EditorUtils.ABSPath2AssetsPath(filePaths[i]); UnityEngine.Object[] objs = AssetDatabase.LoadAllAssetsAtPath(relPath); if (objs != null) { for (int j = 0; j < objs.Length; ++j) { if (objs[j] is Texture2D) { ProcessTextureImport(relPath); } } } } }
private ABState VisitorFolder(string absPath, IFolderVisitor visitor) { if (visitor == null) { return(ABState.NONE); } ABState state = new ABState(); var dirs = Directory.GetDirectories(absPath); if (dirs.Length > 0) { for (int i = 0; i < dirs.Length; ++i) { ABState subState = VisitorFolder(dirs[i], visitor); if (subState.hasMixed) { state.hasMixed = true; } if (subState.isLost) { state.isLost = true; } } } var files = Directory.GetFiles(absPath); if (files.Length > 0) { for (int i = 0; i < files.Length; ++i) { if (!AssetFileFilter.IsAsset(files[i])) { continue; } AssetImporter ai = AssetImporter.GetAtPath(EditorUtils.ABSPath2AssetsPath(files[i])); if (ai != null) { if (!string.IsNullOrEmpty(ai.assetBundleName)) { //Log.i("Files:" + files[i] + " ---> " + ai.assetBundleName); string assetPath = EditorFileUtils.RemoveFileExtend(ai.assetPath).ToLower(); string bundleName = EditorFileUtils.RemoveFileExtend(ai.assetBundleName); if (assetPath.EndsWith(bundleName)) { //Log.i("File Flag:" + assetPath); state.flag |= ABStateDefine.FILE; visitor.OnAssetVisitorResult(ai, ABStateDefine.FILE); } else { //Log.i("##Folder Flag:" + assetPath); state.flag |= ABStateDefine.FOLDER; visitor.OnAssetVisitorResult(ai, ABStateDefine.FOLDER); } } else { state.isLost = true; visitor.OnAssetVisitorResult(ai, ABStateDefine.LOST); } } } } if (state.isMixedFlag) { state.hasMixed = true; } visitor.OnFolderVisitorResult(absPath, state); return(state); }