public HierarchyComponentFolder GetOrCreateFolder(string name) { string SearchPath = $"/{name.ToLowerInvariant()}"; foreach (HierarchyComponentFolder Match in from Entry in GetSubFolders() where Entry.Path == SearchPath select Entry) { return(Match); } HierarchyComponentFolder SubFolder = new HierarchyComponentFolder(name, this); Entries.Add(SubFolder); return(SubFolder); }
public HierarchyComponentFile CreateFile(string[] path, string id) { string name = path[0]; if (path.Length > 1) { System.Console.WriteLine($"Folder {name}"); // Folder HierarchyComponentFolder folder = GetOrCreateFolder(name); return(folder.CreateFile(path.RemoveAt(0), id)); } else { System.Console.WriteLine($"File {name}"); // File HierarchyComponentFile file = AddFile(name, id); return(file); } }
protected HierarchyComponentData(string name, HierarchyComponentFolder parent) { Name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(name); Parent = parent; }
public HierarchyComponentFolder(string name, HierarchyComponentFolder parent) : base(name, parent) { Entries = new List <HierarchyComponentData>(); }