private pk2.Pk2.pFolder FindFolder(Pk2.pFolder mainFolder, string p) { Pk2.pFolder rfolder = new Pk2.pFolder(); foreach (Pk2.pFolder folder in mainFolder.subfolders) { if (folder.name == p) { rfolder = folder; } if (rfolder == null) { rfolder = CheckSubfolders(folder, p); } } return rfolder; }
private Pk2.pFolder CheckSubfolders(Pk2.pFolder folder, string p) { Pk2.pFolder tmp = folder.subfolders.Find(t => t.name == p); if (tmp == null) { foreach (Pk2.pFolder fl in folder.subfolders) { tmp = CheckSubfolders(fl, p); } } return tmp; }