Beispiel #1
0
        /// <summary>
        /// Search all asset if match rule
        /// </summary>
        /// <param name="folder"></param>
        /// <param name="filePaths"></param>
        protected void searchFiles(string folder, ABaseRule[] rules, Dictionary <ABaseRule, List <string> > filePaths)
        {
            for (int i = 0; i < rules.Length; i++)
            {
                string[] subFilePaths = Directory.GetFiles(folder, "*" + rules[i].Suffix, SearchOption.TopDirectoryOnly);

                List <string> paths = null;
                if (!filePaths.TryGetValue(rules[i], out paths))
                {
                    paths = new List <string>();
                    filePaths[rules[i]] = paths;
                }
                paths.AddRange(subFilePaths);
            }

            string[]            childFolders = Directory.GetDirectories(folder);
            AssetImporterWindow aiw          = AssetImporterWindow.Instance;
            string dataPath = Application.dataPath;

            for (int i = 0; i < childFolders.Length; i++)
            {
                string relativePath = childFolders[i].Replace(dataPath, "Assets");
                if (aiw.HasRules <T>(relativePath))
                {
                    // skip this folder if it have new rules
                    continue;
                }
                searchFiles(childFolders[i], rules, filePaths);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Search all asset if match rule
        /// </summary>
        /// <param name="rule"></param>
        /// <param name="paths"></param>
        protected void searchFiles(string folder, string suffix, List <string> paths)
        {
            AssetImporterWindow aiw = AssetImporterWindow.Instance;
            string dataPath         = Application.dataPath;

            string[] subFilePaths = Directory.GetFiles(folder, "*" + suffix, SearchOption.TopDirectoryOnly);
            paths.AddRange(subFilePaths);

            string[] childFolders = Directory.GetDirectories(folder);

            for (int j = 0; j < childFolders.Length; j++)
            {
                string relativePath = childFolders[j].Replace(dataPath, "Assets");
                if (aiw.HasRules <T>(relativePath))
                {
                    // skip this folder if it have new rules
                    continue;
                }
                searchFiles(childFolders[j], suffix, paths);
            }
        }