public static LevelPrefabFileInfo CreateSubdirectory(LevelPrefabFileInfo parent, string name) { LevelPrefabFileInfo child = new LevelPrefabFileInfo(name, parent); parent.AddChildInfo(child); return(child); }
public static void AddSubfoldersRecursive(DirectoryInfo directory, LevelPrefabFileInfo parent) { foreach (DirectoryInfo subdirectory in directory.GetDirectories()) { AddSubfoldersRecursive(subdirectory, CreateSubdirectory(parent, subdirectory.Name)); } foreach (FileInfo prefab in directory.GetFiles("*.bytes")) { AddOrUpdatePrefabInfo(parent, prefab); } }
public static LevelPrefabFileInfo AddOrUpdatePrefabInfo(LevelPrefabFileInfo parent, FileInfo file) { string prefab_path = Resource.NormalizePath(file.FullName); string name = Path.GetFileNameWithoutExtension(prefab_path); LevelPrefabFileInfo entry = parent.GetChildFileInfo((LevelPrefabFileInfo value) => value.Name_ == name); if (entry is null) { entry = new LevelPrefabFileInfo(name, prefab_path, parent); parent.AddChildInfo(entry); } else { entry.CustomPrefabPath_ = prefab_path; } return(entry); }