diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-04-15 04:54:52 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-04-15 04:54:52 +0300 |
| commit | 52813618e140c921ff653d9c227c35032207b495 (patch) | |
| tree | 5eef9e6cf26475b5ba31e9359bfd2c38531debae /Software/Visual_Studio/Tango.FileSystem | |
| parent | 7100354b0059cddfcffa4931216f4b8087bd94b1 (diff) | |
| download | Tango-52813618e140c921ff653d9c227c35032207b495.tar.gz Tango-52813618e140c921ff653d9c227c35032207b495.zip | |
FSE Firmware FileSystem.
Diffstat (limited to 'Software/Visual_Studio/Tango.FileSystem')
| -rw-r--r-- | Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs | 10 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs | 21 |
2 files changed, 30 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 558251f3c..c78a11732 100644 --- a/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs +++ b/Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs @@ -84,5 +84,26 @@ namespace Tango.FileSystem 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; + } + } } } |
