aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs')
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs109
1 files changed, 0 insertions, 109 deletions
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;
- }
- }
- }
-}