private List <RootModel> GetFiles(FileModel current) { int depth = current.Depth + 1; GeoIcon icon = GeoIcon.Folder; List <RootModel> items = new(); string[] dirs = Directory.GetDirectories(current.FullPath); string[] files = Directory.GetFiles(current.FullPath); foreach (string dir in dirs) { RootModel item = new(depth, Path.GetFileName(dir), icon, dir, false, false); items.Add(item); } foreach (string file in files) { icon = RootIcon.Parse(file); RootModel item = new(depth, Path.GetFileName(file), icon, file, false, false); item.Length = new FileInfo(file).Length; items.Add(item); } return(items); }
internal List <FileModel> GetNodeList() { List <FileModel> roots = new(); int depth = 0; depth += 1; RootModel down = new(depth, "Downloads", RootIcon.Download, RootSupport.Downloads, false, false); RootModel docs = new(depth, "Documents", RootIcon.Document, RootSupport.Documents, false, false); RootModel pics = new(depth, "Pictures", RootIcon.Pictures, RootSupport.Pictures, false, false); roots.Add(down); roots.Add(docs); roots.Add(pics); foreach (DriveInfo device in DriveInfo.GetDrives()) { string discName = device.RootDirectory.FullName.Replace(@"\", ""); string rootName = string.Format("{0} ({1})", device.VolumeLabel, discName); string fullPath = device.Name; GeoIcon icon = GeoIcon.MicrosoftWindows; roots.Add(new RootModel(depth, rootName, icon, fullPath, false, false)); } return(roots); }
public RootModel(int depth, string name, GeoIcon icon, string fullPath, bool isExpanded, bool isSelected) { FullPath = fullPath; Depth = depth; Name = name; IconType = icon; IsExpanded = isExpanded; IsSelected = isSelected; Children = new ObservableCollection <FileModel>(); }
public RootModel(string target, GeoIcon icon) : this(0, Path.GetFileName(target), icon, target, false, false) { }
public FolderModel(string fullPath, GeoIcon icon) { FullPath = fullPath; IconType = icon; }