static HashSet <string> GetSelectionsBySamples(List <PathPattern> fileSamples, List <PathPattern> dirSamples) { List <PathPattern> samples = new List <PathPattern>(); samples.AddRange(fileSamples); samples.AddRange(dirSamples); HashSet <string> hash = new HashSet <string>(); for (int i = 0; i < samples.Count; i++) { PathPattern sample = samples[i]; if (!Directory.Exists(sample.dir)) { DebugUtil.LogWarning("The directory isn't exist : " + sample.dir); continue; } string[] entries; if (i < fileSamples.Count) { entries = FilePathTools.SelectEntries(FilePathTools.GetFiles(sample.dir, sample.regex, sample.searchOption), FILTER_META_REGEX); } else { entries = FilePathTools.GetDirectories(sample.dir, sample.regex, sample.searchOption); } hash.UnionWith(entries); DebugUtil.Log("\"" + EditorCommonUtils.NormalizeDirectory(sample.dir) + sample.regex + "\" match " + (i < fileSamples.Count ? "files" : "directories") + " : " + entries.Length); } return(hash); }
static void CheckMapDependencies() { string mapRoot = "Assets/Export/UI/"; foreach (string path in FilePathTools.GetDirectories(mapRoot, "Map")) { string name = path.Replace(mapRoot, "") + "/"; string[] files = FilePathTools.GetFiles(path, ".*", System.IO.SearchOption.AllDirectories); Dictionary <string, List <string> > dependencyDict = new Dictionary <string, List <string> >(); List <string> selections = new List <string>(files); EditorResourcePaths.GetExternalDependencies(selections, selections, dependencyDict); foreach (string selection in dependencyDict.Keys) { dependencyDict[selection].ForEach((param) => { if ((param.IndexOf("Res/Maps/") != -1 || param.IndexOf("Export/UI/Map") != -1) && param.IndexOf(name) == -1 && param.IndexOf("MapCom") == -1) { Debug.LogWarning(selection + " Depend on : " + param); } }); } } }