public static GetBaseFolders ( string folders ) : string[] | ||
folders | string | |
리턴 | string[] |
public static string[] GetBaseFolders(string[] folders)
{
if (folders.Length <= 1)
{
return folders;
}
List<string> list = new List<string>();
List<string> list2 = new List<string>(folders);
for (int i = 0; i < list2.Count; i++)
{
char[] trimChars = new char[] { '/' };
list2[i] = list2[i].Trim(trimChars);
}
list2.Sort();
for (int j = 0; j < list2.Count; j++)
{
if (!list2[j].EndsWith("/"))
{
list2[j] = list2[j] + "/";
}
}
string item = list2[0];
list.Add(item);
for (int k = 1; k < list2.Count; k++)
{
if (list2[k].IndexOf(item, StringComparison.Ordinal) != 0)
{
list.Add(list2[k]);
item = list2[k];
}
}
for (int m = 0; m < list.Count; m++)
{
char[] chArray2 = new char[] { '/' };
list[m] = list[m].Trim(chArray2);
}
return list.ToArray();
}
void SearchInFolders(HierarchyProperty property) { List <FilterResult> list = new List <FilterResult>(); string[] baseFolders = ProjectWindowUtil.GetBaseFolders(m_SearchFilter.folders); foreach (string folderPath in baseFolders) { // Ensure we do not have a filter when finding folder property.SetSearchFilter(new SearchFilter()); int folderInstanceID = AssetDatabase.GetMainAssetInstanceID(folderPath); if (property.Find(folderInstanceID, null)) { // Set filter after we found the folder property.SetSearchFilter(m_SearchFilter); int folderDepth = property.depth; int[] expanded = null; // enter all children of folder while (property.NextWithDepthCheck(expanded, folderDepth + 1)) { FilterResult result = new FilterResult(); CopyPropertyData(ref result, property); list.Add(result); } } } m_Results = list.ToArray(); }