aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs')
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs23
1 files changed, 14 insertions, 9 deletions
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
index 9a051793d..f0b86becf 100644
--- a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
+++ b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
@@ -16,7 +16,7 @@ namespace Tango.FileSystem
folder.Path = "This PC";
folder.IsRoot = true;
folder.Type = FileSystemItemType.Folder;
- folder.Items = DriveInfo.GetDrives().Select(x => new FileSystemItemDTO()
+ folder.Items = DriveInfo.GetDrives().Where(x => x.DriveType == DriveType.Fixed || x.DriveType == DriveType.Removable || x.DriveType == DriveType.Network).Select(x => new FileSystemItemDTO()
{
Path = x.RootDirectory.FullName,
DriveType = x.DriveType,
@@ -27,21 +27,26 @@ namespace Tango.FileSystem
return folder;
}
- public FileSystemItemDTO GetFolder(String path)
+ public FileSystemItemDTO GetFolder(GetFileSystemItemRequest request)
{
List<FileSystemItemDTO> items = new List<FileSystemItemDTO>();
- if (String.IsNullOrWhiteSpace(path))
+ if (request.SpecialFolder.HasValue)
+ {
+ request.Path = Environment.GetFolderPath(request.SpecialFolder.Value);
+ }
+
+ if (String.IsNullOrWhiteSpace(request.Path))
{
return GetRoot();
}
- if (!Directory.Exists(path))
+ if (!Directory.Exists(request.Path))
{
throw new DirectoryNotFoundException("The specified directory could not be located.");
}
- foreach (var directory in Directory.GetDirectories(path))
+ foreach (var directory in Directory.GetDirectories(request.Path))
{
items.Add(new FileSystemItemDTO()
{
@@ -51,7 +56,7 @@ namespace Tango.FileSystem
});
}
- foreach (var file in Directory.GetFiles(path))
+ foreach (var file in Directory.GetFiles(request.Path))
{
items.Add(new FileSystemItemDTO()
{
@@ -64,8 +69,8 @@ namespace Tango.FileSystem
return new FileSystemItemDTO()
{
- Path = path,
- Type = path.Length == 3 ? FileSystemItemType.Drive : FileSystemItemType.Folder,
+ Path = request.Path,
+ Type = request.Path.Length == 3 ? FileSystemItemType.Drive : FileSystemItemType.Folder,
Items = items
};
}
@@ -74,7 +79,7 @@ namespace Tango.FileSystem
{
if (Directory.Exists(path))
{
- Directory.Delete(path);
+ Directory.Delete(path, true);
}
else if (File.Exists(path))
{