Пример #1
0
        public CurrentDirectory()
        {
            _componentsOfCurrentDirectory = new List <Component>();

            Component rootFolder = SimpleComponentFactory.CreateComponent("Folder", "Root");

            _componentsOfCurrentDirectory.Add(rootFolder);
        }
Пример #2
0
        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");
        }