21 lines
601 B
C#
21 lines
601 B
C#
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.IO;
|
|
|
|
namespace winui_learning_3.Models;
|
|
|
|
public class FolderContentDto
|
|
{
|
|
public required string AbsolutePath { get; set; }
|
|
public ObservableCollection<FolderContentDto> Children { get; set; } = [];
|
|
public List<FileDto> Files { get; set; } = [];
|
|
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
var name = Path.GetFileName(AbsolutePath.TrimEnd(Path.DirectorySeparatorChar));
|
|
return string.IsNullOrEmpty(name) ? AbsolutePath : name; // "C:\" has no file name
|
|
}
|
|
}
|
|
} |