public CurrentDirectory() { _componentsOfCurrentDirectory = new List <Component>(); Component rootFolder = SimpleComponentFactory.CreateComponent("Folder", "Root"); _componentsOfCurrentDirectory.Add(rootFolder); }
public override void AddNewFileToTheCurrentDirectory(string nameOfNewFile) { Component newFile = SimpleComponentFactory.CreateComponent("File", nameOfNewFile); Component currentFolder = _currentDirectory.GetCurrentComponent(); bool resultAfterAddingNewFile = currentFolder.Add(newFile); if (!resultAfterAddingNewFile) { _messageViewer.DisplayMessage("A component with this name already exists"); return; } _messageViewer.DisplayMessage($"New file {newFile.Name} successfully added"); }