private object ControlFromFile(IFileSystemItem fileSystemItem) { if (fileSystemItem == null) { return(null); } else if (fileSystemItem is IFile file) { return(FillFile(file)); } else if (fileSystemItem is IDirectory directory) { return(FillDirectory(directory)); } else { throw new NotImplementedException($"{fileSystemItem.GetType().Name} is not yet supported."); } }