private void SearchForAllFiles(string directoryAbsolutePath, ref List <string> filesPath)
        {
            filesPath.AddRange(Directory.GetFiles(directoryAbsolutePath));

            string[] folderPaths = Directory.GetDirectories(directoryAbsolutePath);
            for (int i = 0; i < folderPaths.Length; i++)
            {
                string folderPath = folderPaths[i];
                if (!PresetManagerUtils.HasAnyPresetForFolder(PresetManagerUtils.AbsoluteToRelativePath(folderPath)))
                {
                    SearchForAllFiles(folderPath, ref filesPath);
                }
            }
        }
        private void ReadFolder()
        {
            string[] files = GetAllFiles(absoluteFolderPath);

            HashSet <AssetImporter> assetImporters      = new HashSet <AssetImporter>();
            HashSet <Type>          assetImportersTypes = new HashSet <Type>();

            for (var i = 0; i < files.Length; i++)
            {
                string absoluteFilePath = files[i];
                if (absoluteFilePath.EndsWith(".meta"))
                {
                    continue;
                }
                string relativeFilePath = PresetManagerUtils.AbsoluteToRelativePath(absoluteFilePath);

                AssetImporter assetImporter = AssetImporter.GetAtPath(relativeFilePath);

                if (assetImporter == null)
                {
                    continue;
                }

                if (!PresetManagerUtils.HasPresetFor(assetImporter))
                {
                    continue;
                }

                if (assetImportersTypes.Contains(assetImporter.GetType()))
                {
                    continue;
                }

                assetImporters.Add(assetImporter);
                assetImportersTypes.Add(assetImporter.GetType());
            }

            assetImportersType = assetImporters.ToArray();
            if (assetImportersTypeFoldout == null || assetImportersTypeFoldout.Length != assetImportersType.Length)
            {
                assetImportersTypeFoldout = new bool[assetImportersType.Length];
            }
        }
示例#3
0
        private void SearchForAllFiles(string directoryAbsolutePath, ref List <string> filesPath, ref int level)
        {
            filesPath.AddRange(Directory.GetFiles(directoryAbsolutePath));

            string[] folderPaths = Directory.GetDirectories(directoryAbsolutePath);
            for (int i = 0; i < folderPaths.Length; i++)
            {
                string folderPath             = folderPaths[i];
                string absoluteToRelativePath = PresetManagerUtils.AbsoluteToRelativePath(folderPath);

                if (level > PresetManagerSettings.MaximumDirectorySearch)
                {
                    continue;
                }

                if (!PresetManagerUtils.HasAnyPresetForFolder(absoluteToRelativePath))
                {
                    level++;
                    SearchForAllFiles(folderPath, ref filesPath, ref level);
                }
            }
        }