コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 protected HierarchyComponentData(string name, HierarchyComponentFolder parent)
 {
     Name   = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(name);
     Parent = parent;
 }
コード例 #4
0
 public HierarchyComponentFolder(string name, HierarchyComponentFolder parent) : base(name, parent)
 {
     Entries = new List <HierarchyComponentData>();
 }