diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.FileSystem')
4 files changed, 37 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs b/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs index 0a7fe8ddc..58d0772f5 100644 --- a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs +++ b/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs @@ -305,6 +305,14 @@ namespace Tango.FileSystem public static readonly DependencyProperty SelectionModeProperty = DependencyProperty.Register("SelectionMode", typeof(SelectionMode), typeof(FileExplorerControl), new PropertyMetadata(SelectionMode.Extended)); + public bool AllowFolderDownload + { + get { return (bool)GetValue(AllowFolderDownloadProperty); } + set { SetValue(AllowFolderDownloadProperty, value); } + } + public static readonly DependencyProperty AllowFolderDownloadProperty = + DependencyProperty.Register("AllowFolderDownload", typeof(bool), typeof(FileExplorerControl), new PropertyMetadata(true)); + static FileExplorerControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(FileExplorerControl), new FrameworkPropertyMetadata(typeof(FileExplorerControl))); @@ -369,7 +377,7 @@ namespace Tango.FileSystem DownloadCommand?.Execute(SelectedItems.ToList()); - }, () => SelectedItems != null && SelectedItems.Count > 0 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive)); + }, () => SelectedItems != null && SelectedItems.Count > 0 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive && (AllowFolderDownload || x.Type == FileSystemItemType.File))); OpenCommand = new RelayCommand(() => { diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs index c8b2fce32..c78a11732 100644 --- a/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs +++ b/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs @@ -25,6 +25,8 @@ namespace Tango.FileSystem public DateTime DateModified { get; set; } + public DateTime DateCreated { get; set; } + public long Size { get; set; } public String Name @@ -75,11 +77,33 @@ namespace Tango.FileSystem } 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; + } + } } } diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs index c08304ca8..dc8efa7dd 100644 --- a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs +++ b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs @@ -71,6 +71,7 @@ namespace Tango.FileSystem Path = directory, Type = FileSystemItemType.Folder, DateModified = Directory.GetLastWriteTimeUtc(directory), + DateCreated = Directory.GetCreationTimeUtc(directory), }); } @@ -83,6 +84,7 @@ namespace Tango.FileSystem Path = file, Type = FileSystemItemType.File, DateModified = File.GetLastWriteTimeUtc(file), + DateCreated = File.GetCreationTimeUtc(file), Size = new FileInfo(file).Length }); } diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs index 900ba0628..43467f227 100644 --- a/Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs +++ b/Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs @@ -19,6 +19,8 @@ namespace Tango.FileSystem.Network public DateTime DateModified { get; set; } + public DateTime DateCreated { get; set; } + public long Size { get; set; } public bool IsRoot { get; set; } |
