From 00a491d93733d4625ad329b2ba8237f445364b3f Mon Sep 17 00:00:00 2001 From: Mirta Date: Wed, 30 Dec 2020 16:39:52 +0200 Subject: merge --- .../Tango.FileSystem/FileSystemItem.cs | 109 --------------------- 1 file changed, 109 deletions(-) delete mode 100644 Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs (limited to 'Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs') diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs deleted file mode 100644 index c78a11732..000000000 --- a/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media.Imaging; -using Tango.Core; -using Tango.FileSystem.Network; - -namespace Tango.FileSystem -{ - public abstract class FileSystemItem : ExtendedObject - { - private String _path; - public String Path - { - get { return _path; } - set { _path = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Name)); } - } - - public FileSystemItemType Type { get; protected set; } - - public abstract String Description { get; } - - public DateTime DateModified { get; set; } - - public DateTime DateCreated { get; set; } - - public long Size { get; set; } - - public String Name - { - get { return OnGetName(); } - } - - public FileSystemItem() - { - DateModified = DateTime.Now; - Size = 1000 * 1000; - } - - protected virtual String OnGetName() - { - return System.IO.Path.GetFileName(Path); - } - - public override string ToString() - { - return Name; - } - - public static FileSystemItem FromDTO(FileSystemItemDTO dto) - { - FileSystemItem item = null; - - if (dto.Type == FileSystemItemType.Drive) - { - item = new DriveItem() - { - DriveType = dto.DriveType, - Label = dto.DriveLabel, - Items = dto.Items?.Select(x => FromDTO(x)).ToObservableCollection() - }; - } - else if (dto.Type == FileSystemItemType.Folder) - { - item = new FolderItem() - { - Items = dto.Items?.Select(x => FromDTO(x)).ToObservableCollection(), - IsRoot = dto.IsRoot, - }; - } - else if (dto.Type == FileSystemItemType.File) - { - item = new FileItem(); - } - - item.DateModified = dto.DateModified; - item.DateCreated = dto.DateCreated; - item.Path = dto.Path; - item.Size = dto.Size; - item.Type = dto.Type; - - return item; - } - - public String GetParent() - { - if (Path == "/") return null; - - String root = System.IO.Path.GetPathRoot(Path); - var parent = Directory.GetParent(Path); - - if (root == "\\") - { - return parent.FullName.Replace(parent.Root.FullName, "/").Replace("\\", "/"); - } - else if (parent != null) - { - return parent.FullName; - } - else - { - return null; - } - } - } -} -- cgit v1.3.1