aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.FileSystem
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.FileSystem')
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/DragItem.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/DriveItem.cs38
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs894
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileExplorerControlMode.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileItem.cs132
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemDataGrid.cs30
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemDataGridRow.cs40
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemItem.cs109
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemItemType.cs15
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs261
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/FolderItem.cs34
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/IFileSystemContainer.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Images/drive.pngbin2166 -> 0 bytes
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Images/folder.pngbin317 -> 0 bytes
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationRequest.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationResponse.cs12
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadRequest.cs15
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadRequest.cs15
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/CopyRequest.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/CopyResponse.cs12
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/DeleteRequest.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/DeleteResponse.cs12
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadRequest.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadResponse.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs35
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FileUploadRequest.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FileUploadResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadRequest.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadResponse.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadRequest.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemRequest.cs17
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcRequest.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcResponse.cs12
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/MoveRequest.cs14
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/MoveResponse.cs12
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationRequest.cs12
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationResponse.cs13
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Properties/AssemblyInfo.cs55
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Properties/Resources.Designer.cs62
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Properties/Resources.resx117
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Properties/Settings.Designer.cs30
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Properties/Settings.settings7
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj148
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/Themes/Generic.xaml206
-rw-r--r--Software/Visual_Studio/Tango.FileSystem/VirtualFileDataObject.cs983
51 files changed, 0 insertions, 3609 deletions
diff --git a/Software/Visual_Studio/Tango.FileSystem/DragItem.cs b/Software/Visual_Studio/Tango.FileSystem/DragItem.cs
deleted file mode 100644
index e71b095e1..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/DragItem.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem
-{
- public class DragItem
- {
- public FileSystemItem FileSystemItem { get; set; }
- public String Destination { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/DriveItem.cs b/Software/Visual_Studio/Tango.FileSystem/DriveItem.cs
deleted file mode 100644
index 9c4494fec..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/DriveItem.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem
-{
- public class DriveItem : FileSystemItem, IFileSystemContainer
- {
- public ObservableCollection<FileSystemItem> Items { get; set; }
-
- public String Label { get; set; }
-
- public DriveType DriveType { get; set; }
-
- public DriveItem()
- {
- Type = FileSystemItemType.Drive;
- Items = new ObservableCollection<FileSystemItem>();
- }
-
- protected override string OnGetName()
- {
- return Label;
- }
-
- public override string Description
- {
- get
- {
- return DriveType.ToString().ToTitle();
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs b/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs
deleted file mode 100644
index 58d0772f5..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControl.cs
+++ /dev/null
@@ -1,894 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using Tango.Core.Commands;
-using Tango.Core.IO;
-
-namespace Tango.FileSystem
-{
- public class FileExplorerControl : Control
- {
- private ListBox _listBox;
- private DataGrid _datagrid;
- private bool _preventSynchronization;
- private Point _dragOutStartPoint;
- private bool _isMouseDown;
- private List<FileSystemItem> _selectedItemsBeforeDrag;
- private List<FileSystemItem> _copyItems;
- private bool _isCut;
- private bool _isAfterContextMenu;
-
- #region IsCut Attached Property
-
- /// <summary>
- /// Determines whether the draggable element is currently being dragged.
- /// </summary>
- public static readonly DependencyProperty IsCutProperty =
- DependencyProperty.RegisterAttached("IsCut",
- typeof(bool), typeof(FileExplorerControl),
- new FrameworkPropertyMetadata(false));
-
- /// <summary>
- /// Sets the IsCut attached property.
- /// </summary>
- /// <param name="element">The element.</param>
- /// <param name="value">if set to <c>true</c> [value].</param>
- public static void SetIsCut(FrameworkElement element, bool value)
- {
- element.SetValue(IsCutProperty, value);
- }
-
- /// <summary>
- /// Gets the is dragging attached property.
- /// </summary>
- /// <param name="element">The element.</param>
- /// <returns></returns>
- public static bool GetIsCut(FrameworkElement element)
- {
- return (bool)element.GetValue(IsCutProperty);
- }
-
- #endregion
-
- public IFileSystemContainer CurrentItem
- {
- get { return (IFileSystemContainer)GetValue(CurrentItemProperty); }
- set { SetValue(CurrentItemProperty, value); }
- }
- public static readonly DependencyProperty CurrentItemProperty =
- DependencyProperty.Register("CurrentItem", typeof(IFileSystemContainer), typeof(FileExplorerControl), new PropertyMetadata(null, (d, e) => (d as FileExplorerControl).OnCurrentItemChanged()));
-
- public FileSystemItem SelectedItem
- {
- get { return (FileSystemItem)GetValue(SelectedItemProperty); }
- set { SetValue(SelectedItemProperty, value); }
- }
- public static readonly DependencyProperty SelectedItemProperty =
- DependencyProperty.Register("SelectedItem", typeof(FileSystemItem), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand ItemDoubleClickedCommand
- {
- get { return (ICommand)GetValue(ItemDoubleClickedCommandProperty); }
- set { SetValue(ItemDoubleClickedCommandProperty, value); }
- }
- public static readonly DependencyProperty ItemDoubleClickedCommandProperty =
- DependencyProperty.Register("ItemDoubleClickedCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand DeleteCommand
- {
- get { return (ICommand)GetValue(DeleteCommandProperty); }
- set { SetValue(DeleteCommandProperty, value); }
- }
- public static readonly DependencyProperty DeleteCommandProperty =
- DependencyProperty.Register("DeleteCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand DeleteCommandInternal
- {
- get { return (ICommand)GetValue(DeleteCommandInternalProperty); }
- set { SetValue(DeleteCommandInternalProperty, value); }
- }
- public static readonly DependencyProperty DeleteCommandInternalProperty =
- DependencyProperty.Register("DeleteCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand NewFolderCommandInternal
- {
- get { return (ICommand)GetValue(NewFolderCommandInternalProperty); }
- set { SetValue(NewFolderCommandInternalProperty, value); }
- }
- public static readonly DependencyProperty NewFolderCommandInternalProperty =
- DependencyProperty.Register("NewFolderCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand NewFolderCommand
- {
- get { return (ICommand)GetValue(NewFolderCommandProperty); }
- set { SetValue(NewFolderCommandProperty, value); }
- }
- public static readonly DependencyProperty NewFolderCommandProperty =
- DependencyProperty.Register("NewFolderCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand DropCommand
- {
- get { return (ICommand)GetValue(DropCommandProperty); }
- set { SetValue(DropCommandProperty, value); }
- }
- public static readonly DependencyProperty DropCommandProperty =
- DependencyProperty.Register("DropCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand DragCommand
- {
- get { return (ICommand)GetValue(DragCommandProperty); }
- set { SetValue(DragCommandProperty, value); }
- }
- public static readonly DependencyProperty DragCommandProperty =
- DependencyProperty.Register("DragCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand CopyCommand
- {
- get { return (ICommand)GetValue(CopyCommandProperty); }
- set { SetValue(CopyCommandProperty, value); }
- }
- public static readonly DependencyProperty CopyCommandProperty =
- DependencyProperty.Register("CopyCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand CutCommand
- {
- get { return (ICommand)GetValue(CutCommandProperty); }
- set { SetValue(CutCommandProperty, value); }
- }
- public static readonly DependencyProperty CutCommandProperty =
- DependencyProperty.Register("CutCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand CopyPasteCommand
- {
- get { return (ICommand)GetValue(CopyPasteCommandProperty); }
- set { SetValue(CopyPasteCommandProperty, value); }
- }
- public static readonly DependencyProperty CopyPasteCommandProperty =
- DependencyProperty.Register("CopyPasteCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand CutPasteCommand
- {
- get { return (ICommand)GetValue(CutPasteCommandProperty); }
- set { SetValue(CutPasteCommandProperty, value); }
- }
- public static readonly DependencyProperty CutPasteCommandProperty =
- DependencyProperty.Register("CutPasteCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand PasteCommandInternal
- {
- get { return (ICommand)GetValue(PasteCommandInternalProperty); }
- set { SetValue(PasteCommandInternalProperty, value); }
- }
- public static readonly DependencyProperty PasteCommandInternalProperty =
- DependencyProperty.Register("PasteCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand SelectAllCommand
- {
- get { return (ICommand)GetValue(SelectAllCommandProperty); }
- set { SetValue(SelectAllCommandProperty, value); }
- }
- public static readonly DependencyProperty SelectAllCommandProperty =
- DependencyProperty.Register("SelectAllCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand DownloadCommandInternal
- {
- get { return (ICommand)GetValue(DownloadCommandInternalProperty); }
- set { SetValue(DownloadCommandInternalProperty, value); }
- }
- public static readonly DependencyProperty DownloadCommandInternalProperty =
- DependencyProperty.Register("DownloadCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand DownloadCommand
- {
- get { return (ICommand)GetValue(DownloadCommandProperty); }
- set { SetValue(DownloadCommandProperty, value); }
- }
- public static readonly DependencyProperty DownloadCommandProperty =
- DependencyProperty.Register("DownloadCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand OpenCommand
- {
- get { return (ICommand)GetValue(OpenCommandProperty); }
- set { SetValue(OpenCommandProperty, value); }
- }
- public static readonly DependencyProperty OpenCommandProperty =
- DependencyProperty.Register("OpenCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand BackCommand
- {
- get { return (ICommand)GetValue(BackCommandProperty); }
- set { SetValue(BackCommandProperty, value); }
- }
- public static readonly DependencyProperty BackCommandProperty =
- DependencyProperty.Register("BackCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand RenameCommand
- {
- get { return (ICommand)GetValue(RenameCommandProperty); }
- set { SetValue(RenameCommandProperty, value); }
- }
- public static readonly DependencyProperty RenameCommandProperty =
- DependencyProperty.Register("RenameCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand RenameCommandInternal
- {
- get { return (ICommand)GetValue(RenameCommandInternalProperty); }
- set { SetValue(RenameCommandInternalProperty, value); }
- }
- public static readonly DependencyProperty RenameCommandInternalProperty =
- DependencyProperty.Register("RenameCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand UploadCommandInternal
- {
- get { return (ICommand)GetValue(UploadCommandInternalProperty); }
- set { SetValue(UploadCommandInternalProperty, value); }
- }
- public static readonly DependencyProperty UploadCommandInternalProperty =
- DependencyProperty.Register("UploadCommandInternal", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ICommand UploadCommand
- {
- get { return (ICommand)GetValue(UploadCommandProperty); }
- set { SetValue(UploadCommandProperty, value); }
- }
- public static readonly DependencyProperty UploadCommandProperty =
- DependencyProperty.Register("UploadCommand", typeof(ICommand), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public bool IsContextMenuOpened
- {
- get { return (bool)GetValue(IsContextMenuOpenedProperty); }
- set { SetValue(IsContextMenuOpenedProperty, value); }
- }
- public static readonly DependencyProperty IsContextMenuOpenedProperty =
- DependencyProperty.Register("IsContextMenuOpened", typeof(bool), typeof(FileExplorerControl), new PropertyMetadata(false, (d, e) => (d as FileExplorerControl).OnIsContextMenuOpenedChanged()));
-
- public ImageSource DriveIcon
- {
- get { return (ImageSource)GetValue(DriveIconProperty); }
- set { SetValue(DriveIconProperty, value); }
- }
- public static readonly DependencyProperty DriveIconProperty =
- DependencyProperty.Register("DriveIcon", typeof(ImageSource), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public ImageSource FolderIcon
- {
- get { return (ImageSource)GetValue(FolderIconProperty); }
- set { SetValue(FolderIconProperty, value); }
- }
- public static readonly DependencyProperty FolderIconProperty =
- DependencyProperty.Register("FolderIcon", typeof(ImageSource), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public FileExplorerControlMode Mode
- {
- get { return (FileExplorerControlMode)GetValue(ModeProperty); }
- set { SetValue(ModeProperty, value); }
- }
- public static readonly DependencyProperty ModeProperty =
- DependencyProperty.Register("Mode", typeof(FileExplorerControlMode), typeof(FileExplorerControl), new PropertyMetadata(FileExplorerControlMode.Large));
-
- public ObservableCollection<FileSystemItem> SelectedItems
- {
- get { return (ObservableCollection<FileSystemItem>)GetValue(SelectedItemsProperty); }
- set { SetValue(SelectedItemsProperty, value); }
- }
- public static readonly DependencyProperty SelectedItemsProperty =
- DependencyProperty.Register("SelectedItems", typeof(ObservableCollection<FileSystemItem>), typeof(FileExplorerControl), new PropertyMetadata(null, (d, e) => (d as FileExplorerControl).OnSelectedItemsChanged()));
-
- public bool AllowDrag
- {
- get { return (bool)GetValue(AllowDragProperty); }
- set { SetValue(AllowDragProperty, value); }
- }
- public static readonly DependencyProperty AllowDragProperty =
- DependencyProperty.Register("AllowDrag", typeof(bool), typeof(FileExplorerControl), new PropertyMetadata(null));
-
- public SelectionMode SelectionMode
- {
- get { return (SelectionMode)GetValue(SelectionModeProperty); }
- set { SetValue(SelectionModeProperty, value); }
- }
- 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)));
- }
-
- public FileExplorerControl()
- {
- Focusable = true;
-
- _copyItems = new List<FileSystemItem>();
- _selectedItemsBeforeDrag = new List<FileSystemItem>();
-
- CopyCommand = new RelayCommand(() =>
- {
- ResetItemsCut();
- _copyItems.Clear();
- _copyItems.AddRange(SelectedItems.ToList());
- _isCut = false;
- }, () => SelectedItems != null && SelectedItems.Count > 0);
-
- CutCommand = new RelayCommand(() =>
- {
- _copyItems.Clear();
- _copyItems.AddRange(SelectedItems.ToList());
- CutSelectedItems();
- _isCut = true;
-
- }, () => SelectedItems != null && SelectedItems.Count > 0);
-
- PasteCommandInternal = new RelayCommand(() =>
- {
- if (_isCut)
- {
- CutPasteCommand?.Execute(_copyItems.ToList());
- }
- else
- {
- CopyPasteCommand?.Execute(_copyItems.ToList());
- }
-
- ResetItemsCut();
- _copyItems.Clear();
- }, () => _copyItems.Count > 0);
-
- SelectAllCommand = new RelayCommand(() =>
- {
- ResetItemsCut();
- _copyItems.Clear();
- SelectedItems.Clear();
-
- if (CurrentItem != null)
- {
- foreach (var item in CurrentItem.Items)
- {
- SelectedItems.Add(item);
- }
- }
- });
-
- DownloadCommandInternal = new RelayCommand(() =>
- {
-
- DownloadCommand?.Execute(SelectedItems.ToList());
-
- }, () => SelectedItems != null && SelectedItems.Count > 0 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive && (AllowFolderDownload || x.Type == FileSystemItemType.File)));
-
- OpenCommand = new RelayCommand(() =>
- {
- ItemDoubleClickedCommand?.Execute(SelectedItems.FirstOrDefault());
- }, () =>
- {
- return SelectedItems != null && SelectedItems.Count == 1;
- });
-
- DeleteCommandInternal = new RelayCommand(() =>
- {
-
- DeleteCommand?.Execute(SelectedItems.ToList());
-
- }, () => SelectedItems != null && SelectedItems.Count > 0 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive));
-
- RenameCommandInternal = new RelayCommand(() =>
- {
-
- RenameCommand?.Execute(SelectedItems.FirstOrDefault());
-
- }, () => SelectedItems != null && SelectedItems.Count == 1 && SelectedItems.All(x => x.Type != FileSystemItemType.Drive));
-
- NewFolderCommandInternal = new RelayCommand(() =>
- {
- NewFolderCommand?.Execute(null);
- },
- () =>
- {
- if (CurrentItem == null) return false;
-
- if (CurrentItem is FolderItem)
- {
- if ((CurrentItem as FolderItem).IsRoot)
- {
- return false;
- }
- }
-
- return true;
- });
-
- UploadCommandInternal = new RelayCommand(() =>
- {
- UploadCommand?.Execute(null);
- },() =>
- {
- if (CurrentItem == null) return false;
-
- if (CurrentItem is FolderItem)
- {
- if ((CurrentItem as FolderItem).IsRoot)
- {
- return false;
- }
- }
-
- return true;
- });
- }
-
- private void OnIsContextMenuOpenedChanged()
- {
- _isMouseDown = false;
- (PasteCommandInternal as RelayCommand)?.RaiseCanExecuteChanged();
- (CutCommand as RelayCommand)?.RaiseCanExecuteChanged();
- (CopyCommand as RelayCommand)?.RaiseCanExecuteChanged();
- (DownloadCommandInternal as RelayCommand)?.RaiseCanExecuteChanged();
- (OpenCommand as RelayCommand)?.RaiseCanExecuteChanged();
- (DeleteCommandInternal as RelayCommand)?.RaiseCanExecuteChanged();
- (RenameCommandInternal as RelayCommand)?.RaiseCanExecuteChanged();
- (NewFolderCommandInternal as RelayCommand)?.RaiseCanExecuteChanged();
- (UploadCommandInternal as RelayCommand)?.RaiseCanExecuteChanged();
-
- if (IsContextMenuOpened)
- {
- _isAfterContextMenu = true;
- }
- }
-
- private void ResetItemsCut()
- {
- foreach (var item in _listBox.Items)
- {
- var element = _listBox.ItemContainerGenerator.ContainerFromItem(item) as FrameworkElement;
- if (element != null)
- {
- SetIsCut(element, false);
- }
-
- element = _datagrid.ItemContainerGenerator.ContainerFromItem(item) as FrameworkElement;
- if (element != null)
- {
- SetIsCut(element, false);
- }
- }
- }
-
- private void CutSelectedItems()
- {
- ResetItemsCut();
-
- foreach (var item in SelectedItems.ToList())
- {
- var element = _listBox.ItemContainerGenerator.ContainerFromItem(item) as FrameworkElement;
- if (element != null)
- {
- SetIsCut(element, true);
- }
-
- element = _datagrid.ItemContainerGenerator.ContainerFromItem(item) as FrameworkElement;
- if (element != null)
- {
- SetIsCut(element, true);
- }
- }
- }
-
- public override void OnApplyTemplate()
- {
- base.OnApplyTemplate();
-
- _listBox = GetTemplateChild("PART_listbox") as ListBox;
- _datagrid = GetTemplateChild("PART_datagrid") as DataGrid;
-
- _listBox.SelectionChanged += _listBox_SelectionChanged;
- _datagrid.SelectionChanged += _datagrid_SelectionChanged;
- }
-
- protected override void OnPreviewKeyDown(KeyEventArgs e)
- {
- base.OnPreviewKeyDown(e);
-
- if (e.Key == Key.Delete)
- {
- if (DeleteCommandInternal != null && DeleteCommandInternal.CanExecute(null))
- {
- DeleteCommandInternal?.Execute(null);
- }
- }
- else if (e.Key == Key.Return)
- {
- if (OpenCommand != null && OpenCommand.CanExecute(null))
- {
- OpenCommand?.Execute(null);
- }
- }
- else if (e.Key == Key.C && Keyboard.IsKeyDown(Key.LeftCtrl))
- {
- if (CopyCommand != null && CopyCommand.CanExecute(null))
- {
- CopyCommand.Execute(null);
- }
- }
- else if (e.Key == Key.X && Keyboard.IsKeyDown(Key.LeftCtrl))
- {
- if (CutCommand != null && CutCommand.CanExecute(null))
- {
- CutCommand.Execute(null);
- }
- }
- else if (e.Key == Key.V && Keyboard.IsKeyDown(Key.LeftCtrl))
- {
- if (PasteCommandInternal != null && PasteCommandInternal.CanExecute(null))
- {
- PasteCommandInternal.Execute(null);
- }
- }
- else if (e.Key == Key.A && Keyboard.IsKeyDown(Key.LeftCtrl))
- {
- if (SelectAllCommand != null && SelectAllCommand.CanExecute(null))
- {
- SelectAllCommand.Execute(null);
- }
- }
- else if (e.Key == Key.D && Keyboard.IsKeyDown(Key.LeftCtrl))
- {
- if (DownloadCommandInternal != null && DownloadCommandInternal.CanExecute(null))
- {
- DownloadCommandInternal.Execute(null);
- }
- }
- else if (e.Key == Key.N && Keyboard.IsKeyDown(Key.LeftCtrl))
- {
- if (NewFolderCommandInternal != null && NewFolderCommandInternal.CanExecute(null))
- {
- DownloadCommandInternal.Execute(null);
- }
- }
- else if (e.Key == Key.F2)
- {
- if (RenameCommandInternal != null && RenameCommandInternal.CanExecute(null))
- {
- RenameCommandInternal.Execute(null);
- }
- }
- else if (e.Key == Key.Down)
- {
- if (SelectedItems != null && SelectedItems.Count == 0 && CurrentItem != null && CurrentItem.Items.Count > 0)
- {
- SelectedItems.Add(CurrentItem.Items.FirstOrDefault());
- }
- }
- else if (e.Key == Key.Back)
- {
- BackCommand?.Execute(null);
- }
- }
-
- private void _datagrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (SelectionMode == SelectionMode.Extended)
- {
- if (!_preventSynchronization)
- {
- _preventSynchronization = true;
-
- _listBox.SelectedItems.Clear();
-
- foreach (var item in _datagrid.SelectedItems)
- {
- _listBox.SelectedItems.Add(item);
- }
-
- SynchronizeSelectedItems(_listBox.SelectedItems);
-
- _preventSynchronization = false;
- }
- }
- }
-
- private void _listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (SelectionMode == SelectionMode.Extended)
- {
- if (!_preventSynchronization)
- {
- _preventSynchronization = true;
-
- _datagrid.SelectedItems.Clear();
-
- foreach (var item in _listBox.SelectedItems)
- {
- _datagrid.SelectedItems.Add(item);
- }
-
- SynchronizeSelectedItems(_listBox.SelectedItems);
-
- _preventSynchronization = false;
- }
- }
- }
-
- private void SynchronizeSelectedItems(IList items)
- {
- if (SelectedItems == null)
- {
- SelectedItems = items.Cast<FileSystemItem>().ToObservableCollection();
- }
- else
- {
- SelectedItems.Clear();
-
- foreach (var item in items.Cast<FileSystemItem>().ToList())
- {
- SelectedItems.Add(item);
- }
- }
- }
-
- private void OnSelectedItemsChanged()
- {
- if (SelectedItems != null)
- {
- SelectedItems.CollectionChanged -= SelectedItems_CollectionChanged;
- SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
- SynchronizeControls();
- }
- }
-
- private void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
- {
- SynchronizeControls();
- }
-
- private void SynchronizeControls()
- {
- if (_listBox == null) return;
-
- if (!_preventSynchronization)
- {
- _preventSynchronization = true;
-
- _listBox.SelectedItems.Clear();
- _datagrid.SelectedItems.Clear();
-
- foreach (var item in SelectedItems)
- {
- _listBox.SelectedItems.Add(item);
- _datagrid.SelectedItems.Add(item);
- }
-
- _preventSynchronization = false;
- }
- }
-
- protected override void OnDrop(DragEventArgs e)
- {
- base.OnDrop(e);
-
- try
- {
- string[] items = (string[])e.Data.GetData(DataFormats.FileDrop, false);
-
- if (items != null && items.Length > 0)
- {
- List<FileSystemItem> fItems = new List<FileSystemItem>();
-
- foreach (var item in items)
- {
- if (Directory.Exists(item))
- {
- fItems.Add(new FolderItem() { Path = item });
- }
- else if (File.Exists(item))
- {
- fItems.Add(new FileItem() { Path = item });
- }
- }
-
- if (fItems.Count > 0)
- {
- DropCommand?.Execute(fItems);
- }
- }
- }
- catch { } //Ignore
- }
-
- protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
- {
- base.OnPreviewMouseLeftButtonDown(e);
-
- if (_isAfterContextMenu)
- {
- _isAfterContextMenu = false;
- return;
- }
-
- if (!AllowDrag) return;
-
- if (e.OriginalSource is FrameworkElement)
- {
- var listBoxItem = (e.OriginalSource as FrameworkElement).FindAncestor<ListBoxItem>();
- var dataGridRow = (e.OriginalSource as FrameworkElement).FindAncestor<DataGridRow>();
- if (listBoxItem == null && dataGridRow == null)
- {
- return;
- }
- }
-
- _selectedItemsBeforeDrag.Clear();
- _selectedItemsBeforeDrag.AddRange(SelectedItems);
- _isMouseDown = true;
- AllowDrop = false;
- _dragOutStartPoint = e.GetPosition(null);
- }
-
- protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
- {
- base.OnPreviewMouseLeftButtonUp(e);
- AllowDrop = true;
- _isMouseDown = false;
- }
-
- protected async override void OnPreviewMouseMove(MouseEventArgs e)
- {
- base.OnPreviewMouseMove(e);
-
- if (_isMouseDown && !IsContextMenuOpened)
- {
- Point mpos = e.GetPosition(null);
- Vector diff = this._dragOutStartPoint - mpos;
-
- if (e.LeftButton == MouseButtonState.Pressed &&
- Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
- Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
- {
- if (SelectedItems.Count == 0)
- {
- return;
- }
-
-
- SelectedItems.Clear();
-
- foreach (var item in _selectedItemsBeforeDrag)
- {
- SelectedItems.Add(item);
- }
-
- List<Tuple<FileSystemItem, TemporaryFile>> dropItems = new List<Tuple<FileSystemItem, TemporaryFile>>();
-
- foreach (var item in SelectedItems)
- {
- var tempFile = TemporaryManager.Default.CreateFile(".remote");
- dropItems.Add(new Tuple<FileSystemItem, TemporaryFile>(item, tempFile));
- }
-
- List<DragItem> notifyItems = new List<DragItem>();
-
- List<FileSystemWatcher> watchers = new List<FileSystemWatcher>();
-
- FileSystemEventHandler handler = (x, args) =>
- {
- var detectedDropItem = dropItems.SingleOrDefault(y => y.Item2.FileName == System.IO.Path.GetFileName(args.FullPath));
-
- Debug.WriteLine($"File Created: {args.FullPath}");
-
- if (detectedDropItem != null)
- {
- try
- {
- detectedDropItem.Item2.Delete(); //Delete temp file.
-
- if (File.Exists(args.FullPath))
- {
- File.Delete(args.FullPath); //Delete dropped fake file.
-
- dropItems.Remove(detectedDropItem);
-
- notifyItems.Add(new DragItem()
- {
- FileSystemItem = detectedDropItem.Item1,
- Destination = System.IO.Path.GetDirectoryName(args.FullPath),
- });
-
- if (dropItems.Count == 0)
- {
- foreach (var watcher in watchers)
- {
- watcher.Dispose();
- }
-
- //Notify to user with all items!
- Dispatcher.BeginInvoke(new Action(() =>
- {
- DragCommand?.Execute(notifyItems);
- }));
- }
- }
- }
- catch { }
- }
- else
- {
- Debug.WriteLine($"Not Found: {args.FullPath}");
- }
- };
-
- foreach (var drive in DriveInfo.GetDrives().Where(x => x.IsReady && (x.DriveType == DriveType.Fixed || x.DriveType == DriveType.Removable)))
- {
- FileSystemWatcher watcher = new FileSystemWatcher(drive.RootDirectory.FullName, "*.remote");
- watcher.IncludeSubdirectories = true;
- watcher.EnableRaisingEvents = true;
- watcher.Created += handler;
- watchers.Add(watcher);
- }
-
- string[] files = dropItems.Select(x => x.Item2.Path).ToArray();
-
- try
- {
- Debug.WriteLine("Drag Started...");
- var ef = DragDrop.DoDragDrop(this, new DataObject(DataFormats.FileDrop, files, false), DragDropEffects.Copy);
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex);
- Debugger.Break();
- }
-
- Debug.WriteLine("Drag Stopped...");
-
- await Task.Delay(3000);
-
- foreach (var watcher in watchers)
- {
- watcher.Dispose();
- }
-
- if (dropItems.Count > 0)
- {
- //Notify about problem!
- }
-
- _isMouseDown = false;
- AllowDrop = true;
- }
- }
- }
-
- private async void OnCurrentItemChanged()
- {
- if (IsVisible)
- {
- AllowDrop = true;
- await Task.Delay(100);
- this.Focus();
- Keyboard.Focus(this);
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControlMode.cs b/Software/Visual_Studio/Tango.FileSystem/FileExplorerControlMode.cs
deleted file mode 100644
index b11c93845..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FileExplorerControlMode.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem
-{
- public enum FileExplorerControlMode
- {
- Large,
- Details
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileItem.cs b/Software/Visual_Studio/Tango.FileSystem/FileItem.cs
deleted file mode 100644
index cbc90ce06..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FileItem.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Interop;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using Tango.Core.IO;
-
-namespace Tango.FileSystem
-{
- public class FileItem : FileSystemItem
- {
- private static Dictionary<String, BitmapSource> iconCache;
- private static Dictionary<String, BitmapSource> smallIconCache;
- private static Dictionary<String, String> typeDescriptionCache;
-
- static FileItem()
- {
- iconCache = new Dictionary<string, BitmapSource>();
- smallIconCache = new Dictionary<string, BitmapSource>();
- typeDescriptionCache = new Dictionary<string, string>();
- }
-
- public FileItem()
- {
- Type = FileSystemItemType.File;
- }
-
- public String Extension
- {
- get { return System.IO.Path.GetExtension(Path); }
- }
-
- private BitmapSource _icon;
- public BitmapSource Icon
- {
- get
- {
- if (_icon == null)
- {
- _icon = GetFileIcon();
- }
-
- return _icon;
- }
- }
-
- private BitmapSource _smallIcon;
- public BitmapSource SmallIcon
- {
- get
- {
- if (_smallIcon == null)
- {
- _smallIcon = GetSmallFileIcon();
- }
-
- return _smallIcon;
- }
- }
-
- public override string Description
- {
- get
- {
- if (typeDescriptionCache.ContainsKey(Extension))
- {
- return typeDescriptionCache[Extension];
- }
- else
- {
- var tempFile = TemporaryManager.Default.CreateFile(Extension);
- var shellFile = Microsoft.WindowsAPICodePack.Shell.ShellFile.FromFilePath(tempFile);
- var text = shellFile.Properties.System.ItemTypeText.Value.ToStringSafe();
- shellFile.Dispose();
- tempFile.Delete();
- typeDescriptionCache.Add(Extension, text);
- return text;
- }
- }
- }
-
- protected BitmapSource GetFileIcon()
- {
- if (iconCache.ContainsKey(Extension))
- {
- return iconCache[Extension];
- }
- else
- {
- var tempFile = TemporaryManager.Default.CreateFile(Extension);
- var shellFile = Microsoft.WindowsAPICodePack.Shell.ShellFile.FromFilePath(tempFile);
- var source = shellFile.Thumbnail.MediumBitmapSource;
- shellFile.Dispose();
- tempFile.Delete();
- iconCache.Add(Extension, source);
- return source;
- }
- }
-
- private BitmapSource GetSmallFileIcon()
- {
- if (smallIconCache.ContainsKey(Extension))
- {
- return smallIconCache[Extension];
- }
- else
- {
- var tempFile = TemporaryManager.Default.CreateFile(Extension);
- var shellFile = Microsoft.WindowsAPICodePack.Shell.ShellFile.FromFilePath(tempFile);
- var source = shellFile.Thumbnail.SmallBitmapSource;
- shellFile.Dispose();
- tempFile.Delete();
- smallIconCache.Add(Extension, source);
- return source;
- }
- }
-
- private BitmapSource IconToBitmapSource(Icon icon)
- {
- var imageSource = Imaging.CreateBitmapSourceFromHIcon(
- icon.Handle,
- Int32Rect.Empty,
- BitmapSizeOptions.FromEmptyOptions());
- return imageSource;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemDataGrid.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemDataGrid.cs
deleted file mode 100644
index c1c31cf95..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FileSystemDataGrid.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace Tango.FileSystem
-{
- public class FileSystemDataGrid : DataGrid
- {
- static FileSystemDataGrid()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(FileSystemDataGrid), new FrameworkPropertyMetadata(typeof(FileSystemDataGrid)));
- }
-
- protected override DependencyObject GetContainerForItemOverride()
- {
- return new FileSystemDataGridRow();
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemDataGridRow.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemDataGridRow.cs
deleted file mode 100644
index 4cc67f888..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FileSystemDataGridRow.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace Tango.FileSystem
-{
- public class FileSystemDataGridRow : DataGridRow
- {
- public ICommand DoubleClickCommand
- {
- get { return (ICommand)GetValue(DoubleClickCommandProperty); }
- set { SetValue(DoubleClickCommandProperty, value); }
- }
- public static readonly DependencyProperty DoubleClickCommandProperty =
- DependencyProperty.Register("DoubleClickCommand", typeof(ICommand), typeof(FileSystemDataGridRow), new PropertyMetadata(null));
-
- protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e)
- {
- base.OnPreviewMouseDoubleClick(e);
-
- DoubleClickCommand?.Execute(DataContext);
- }
-
- static FileSystemDataGridRow()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(FileSystemDataGridRow), new FrameworkPropertyMetadata(typeof(FileSystemDataGridRow)));
- }
- }
-}
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;
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemItemType.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemItemType.cs
deleted file mode 100644
index 5af1858a9..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FileSystemItemType.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem
-{
- public enum FileSystemItemType
- {
- Drive,
- Folder,
- File,
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
deleted file mode 100644
index dc8efa7dd..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs
+++ /dev/null
@@ -1,261 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
-using Tango.Core.Helpers;
-using Tango.FileSystem.Network;
-using Tango.Logging;
-
-namespace Tango.FileSystem
-{
- public class FileSystemManager
- {
- public FileSystemItemDTO GetRoot()
- {
- FileSystemItemDTO folder = new FileSystemItemDTO();
- folder.Path = "This PC";
- folder.IsRoot = true;
- folder.Type = FileSystemItemType.Folder;
- 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,
- DriveLabel = $"{x.VolumeLabel} ({x.Name.Replace("\\", "")})",
- Type = FileSystemItemType.Drive,
- }).Cast<FileSystemItemDTO>().ToList();
-
- return folder;
- }
-
- public FileSystemItemDTO GetFolder(GetFileSystemItemRequest request)
- {
- List<FileSystemItemDTO> items = new List<FileSystemItemDTO>();
-
- if (request.SpecialFolder.HasValue)
- {
- request.Path = Environment.GetFolderPath(request.SpecialFolder.Value);
- }
-
- if (String.IsNullOrWhiteSpace(request.Path))
- {
- return GetRoot();
- }
-
- try
- {
- if (request.Path.Count(x => x == '%') == 2)
- {
- var variable = Regex.Match(request.Path, "(?<=%)(.*?)(?=%)").Value;
- request.Path = request.Path.Replace($"%{variable}%", Environment.ExpandEnvironmentVariables($"%{variable}%"));
- }
- }
- catch
- {
- throw new ArgumentException("Could not parse environment variable.");
- }
-
- request.Path = Path.GetFullPath(request.Path);
-
- if (!Directory.Exists(request.Path))
- {
- throw new DirectoryNotFoundException("The specified directory could not be located.");
- }
-
- foreach (var directory in Directory.GetDirectories(request.Path))
- {
- items.Add(new FileSystemItemDTO()
- {
- Path = directory,
- Type = FileSystemItemType.Folder,
- DateModified = Directory.GetLastWriteTimeUtc(directory),
- DateCreated = Directory.GetCreationTimeUtc(directory),
- });
- }
-
- if (!request.FoldersOnly)
- {
- foreach (var file in Directory.GetFiles(request.Path, request.Filter != null ? request.Filter : "*.*"))
- {
- items.Add(new FileSystemItemDTO()
- {
- Path = file,
- Type = FileSystemItemType.File,
- DateModified = File.GetLastWriteTimeUtc(file),
- DateCreated = File.GetCreationTimeUtc(file),
- Size = new FileInfo(file).Length
- });
- }
- }
-
- return new FileSystemItemDTO()
- {
- Path = request.Path,
- Type = request.Path.Length == 3 ? FileSystemItemType.Drive : FileSystemItemType.Folder,
- Items = items
- };
- }
-
- public Task<FileSystemItem> GetFolder(String path, bool foldersOnly = false, String filter = "*.*")
- {
- return Task.Factory.StartNew<FileSystemItem>(() =>
- {
- return FileSystemItem.FromDTO(GetFolder(new GetFileSystemItemRequest()
- {
- Path = path,
- FoldersOnly = foldersOnly,
- Filter = filter,
- }));
- });
- }
-
- public Task<FileSystemItem> GetFolder(Environment.SpecialFolder specialFolder, bool foldersOnly = false, String filter = "*.*")
- {
- return Task.Factory.StartNew<FileSystemItem>(() =>
- {
- return FileSystemItem.FromDTO(GetFolder(new GetFileSystemItemRequest()
- {
- SpecialFolder = specialFolder,
- FoldersOnly = foldersOnly,
- Filter = filter,
- }));
- });
- }
-
- public void Delete(String path)
- {
- if (Directory.Exists(path))
- {
- Directory.Delete(path, true);
- }
- else if (File.Exists(path))
- {
- File.Delete(path);
- }
- else
- {
- throw new FileNotFoundException("Could not locate the specified file or directory.");
- }
- }
-
- public void Move(MoveRequest request)
- {
- if (Directory.Exists(request.Destination))
- {
- throw new IOException($"'{Path.GetFileName(request.Destination)}' already exists on the target folder.");
- }
-
- if (File.Exists(request.Source))
- {
- File.Move(request.Source, request.Destination);
- }
- else if (Directory.Exists(request.Source))
- {
- Directory.Move(request.Source, request.Destination);
- }
- else
- {
- throw new FileNotFoundException("Could not locate the source file or folder.");
- }
- }
-
- public void Copy(CopyRequest request)
- {
- if (File.Exists(request.Source))
- {
- if (request.Source == request.Destination)
- {
- while (File.Exists(request.Destination))
- {
- request.Destination = Path.Combine(Path.GetDirectoryName(request.Destination), Path.GetFileNameWithoutExtension(request.Destination)) + " copy" + Path.GetExtension(request.Destination);
- }
- }
- File.Copy(request.Source, request.Destination, true);
- }
- else if (Directory.Exists(request.Source))
- {
- Directory.CreateDirectory(Path.GetDirectoryName(request.Destination));
- PathHelper.CopyDirectory(request.Source, request.Destination, true);
- }
- else
- {
- throw new FileNotFoundException("Could not locate the source file or folder.");
- }
- }
-
- public FileSystemItemDTO CreateFolder(String path, String folderName)
- {
- String fullPath = Path.Combine(path, folderName);
-
- if (Directory.Exists(fullPath))
- {
- throw new IOException("The specified directory name already exists.");
- }
-
- Directory.CreateDirectory(fullPath);
-
- return GetFolder(new GetFileSystemItemRequest()
- {
- Path = fullPath
- });
- }
-
- public long PerformDiskSpaceOptimization()
- {
- var tempDir = Path.GetTempPath();
- var logsFolder = FileLogger.DefaultLogsFolder;
-
- long sizeBefore = GetDirectorySize(new DirectoryInfo(tempDir)) + GetDirectorySize(new DirectoryInfo(logsFolder));
-
- foreach (var file in Directory.GetFiles(tempDir, "*.*", SearchOption.AllDirectories))
- {
- try
- {
- FileInfo fileInfo = new FileInfo(file);
- if (fileInfo.LastWriteTime < DateTime.Now.AddDays(-1))
- {
- File.Delete(file);
- }
- }
- catch { }
- }
-
- foreach (var file in Directory.GetFiles(logsFolder, "*.*", SearchOption.AllDirectories))
- {
- try
- {
- FileInfo fileInfo = new FileInfo(file);
- if (fileInfo.LastWriteTime < DateTime.Now.AddDays(-2))
- {
- File.Delete(file);
- }
- }
- catch { }
- }
-
- long sizeAfter = GetDirectorySize(new DirectoryInfo(tempDir)) + GetDirectorySize(new DirectoryInfo(logsFolder));
-
- return Math.Max(sizeBefore - sizeAfter, 0);
- }
-
- public static long GetDirectorySize(DirectoryInfo d)
- {
- long size = 0;
- // Add file sizes.
- FileInfo[] fis = d.GetFiles();
- foreach (FileInfo fi in fis)
- {
- size += fi.Length;
- }
- // Add subdirectory sizes.
- DirectoryInfo[] dis = d.GetDirectories();
- foreach (DirectoryInfo di in dis)
- {
- size += GetDirectorySize(di);
- }
- return size;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/FolderItem.cs b/Software/Visual_Studio/Tango.FileSystem/FolderItem.cs
deleted file mode 100644
index 95b065a2d..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/FolderItem.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem
-{
- public class FolderItem : FileSystemItem, IFileSystemContainer
- {
- public ObservableCollection<FileSystemItem> Items { get; set; }
-
- public bool IsRoot { get; set; }
-
- public object Icon { get; set; } //Fake for binding error.
-
- public object SmallIcon { get; set; } //Fake for binding error.
-
- public FolderItem()
- {
- Type = FileSystemItemType.Folder;
- Items = new ObservableCollection<FileSystemItem>();
- }
-
- public override string Description
- {
- get
- {
- return "Folder";
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/IFileSystemContainer.cs b/Software/Visual_Studio/Tango.FileSystem/IFileSystemContainer.cs
deleted file mode 100644
index a75764a14..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/IFileSystemContainer.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem
-{
- public interface IFileSystemContainer
- {
- ObservableCollection<FileSystemItem> Items { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Images/drive.png b/Software/Visual_Studio/Tango.FileSystem/Images/drive.png
deleted file mode 100644
index b0cda6195..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Images/drive.png
+++ /dev/null
Binary files differ
diff --git a/Software/Visual_Studio/Tango.FileSystem/Images/folder.png b/Software/Visual_Studio/Tango.FileSystem/Images/folder.png
deleted file mode 100644
index 800af7186..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Images/folder.png
+++ /dev/null
Binary files differ
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationRequest.cs
deleted file mode 100644
index 3e912b9f0..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class AbortOperationRequest
- {
- public String OperationId { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationResponse.cs
deleted file mode 100644
index c5669ad48..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/AbortOperationResponse.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class AbortOperationResponse
- {
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadRequest.cs
deleted file mode 100644
index caedad88b..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadRequest.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class ChunkDownloadRequest
- {
- public String OperationId { get; set; }
- public long Position { get; set; }
- public long MaxChunkSize { get; set; } = 1024 * 10;
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadResponse.cs
deleted file mode 100644
index df72e193f..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkDownloadResponse.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class ChunkDownloadResponse
- {
- public byte[] Data { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadRequest.cs
deleted file mode 100644
index ed6b3e45f..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadRequest.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class ChunkUploadRequest
- {
- public String OperationId { get; set; }
- public byte[] Data { get; set; }
- public bool IsCompleted { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadResponse.cs
deleted file mode 100644
index 5cd6a3f80..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/ChunkUploadResponse.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class ChunkUploadResponse
- {
-
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/CopyRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/CopyRequest.cs
deleted file mode 100644
index 2e7b8a406..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/CopyRequest.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class CopyRequest
- {
- public String Source { get; set; }
- public String Destination { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/CopyResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/CopyResponse.cs
deleted file mode 100644
index e22ce6542..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/CopyResponse.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class CopyResponse
- {
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs
deleted file mode 100644
index 77452dcdf..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderRequest.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class CreateFolderRequest
- {
- public String Path { get; set; }
- public String FolderName { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs
deleted file mode 100644
index d52e52c47..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/CreateFolderResponse.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class CreateFolderResponse
- {
- public FileSystemItemDTO FolderItem { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/DeleteRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/DeleteRequest.cs
deleted file mode 100644
index 300acdb09..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/DeleteRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class DeleteRequest
- {
- public String Path { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/DeleteResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/DeleteResponse.cs
deleted file mode 100644
index 37afdab0b..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/DeleteResponse.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class DeleteResponse
- {
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadRequest.cs
deleted file mode 100644
index b63937f8b..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FileDownloadRequest
- {
- public String Path { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadResponse.cs
deleted file mode 100644
index c57a9bad6..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FileDownloadResponse.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FileDownloadResponse
- {
- public long Length { get; set; }
- public String OperationId { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs
deleted file mode 100644
index 43467f227..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FileSystemItemDTO.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FileSystemItemDTO
- {
- public String Path { get; set; }
-
- public String DriveLabel { get; set; }
-
- public FileSystemItemType Type { get; set; }
-
- public DriveType DriveType { get; set; }
-
- public DateTime DateModified { get; set; }
-
- public DateTime DateCreated { get; set; }
-
- public long Size { get; set; }
-
- public bool IsRoot { get; set; }
-
- public List<FileSystemItemDTO> Items { get; set; }
-
- public FileSystemItemDTO()
- {
- Items = new List<FileSystemItemDTO>();
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FileUploadRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FileUploadRequest.cs
deleted file mode 100644
index f3cbc2d54..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FileUploadRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FileUploadRequest
- {
- public String Path { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FileUploadResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FileUploadResponse.cs
deleted file mode 100644
index c0af1a797..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FileUploadResponse.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FileUploadResponse
- {
- public String OperationId { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadRequest.cs
deleted file mode 100644
index cb65a8942..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FolderDownloadRequest
- {
- public String Path { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadResponse.cs
deleted file mode 100644
index 239ff2e59..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FolderDownloadResponse.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FolderDownloadResponse
- {
- public long Length { get; set; }
- public String OperationId { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadRequest.cs
deleted file mode 100644
index 79a93eff3..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FolderUploadRequest
- {
- public String Path { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadResponse.cs
deleted file mode 100644
index dc661dc95..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/FolderUploadResponse.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class FolderUploadResponse
- {
- public String OperationId { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemRequest.cs
deleted file mode 100644
index 3cf91e869..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemRequest.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using static System.Environment;
-
-namespace Tango.FileSystem.Network
-{
- public class GetFileSystemItemRequest
- {
- public String Path { get; set; }
- public SpecialFolder? SpecialFolder { get; set; }
- public bool FoldersOnly { get; set; }
- public String Filter { get; set; } = "*.*";
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemResponse.cs
deleted file mode 100644
index 8b82e41fc..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/GetFileSystemItemResponse.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class GetFileSystemItemResponse
- {
- public FileSystemItemDTO FileSystemItem { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcRequest.cs
deleted file mode 100644
index 5d8f1eb3a..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class InitWebRtcRequest
- {
- public String DataChannelName { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcResponse.cs
deleted file mode 100644
index 3425a9096..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/InitWebRtcResponse.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class InitWebRtcResponse
- {
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/MoveRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/MoveRequest.cs
deleted file mode 100644
index 0d9f593d3..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/MoveRequest.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class MoveRequest
- {
- public String Source { get; set; }
- public String Destination { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/MoveResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/MoveResponse.cs
deleted file mode 100644
index 05d78c573..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/MoveResponse.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class MoveResponse
- {
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationRequest.cs b/Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationRequest.cs
deleted file mode 100644
index bd69bf9d8..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationRequest.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class PerformDiskSpaceOptimizationRequest
- {
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationResponse.cs b/Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationResponse.cs
deleted file mode 100644
index 73cbbf566..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Network/PerformDiskSpaceOptimizationResponse.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.FileSystem.Network
-{
- public class PerformDiskSpaceOptimizationResponse
- {
- public long DeletedBytes { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.FileSystem/Properties/AssemblyInfo.cs
deleted file mode 100644
index 6daf8a3bd..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Tango.FileSystem")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Tango.FileSystem")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
-//inside a <PropertyGroup>. For example, if you are using US english
-//in your source files, set the <UICulture> to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly:ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Software/Visual_Studio/Tango.FileSystem/Properties/Resources.Designer.cs b/Software/Visual_Studio/Tango.FileSystem/Properties/Resources.Designer.cs
deleted file mode 100644
index 10db63263..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Tango.FileSystem.Properties {
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if ((resourceMan == null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.FileSystem.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Properties/Resources.resx b/Software/Visual_Studio/Tango.FileSystem/Properties/Resources.resx
deleted file mode 100644
index af7dbebba..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
-</root> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.FileSystem/Properties/Settings.Designer.cs b/Software/Visual_Studio/Tango.FileSystem/Properties/Settings.Designer.cs
deleted file mode 100644
index ddac2a111..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace Tango.FileSystem.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.FileSystem/Properties/Settings.settings b/Software/Visual_Studio/Tango.FileSystem/Properties/Settings.settings
deleted file mode 100644
index 033d7a5e9..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
- <Profiles>
- <Profile Name="(Default)" />
- </Profiles>
- <Settings />
-</SettingsFile> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj b/Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj
deleted file mode 100644
index d78419b7f..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Tango.FileSystem.csproj
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{C6EBBBBE-2123-44DC-AEF7-A0D47D736AC0}</ProjectGuid>
- <OutputType>library</OutputType>
- <RootNamespace>Tango.FileSystem</RootNamespace>
- <AssemblyName>Tango.FileSystem</AssemblyName>
- <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <WarningLevel>4</WarningLevel>
- <Deterministic>true</Deterministic>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Xml" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Xaml">
- <RequiredTargetFramework>4.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="WindowsBase" />
- <Reference Include="PresentationCore" />
- <Reference Include="PresentationFramework" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="DragItem.cs" />
- <Compile Include="FileSystemDataGrid.cs" />
- <Compile Include="FileSystemDataGridRow.cs" />
- <Compile Include="Network\AbortOperationRequest.cs" />
- <Compile Include="Network\AbortOperationResponse.cs" />
- <Compile Include="Network\ChunkUploadRequest.cs" />
- <Compile Include="Network\ChunkUploadResponse.cs" />
- <Compile Include="Network\ChunkDownloadRequest.cs" />
- <Compile Include="Network\ChunkDownloadResponse.cs" />
- <Compile Include="Network\CopyRequest.cs" />
- <Compile Include="Network\CopyResponse.cs" />
- <Compile Include="Network\CreateFolderRequest.cs" />
- <Compile Include="Network\CreateFolderResponse.cs" />
- <Compile Include="Network\DeleteRequest.cs" />
- <Compile Include="Network\DeleteResponse.cs" />
- <Compile Include="Network\FolderUploadRequest.cs" />
- <Compile Include="Network\FolderUploadResponse.cs" />
- <Compile Include="Network\InitWebRtcRequest.cs" />
- <Compile Include="Network\InitWebRtcResponse.cs" />
- <Compile Include="Network\MoveRequest.cs" />
- <Compile Include="Network\MoveResponse.cs" />
- <Compile Include="Network\PerformDiskSpaceOptimizationRequest.cs" />
- <Compile Include="Network\PerformDiskSpaceOptimizationResponse.cs" />
- <Compile Include="VirtualFileDataObject.cs" />
- <Page Include="Themes\Generic.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Compile Include="DriveItem.cs" />
- <Compile Include="FileExplorerControl.cs">
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="FileExplorerControlMode.cs" />
- <Compile Include="FileItem.cs" />
- <Compile Include="FileSystemItem.cs" />
- <Compile Include="FileSystemItemType.cs" />
- <Compile Include="FileSystemManager.cs" />
- <Compile Include="FolderItem.cs" />
- <Compile Include="IFileSystemContainer.cs" />
- <Compile Include="Network\FileSystemItemDTO.cs" />
- <Compile Include="Network\FileUploadRequest.cs" />
- <Compile Include="Network\FileUploadResponse.cs" />
- <Compile Include="Network\GetFileSystemItemRequest.cs" />
- <Compile Include="Network\GetFileSystemItemResponse.cs" />
- <Compile Include="Network\FileDownloadRequest.cs" />
- <Compile Include="Network\FileDownloadResponse.cs" />
- <Compile Include="Network\FolderDownloadRequest.cs" />
- <Compile Include="Network\FolderDownloadResponse.cs" />
- <Compile Include="Properties\AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Properties\Resources.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Resources.resx</DependentUpon>
- </Compile>
- <Compile Include="Properties\Settings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DependentUpon>Settings.settings</DependentUpon>
- <DesignTimeSharedInput>True</DesignTimeSharedInput>
- </Compile>
- <EmbeddedResource Include="Properties\Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Resources.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <None Include="Properties\Settings.settings">
- <Generator>SettingsSingleFileGenerator</Generator>
- <LastGenOutput>Settings.Designer.cs</LastGenOutput>
- </None>
- </ItemGroup>
- <ItemGroup>
- <Resource Include="Images\drive.png" />
- <Resource Include="Images\folder.png" />
- </ItemGroup>
- <ItemGroup>
- <PackageReference Include="WindowsAPICodePack-Shell">
- <Version>1.1.1</Version>
- </PackageReference>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Tango.Core\Tango.Core.csproj">
- <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
- <Name>Tango.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\Tango.Logging\Tango.Logging.csproj">
- <Project>{BC932DBD-7CDB-488C-99E4-F02CF441F55E}</Project>
- <Name>Tango.Logging</Name>
- </ProjectReference>
- <ProjectReference Include="..\Tango.SharedUI\Tango.SharedUI.csproj">
- <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
- <Name>Tango.SharedUI</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.FileSystem/Themes/Generic.xaml b/Software/Visual_Studio/Tango.FileSystem/Themes/Generic.xaml
deleted file mode 100644
index 9cc27c7c6..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/Themes/Generic.xaml
+++ /dev/null
@@ -1,206 +0,0 @@
-<ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
- xmlns:local="clr-namespace:Tango.FileSystem">
-
- <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" />
- <converters:DateTimeUtcToLocalDateTime x:Key="DateTimeUtcToLocalDateTime" />
-
- <Style TargetType="{x:Type local:FileSystemDataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}">
- <Setter Property="DoubleClickCommand" Value="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=ItemDoubleClickedCommand}"></Setter>
- </Style>
-
- <Style TargetType="{x:Type local:FileSystemDataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}">
-
- </Style>
-
- <Style x:Key="FileSystemCellStyle" TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
- </Style>
-
- <ContextMenu x:Key="ItemContextMenu">
- <MenuItem Header="Copy"/>
- <MenuItem Header="Paste"/>
- <MenuItem Header="Delete"/>
- <MenuItem Header="Select All"/>
- </ContextMenu>
-
- <Style TargetType="{x:Type local:FileExplorerControl}">
- <Setter Property="DriveIcon" Value="pack://application:,,,/Tango.FileSystem;component/Images/drive.png"></Setter>
- <Setter Property="FolderIcon" Value="pack://application:,,,/Tango.FileSystem;component/Images/folder.png"></Setter>
- <Setter Property="Mode" Value="Details"></Setter>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
- <Setter Property="Focusable" Value="True"></Setter>
- <Setter Property="AllowDrop" Value="True"></Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type local:FileExplorerControl}">
- <Border Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}">
- <Grid Background="Transparent">
- <ListBox x:Name="PART_listbox" Background="Transparent" SelectionMode="Extended" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemsSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=CurrentItem.Items}" SelectedItem="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=SelectedItem,Mode=TwoWay}">
- <ListBox.Style>
- <Style TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
- <Setter Property="Visibility" Value="Collapsed"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Mode}" Value="Large">
- <Setter Property="Visibility" Value="Visible"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ListBox.Style>
- <ListBox.ItemContainerStyle>
- <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
- <Setter Property="Padding" Value="5"></Setter>
- <Setter Property="Margin" Value="10"></Setter>
- <Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}"></Setter>
- </Style>
- </ListBox.ItemContainerStyle>
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal" IsItemsHost="True" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <DockPanel Width="70" Height="115" Background="Transparent">
- <DockPanel.InputBindings>
- <MouseBinding MouseAction="LeftDoubleClick"
- Command="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=ItemDoubleClickedCommand}"
- CommandParameter="{Binding}" />
- </DockPanel.InputBindings>
- <Image DockPanel.Dock="Top" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Top">
- <Image.Style>
- <Style TargetType="Image">
- <Style.Triggers>
- <DataTrigger Binding="{Binding Type}" Value="Folder">
- <Setter Property="Source" Value="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=FolderIcon}"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding Type}" Value="Drive">
- <Setter Property="Source" Value="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=DriveIcon}"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding Type}" Value="File">
- <Setter Property="Source" Value="{Binding Icon}"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Image.Style>
- </Image>
- <TextBlock Text="{Binding Name}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Center" TextAlignment="Center" Margin="0 10 0 0"></TextBlock>
- </DockPanel>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
-
- <Grid>
- <Grid.Style>
- <Style TargetType="Grid">
- <Setter Property="Visibility" Value="Collapsed"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Mode}" Value="Details">
- <Setter Property="Visibility" Value="Visible"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Grid.Style>
- <local:FileSystemDataGrid x:Name="PART_datagrid" ItemsSource="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=CurrentItem.Items}" CellStyle="{StaticResource FileSystemCellStyle}">
- <DataGrid.Style>
- <Style TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
- <Setter Property="Background" Value="Transparent"></Setter>
- <Setter Property="AutoGenerateColumns" Value="False"></Setter>
- <Setter Property="CanUserAddRows" Value="False"></Setter>
- <Setter Property="CanUserDeleteRows" Value="False"></Setter>
- <Setter Property="CanUserReorderColumns" Value="False"></Setter>
- <Setter Property="CanUserResizeColumns" Value="True"></Setter>
- <Setter Property="CanUserResizeRows" Value="False"></Setter>
- <Setter Property="CanUserSortColumns" Value="True"></Setter>
- <Setter Property="IsReadOnly" Value="True"></Setter>
- <Setter Property="SelectionMode" Value="Extended"></Setter>
- <Setter Property="SelectionUnit" Value="FullRow"></Setter>
- <Setter Property="RowHeight" Value="22"></Setter>
- <Setter Property="HorizontalGridLinesBrush" Value="Transparent"></Setter>
- <Setter Property="VerticalGridLinesBrush" Value="Transparent"></Setter>
- <Setter Property="HorizontalScrollBarVisibility" Value="Disabled"></Setter>
- <Setter Property="CellStyle" Value="{StaticResource FileSystemCellStyle}" />
- </Style>
- </DataGrid.Style>
-
- <DataGrid.Columns>
- <DataGridTemplateColumn Header="Name" Width="300*" SortMemberPath="Name">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <DockPanel Background="Transparent">
- <Image Width="18" Height="18" RenderOptions.BitmapScalingMode="Fant" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Image.Style>
- <Style TargetType="Image">
- <Style.Triggers>
- <DataTrigger Binding="{Binding Type}" Value="Drive">
- <Setter Property="Source" Value="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=DriveIcon}"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding Type}" Value="File">
- <Setter Property="Source" Value="{Binding SmallIcon}"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding Type}" Value="Folder">
- <Setter Property="Source" Value="{Binding RelativeSource={RelativeSource AncestorType=local:FileExplorerControl},Path=FolderIcon}"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Image.Style>
- </Image>
- <TextBlock Text="{Binding Name}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" Margin="5 0 0 0"></TextBlock>
- </DockPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="Date Modified" Width="170*" SortMemberPath="DateModified">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <DockPanel Background="Transparent">
- <TextBlock Text="{Binding DateModified,Converter={StaticResource DateTimeUtcToLocalDateTime}}" VerticalAlignment="Center"></TextBlock>
- </DockPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="Type" Width="140*" SortMemberPath="Type">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <DockPanel Background="Transparent">
- <TextBlock Text="{Binding Description}" VerticalAlignment="Center"></TextBlock>
- </DockPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="Size" Width="100*" SortMemberPath="Size">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <DockPanel Background="Transparent">
- <TextBlock Text="{Binding Size,Converter={StaticResource ByteArrayToFileSizeConverter}}" VerticalAlignment="Center">
- <TextBlock.Style>
- <Style TargetType="TextBlock">
- <Setter Property="Visibility" Value="Hidden"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Type}" Value="File">
- <Setter Property="Visibility" Value="Visible"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </TextBlock.Style>
- </TextBlock>
- </DockPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </local:FileSystemDataGrid>
- </Grid>
- </Grid>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-</ResourceDictionary>
diff --git a/Software/Visual_Studio/Tango.FileSystem/VirtualFileDataObject.cs b/Software/Visual_Studio/Tango.FileSystem/VirtualFileDataObject.cs
deleted file mode 100644
index a4a065792..000000000
--- a/Software/Visual_Studio/Tango.FileSystem/VirtualFileDataObject.cs
+++ /dev/null
@@ -1,983 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using System.Windows;
-
-namespace Tango.FileSystem
-{
- /// <summary>
- /// Class implementing drag/drop and clipboard support for virtual files.
- /// Also offers an alternate interface to the IDataObject interface.
- /// </summary>
- public sealed class VirtualFileDataObject : System.Runtime.InteropServices.ComTypes.IDataObject, IAsyncOperation
- {
- /// <summary>
- /// Gets or sets a value indicating whether the data object can be used asynchronously.
- /// </summary>
- public bool IsAsynchronous { get; set; }
-
- /// <summary>
- /// Identifier for CFSTR_FILECONTENTS.
- /// </summary>
- private static short FILECONTENTS = (short)(DataFormats.GetDataFormat(NativeMethods.CFSTR_FILECONTENTS).Id);
-
- /// <summary>
- /// Identifier for CFSTR_FILEDESCRIPTORW.
- /// </summary>
- private static short FILEDESCRIPTORW = (short)(DataFormats.GetDataFormat(NativeMethods.CFSTR_FILEDESCRIPTORW).Id);
-
- /// <summary>
- /// Identifier for CFSTR_PASTESUCCEEDED.
- /// </summary>
- private static short PASTESUCCEEDED = (short)(DataFormats.GetDataFormat(NativeMethods.CFSTR_PASTESUCCEEDED).Id);
-
- /// <summary>
- /// Identifier for CFSTR_PERFORMEDDROPEFFECT.
- /// </summary>
- private static short PERFORMEDDROPEFFECT = (short)(DataFormats.GetDataFormat(NativeMethods.CFSTR_PERFORMEDDROPEFFECT).Id);
-
- /// <summary>
- /// Identifier for CFSTR_PREFERREDDROPEFFECT.
- /// </summary>
- private static short PREFERREDDROPEFFECT = (short)(DataFormats.GetDataFormat(NativeMethods.CFSTR_PREFERREDDROPEFFECT).Id);
-
- /// <summary>
- /// In-order list of registered data objects.
- /// </summary>
- private List<DataObject> _dataObjects = new List<DataObject>();
-
- /// <summary>
- /// Tracks whether an asynchronous operation is ongoing.
- /// </summary>
- private bool _inOperation;
-
- /// <summary>
- /// Stores the user-specified start action.
- /// </summary>
- private Action<VirtualFileDataObject> _startAction;
-
- /// <summary>
- /// Stores the user-specified end action.
- /// </summary>
- private Action<VirtualFileDataObject> _endAction;
-
- /// <summary>
- /// Initializes a new instance of the VirtualFileDataObject class.
- /// </summary>
- public VirtualFileDataObject()
- {
- IsAsynchronous = true;
- }
-
- /// <summary>
- /// Initializes a new instance of the VirtualFileDataObject class.
- /// </summary>
- /// <param name="startAction">Optional action to run at the start of the data transfer.</param>
- /// <param name="endAction">Optional action to run at the end of the data transfer.</param>
- public VirtualFileDataObject(Action<VirtualFileDataObject> startAction, Action<VirtualFileDataObject> endAction)
- : this()
- {
- _startAction = startAction;
- _endAction = endAction;
- }
-
- #region IDataObject Members
- // Explicit interface implementation hides the technical details from users of VirtualFileDataObject.
-
- /// <summary>
- /// Creates a connection between a data object and an advisory sink.
- /// </summary>
- /// <param name="pFormatetc">A FORMATETC structure that defines the format, target device, aspect, and medium that will be used for future notifications.</param>
- /// <param name="advf">One of the ADVF values that specifies a group of flags for controlling the advisory connection.</param>
- /// <param name="adviseSink">A pointer to the IAdviseSink interface on the advisory sink that will receive the change notification.</param>
- /// <param name="connection">When this method returns, contains a pointer to a DWORD token that identifies this connection.</param>
- /// <returns>HRESULT success code.</returns>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- int System.Runtime.InteropServices.ComTypes.IDataObject.DAdvise(ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection)
- {
- Marshal.ThrowExceptionForHR(NativeMethods.OLE_E_ADVISENOTSUPPORTED);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Destroys a notification connection that had been previously established.
- /// </summary>
- /// <param name="connection">A DWORD token that specifies the connection to remove.</param>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- void System.Runtime.InteropServices.ComTypes.IDataObject.DUnadvise(int connection)
- {
- Marshal.ThrowExceptionForHR(NativeMethods.OLE_E_ADVISENOTSUPPORTED);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Creates an object that can be used to enumerate the current advisory connections.
- /// </summary>
- /// <param name="enumAdvise">When this method returns, contains an IEnumSTATDATA that receives the interface pointer to the new enumerator object.</param>
- /// <returns>HRESULT success code.</returns>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- int System.Runtime.InteropServices.ComTypes.IDataObject.EnumDAdvise(out IEnumSTATDATA enumAdvise)
- {
- Marshal.ThrowExceptionForHR(NativeMethods.OLE_E_ADVISENOTSUPPORTED);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Creates an object for enumerating the FORMATETC structures for a data object.
- /// </summary>
- /// <param name="direction">One of the DATADIR values that specifies the direction of the data.</param>
- /// <returns>IEnumFORMATETC interface.</returns>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- IEnumFORMATETC System.Runtime.InteropServices.ComTypes.IDataObject.EnumFormatEtc(DATADIR direction)
- {
- if (direction == DATADIR.DATADIR_GET)
- {
- if (0 == _dataObjects.Count)
- {
- // Note: SHCreateStdEnumFmtEtc fails for a count of 0; throw helpful exception
- throw new InvalidOperationException("VirtualFileDataObject requires at least one data object to enumerate.");
- }
-
- // Create enumerator and return it
- IEnumFORMATETC enumerator;
- if (NativeMethods.SUCCEEDED(NativeMethods.SHCreateStdEnumFmtEtc((uint)(_dataObjects.Count), _dataObjects.Select(d => d.FORMATETC).ToArray(), out enumerator)))
- {
- return enumerator;
- }
-
- // Returning null here can cause an AV in the caller; throw instead
- Marshal.ThrowExceptionForHR(NativeMethods.E_FAIL);
- }
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Provides a standard FORMATETC structure that is logically equivalent to a more complex structure.
- /// </summary>
- /// <param name="formatIn">A pointer to a FORMATETC structure that defines the format, medium, and target device that the caller would like to use to retrieve data in a subsequent call such as GetData.</param>
- /// <param name="formatOut">When this method returns, contains a pointer to a FORMATETC structure that contains the most general information possible for a specific rendering, making it canonically equivalent to formatetIn.</param>
- /// <returns>HRESULT success code.</returns>
- int System.Runtime.InteropServices.ComTypes.IDataObject.GetCanonicalFormatEtc(ref FORMATETC formatIn, out FORMATETC formatOut)
- {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Obtains data from a source data object.
- /// </summary>
- /// <param name="format">A pointer to a FORMATETC structure that defines the format, medium, and target device to use when passing the data.</param>
- /// <param name="medium">When this method returns, contains a pointer to the STGMEDIUM structure that indicates the storage medium containing the returned data through its tymed member, and the responsibility for releasing the medium through the value of its pUnkForRelease member.</param>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- void System.Runtime.InteropServices.ComTypes.IDataObject.GetData(ref FORMATETC format, out STGMEDIUM medium)
- {
- medium = new STGMEDIUM();
- var hr = ((System.Runtime.InteropServices.ComTypes.IDataObject)this).QueryGetData(ref format);
- if (NativeMethods.SUCCEEDED(hr))
- {
- // Find the best match
- var formatCopy = format; // Cannot use ref or out parameter inside an anonymous method, lambda expression, or query expression
- var dataObject = _dataObjects
- .Where(d =>
- (d.FORMATETC.cfFormat == formatCopy.cfFormat) &&
- (d.FORMATETC.dwAspect == formatCopy.dwAspect) &&
- (0 != (d.FORMATETC.tymed & formatCopy.tymed) &&
- (d.FORMATETC.lindex == formatCopy.lindex)))
- .FirstOrDefault();
- if (dataObject != null)
- {
- if (!IsAsynchronous && (FILEDESCRIPTORW == dataObject.FORMATETC.cfFormat) && !_inOperation)
- {
- // Enter the operation and call the start action
- _inOperation = true;
- if (null != _startAction)
- {
- _startAction(this);
- }
- }
-
- // Populate the STGMEDIUM
- medium.tymed = dataObject.FORMATETC.tymed;
- var result = dataObject.GetData(); // Possible call to user code
- hr = result.Item2;
- if (NativeMethods.SUCCEEDED(hr))
- {
- medium.unionmember = result.Item1;
- }
- }
- else
- {
- // Couldn't find a match
- hr = NativeMethods.DV_E_FORMATETC;
- }
- }
- if (!NativeMethods.SUCCEEDED(hr)) // Not redundant; hr gets updated in the block above
- {
- Marshal.ThrowExceptionForHR(hr);
- }
- }
-
- /// <summary>
- /// Obtains data from a source data object.
- /// </summary>
- /// <param name="format">A pointer to a FORMATETC structure that defines the format, medium, and target device to use when passing the data.</param>
- /// <param name="medium">A STGMEDIUM that defines the storage medium containing the data being transferred.</param>
- void System.Runtime.InteropServices.ComTypes.IDataObject.GetDataHere(ref FORMATETC format, ref STGMEDIUM medium)
- {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Determines whether the data object is capable of rendering the data described in the FORMATETC structure.
- /// </summary>
- /// <param name="format">A pointer to a FORMATETC structure that defines the format, medium, and target device to use for the query.</param>
- /// <returns>HRESULT success code.</returns>
- int System.Runtime.InteropServices.ComTypes.IDataObject.QueryGetData(ref FORMATETC format)
- {
- var formatCopy = format; // Cannot use ref or out parameter inside an anonymous method, lambda expression, or query expression
- var formatMatches = _dataObjects.Where(d => d.FORMATETC.cfFormat == formatCopy.cfFormat);
- if (!formatMatches.Any())
- {
- return NativeMethods.DV_E_FORMATETC;
- }
- var tymedMatches = formatMatches.Where(d => 0 != (d.FORMATETC.tymed & formatCopy.tymed));
- if (!tymedMatches.Any())
- {
- return NativeMethods.DV_E_TYMED;
- }
- var aspectMatches = tymedMatches.Where(d => d.FORMATETC.dwAspect == formatCopy.dwAspect);
- if (!aspectMatches.Any())
- {
- return NativeMethods.DV_E_DVASPECT;
- }
- return NativeMethods.S_OK;
- }
-
- /// <summary>
- /// Transfers data to the object that implements this method.
- /// </summary>
- /// <param name="formatIn">A FORMATETC structure that defines the format used by the data object when interpreting the data contained in the storage medium.</param>
- /// <param name="medium">A STGMEDIUM structure that defines the storage medium in which the data is being passed.</param>
- /// <param name="release">true to specify that the data object called, which implements SetData, owns the storage medium after the call returns.</param>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- void System.Runtime.InteropServices.ComTypes.IDataObject.SetData(ref FORMATETC formatIn, ref STGMEDIUM medium, bool release)
- {
- var handled = false;
- if ((formatIn.dwAspect == DVASPECT.DVASPECT_CONTENT) &&
- (formatIn.tymed == TYMED.TYMED_HGLOBAL) &&
- (medium.tymed == formatIn.tymed))
- {
- // Supported format; capture the data
- var ptr = NativeMethods.GlobalLock(medium.unionmember);
- if (IntPtr.Zero != ptr)
- {
- try
- {
- var length = NativeMethods.GlobalSize(ptr).ToInt32();
- var data = new byte[length];
- Marshal.Copy(ptr, data, 0, length);
- // Store it in our own format
- SetData(formatIn.cfFormat, data);
- handled = true;
- }
- finally
- {
- NativeMethods.GlobalUnlock(medium.unionmember);
- }
- }
-
- // Release memory if we now own it
- if (release)
- {
- Marshal.FreeHGlobal(medium.unionmember);
- }
- }
-
- // Handle synchronous mode
- if (!IsAsynchronous && (PERFORMEDDROPEFFECT == formatIn.cfFormat) && _inOperation)
- {
- // Call the end action and exit the operation
- if (null != _endAction)
- {
- _endAction(this);
- }
- _inOperation = false;
- }
-
- // Throw if unhandled
- if (!handled)
- {
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- /// <summary>
- /// Provides data for the specified data format (HGLOBAL).
- /// </summary>
- /// <param name="dataFormat">Data format.</param>
- /// <param name="data">Sequence of data.</param>
- public void SetData(short dataFormat, IEnumerable<byte> data)
- {
- _dataObjects.Add(
- new DataObject
- {
- FORMATETC = new FORMATETC
- {
- cfFormat = dataFormat,
- ptd = IntPtr.Zero,
- dwAspect = DVASPECT.DVASPECT_CONTENT,
- lindex = -1,
- tymed = TYMED.TYMED_HGLOBAL
- },
- GetData = () =>
- {
- var dataArray = data.ToArray();
- var ptr = Marshal.AllocHGlobal(dataArray.Length);
- Marshal.Copy(dataArray, 0, ptr, dataArray.Length);
- return new Tuple<IntPtr, int>(ptr, NativeMethods.S_OK);
- },
- });
- }
-
- /// <summary>
- /// Provides data for the specified data format and index (ISTREAM).
- /// </summary>
- /// <param name="dataFormat">Data format.</param>
- /// <param name="index">Index of data.</param>
- /// <param name="streamData">Action generating the data.</param>
- /// <remarks>
- /// Uses Stream instead of IEnumerable(T) because Stream is more likely
- /// to be natural for the expected scenarios.
- /// </remarks>
- public void SetData(short dataFormat, int index, Action<Stream> streamData)
- {
- _dataObjects.Add(
- new DataObject
- {
- FORMATETC = new FORMATETC
- {
- cfFormat = dataFormat,
- ptd = IntPtr.Zero,
- dwAspect = DVASPECT.DVASPECT_CONTENT,
- lindex = index,
- tymed = TYMED.TYMED_ISTREAM
- },
- GetData = () =>
- {
- // Create IStream for data
- var ptr = IntPtr.Zero;
- var iStream = NativeMethods.CreateStreamOnHGlobal(IntPtr.Zero, true);
- if (streamData != null)
- {
- // Wrap in a .NET-friendly Stream and call provided code to fill it
- using (var stream = new IStreamWrapper(iStream))
- {
- streamData(stream);
- }
- }
- // Return an IntPtr for the IStream
- ptr = Marshal.GetComInterfaceForObject(iStream, typeof(IStream));
- Marshal.ReleaseComObject(iStream);
- return new Tuple<IntPtr, int>(ptr, NativeMethods.S_OK);
- },
- });
- }
-
- /// <summary>
- /// Provides data for the specified data format (FILEGROUPDESCRIPTOR/FILEDESCRIPTOR)
- /// </summary>
- /// <param name="fileDescriptors">Collection of virtual files.</param>
- public void SetData(IEnumerable<FileDescriptor> fileDescriptors)
- {
- // Prepare buffer
- var bytes = new List<byte>();
- // Add FILEGROUPDESCRIPTOR header
- bytes.AddRange(StructureBytes(new NativeMethods.FILEGROUPDESCRIPTOR { cItems = (uint)(fileDescriptors.Count()) }));
- // Add n FILEDESCRIPTORs
- foreach (var fileDescriptor in fileDescriptors)
- {
- // Set required fields
- var FILEDESCRIPTOR = new NativeMethods.FILEDESCRIPTOR
- {
- cFileName = fileDescriptor.Name,
- };
- // Set optional timestamp
- if (fileDescriptor.ChangeTimeUtc.HasValue)
- {
- FILEDESCRIPTOR.dwFlags |= NativeMethods.FD_CREATETIME | NativeMethods.FD_WRITESTIME;
- var changeTime = fileDescriptor.ChangeTimeUtc.Value.ToLocalTime().ToFileTime();
- var changeTimeFileTime = new System.Runtime.InteropServices.ComTypes.FILETIME
- {
- dwLowDateTime = (int)(changeTime & 0xffffffff),
- dwHighDateTime = (int)(changeTime >> 32),
- };
- FILEDESCRIPTOR.ftLastWriteTime = changeTimeFileTime;
- FILEDESCRIPTOR.ftCreationTime = changeTimeFileTime;
- }
- // Set optional length
- if (fileDescriptor.Length.HasValue)
- {
- FILEDESCRIPTOR.dwFlags |= NativeMethods.FD_FILESIZE;
- FILEDESCRIPTOR.nFileSizeLow = (uint)(fileDescriptor.Length & 0xffffffff);
- FILEDESCRIPTOR.nFileSizeHigh = (uint)(fileDescriptor.Length >> 32);
- }
- // Add structure to buffer
- bytes.AddRange(StructureBytes(FILEDESCRIPTOR));
- }
-
- // Set CFSTR_FILEDESCRIPTORW
- SetData(FILEDESCRIPTORW, bytes);
- // Set n CFSTR_FILECONTENTS
- var index = 0;
- foreach (var fileDescriptor in fileDescriptors)
- {
- SetData(FILECONTENTS, index, fileDescriptor.StreamContents);
- index++;
- }
- }
-
- /// <summary>
- /// Gets or sets the CFSTR_PASTESUCCEEDED value for the object.
- /// </summary>
- public DragDropEffects? PasteSucceeded
- {
- get { return GetDropEffect(PASTESUCCEEDED); }
- set { SetData(PASTESUCCEEDED, BitConverter.GetBytes((UInt32)value)); }
- }
-
- /// <summary>
- /// Gets or sets the CFSTR_PERFORMEDDROPEFFECT value for the object.
- /// </summary>
- public DragDropEffects? PerformedDropEffect
- {
- get { return GetDropEffect(PERFORMEDDROPEFFECT); }
- set { SetData(PERFORMEDDROPEFFECT, BitConverter.GetBytes((UInt32)value)); }
- }
-
- /// <summary>
- /// Gets or sets the CFSTR_PREFERREDDROPEFFECT value for the object.
- /// </summary>
- public DragDropEffects? PreferredDropEffect
- {
- get { return GetDropEffect(PREFERREDDROPEFFECT); }
- set { SetData(PREFERREDDROPEFFECT, BitConverter.GetBytes((UInt32)value)); }
- }
-
- /// <summary>
- /// Gets the DragDropEffects value (if any) previously set on the object.
- /// </summary>
- /// <param name="format">Clipboard format.</param>
- /// <returns>DragDropEffects value or null.</returns>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- private DragDropEffects? GetDropEffect(short format)
- {
- // Get the most recent setting
- var dataObject = _dataObjects
- .Where(d =>
- (format == d.FORMATETC.cfFormat) &&
- (DVASPECT.DVASPECT_CONTENT == d.FORMATETC.dwAspect) &&
- (TYMED.TYMED_HGLOBAL == d.FORMATETC.tymed))
- .LastOrDefault();
- if (null != dataObject)
- {
- // Read the value and return it
- var result = dataObject.GetData();
- if (NativeMethods.SUCCEEDED(result.Item2))
- {
- var ptr = NativeMethods.GlobalLock(result.Item1);
- if (IntPtr.Zero != ptr)
- {
- try
- {
- var length = NativeMethods.GlobalSize(ptr).ToInt32();
- if (4 == length)
- {
- var data = new byte[length];
- Marshal.Copy(ptr, data, 0, length);
- return (DragDropEffects)(BitConverter.ToUInt32(data, 0));
- }
- }
- finally
- {
- NativeMethods.GlobalUnlock(result.Item1);
- }
- }
- }
- }
- return null;
- }
-
- #region IAsyncOperation Members
- // Explicit interface implementation hides the technical details from users of VirtualFileDataObject.
-
- /// <summary>
- /// Called by a drop source to specify whether the data object supports asynchronous data extraction.
- /// </summary>
- /// <param name="fDoOpAsync">A Boolean value that is set to VARIANT_TRUE to indicate that an asynchronous operation is supported, or VARIANT_FALSE otherwise.</param>
- void IAsyncOperation.SetAsyncMode(int fDoOpAsync)
- {
- IsAsynchronous = !(NativeMethods.VARIANT_FALSE == fDoOpAsync);
- }
-
- /// <summary>
- /// Called by a drop target to determine whether the data object supports asynchronous data extraction.
- /// </summary>
- /// <param name="pfIsOpAsync">A Boolean value that is set to VARIANT_TRUE to indicate that an asynchronous operation is supported, or VARIANT_FALSE otherwise.</param>
- void IAsyncOperation.GetAsyncMode(out int pfIsOpAsync)
- {
- pfIsOpAsync = IsAsynchronous ? NativeMethods.VARIANT_TRUE : NativeMethods.VARIANT_FALSE;
- }
-
- /// <summary>
- /// Called by a drop target to indicate that asynchronous data extraction is starting.
- /// </summary>
- /// <param name="pbcReserved">Reserved. Set this value to NULL.</param>
- void IAsyncOperation.StartOperation(IBindCtx pbcReserved)
- {
- _inOperation = true;
- if (null != _startAction)
- {
- _startAction(this);
- }
- }
-
- /// <summary>
- /// Called by the drop source to determine whether the target is extracting data asynchronously.
- /// </summary>
- /// <param name="pfInAsyncOp">Set to VARIANT_TRUE if data extraction is being handled asynchronously, or VARIANT_FALSE otherwise.</param>
- void IAsyncOperation.InOperation(out int pfInAsyncOp)
- {
- pfInAsyncOp = _inOperation ? NativeMethods.VARIANT_TRUE : NativeMethods.VARIANT_FALSE;
- }
-
- /// <summary>
- /// Notifies the data object that that asynchronous data extraction has ended.
- /// </summary>
- /// <param name="hResult">An HRESULT value that indicates the outcome of the data extraction. Set to S_OK if successful, or a COM error code otherwise.</param>
- /// <param name="pbcReserved">Reserved. Set to NULL.</param>
- /// <param name="dwEffects">A DROPEFFECT value that indicates the result of an optimized move. This should be the same value that would be passed to the data object as a CFSTR_PERFORMEDDROPEFFECT format with a normal data extraction operation.</param>
- void IAsyncOperation.EndOperation(int hResult, IBindCtx pbcReserved, uint dwEffects)
- {
- if (null != _endAction)
- {
- _endAction(this);
- }
- _inOperation = false;
- }
-
- #endregion
-
- /// <summary>
- /// Returns the in-memory representation of an interop structure.
- /// </summary>
- /// <param name="source">Structure to return.</param>
- /// <returns>In-memory representation of structure.</returns>
- [SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Justification = "Method doesn't decrease security.")]
- private static IEnumerable<byte> StructureBytes(object source)
- {
- // Set up for call to StructureToPtr
- var size = Marshal.SizeOf(source.GetType());
- var ptr = Marshal.AllocHGlobal(size);
- var bytes = new byte[size];
- try
- {
- Marshal.StructureToPtr(source, ptr, false);
- // Copy marshalled bytes to buffer
- Marshal.Copy(ptr, bytes, 0, size);
- }
- finally
- {
- Marshal.FreeHGlobal(ptr);
- }
- return bytes;
- }
-
- /// <summary>
- /// Class representing a virtual file for use by drag/drop or the clipboard.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "Deliberate to provide obvious coupling.")]
- public class FileDescriptor
- {
- /// <summary>
- /// Gets or sets the name of the file.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the (optional) length of the file.
- /// </summary>
- public Int64? Length { get; set; }
-
- /// <summary>
- /// Gets or sets the (optional) change time of the file.
- /// </summary>
- public DateTime? ChangeTimeUtc { get; set; }
-
- /// <summary>
- /// Gets or sets an Action that returns the contents of the file.
- /// </summary>
- public Action<Stream> StreamContents { get; set; }
- }
-
- /// <summary>
- /// Class representing the result of a SetData call.
- /// </summary>
- private class DataObject
- {
- /// <summary>
- /// FORMATETC structure for the data.
- /// </summary>
- public FORMATETC FORMATETC { get; set; }
-
- /// <summary>
- /// Func returning the data as an IntPtr and an HRESULT success code.
- /// </summary>
- public Func<Tuple<IntPtr, int>> GetData { get; set; }
- }
-
- /// <summary>
- /// Represents a 2-tuple, or pair.
- /// </summary>
- /// <remarks>
- /// Minimal implementation of the .NET 4 Tuple class; remove if running on .NET 4.
- /// </remarks>
- /// <typeparam name="T1">The type of the tuple's first component.</typeparam>
- /// <typeparam name="T2">The type of the tuple's second component.</typeparam>
- private class Tuple<T1, T2>
- {
- /// <summary>
- /// Gets the value of the current Tuple(T1, T2) object's first component.
- /// </summary>
- public T1 Item1 { get; private set; }
-
- /// <summary>
- /// Gets the value of the current Tuple(T1, T2) object's second component.
- /// </summary>
- public T2 Item2 { get; private set; }
-
- /// <summary>
- /// Initializes a new instance of the Tuple(T1, T2) class.
- /// </summary>
- /// <param name="item1">The value of the tuple's first component.</param>
- /// <param name="item2">The value of the tuple's second component.</param>
- public Tuple(T1 item1, T2 item2)
- {
- Item1 = item1;
- Item2 = item2;
- }
- }
-
- /// <summary>
- /// Simple class that exposes a write-only IStream as a Stream.
- /// </summary>
- private class IStreamWrapper : Stream
- {
- /// <summary>
- /// IStream instance being wrapped.
- /// </summary>
- private IStream _iStream;
-
- /// <summary>
- /// Initializes a new instance of the IStreamWrapper class.
- /// </summary>
- /// <param name="iStream">IStream instance to wrap.</param>
- public IStreamWrapper(IStream iStream)
- {
- _iStream = iStream;
- }
-
- /// <summary>
- /// Gets a value indicating whether the current stream supports reading.
- /// </summary>
- public override bool CanRead
- {
- get { return false; }
- }
-
- /// <summary>
- /// Gets a value indicating whether the current stream supports seeking.
- /// </summary>
- public override bool CanSeek
- {
- get { return false; }
- }
-
- /// <summary>
- /// Gets a value indicating whether the current stream supports writing.
- /// </summary>
- public override bool CanWrite
- {
- get { return true; }
- }
-
- /// <summary>
- /// Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
- /// </summary>
- public override void Flush()
- {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets the length in bytes of the stream.
- /// </summary>
- public override long Length
- {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets or sets the position within the current stream.
- /// </summary>
- public override long Position
- {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
- /// </summary>
- /// <param name="buffer">An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.</param>
- /// <param name="offset">The zero-based byte offset in buffer at which to begin storing the data read from the current stream.</param>
- /// <param name="count">The maximum number of bytes to be read from the current stream.</param>
- /// <returns>The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.</returns>
- public override int Read(byte[] buffer, int offset, int count)
- {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Sets the position within the current stream.
- /// </summary>
- /// <param name="offset">A byte offset relative to the origin parameter.</param>
- /// <param name="origin">A value of type SeekOrigin indicating the reference point used to obtain the new position.</param>
- /// <returns>The new position within the current stream.</returns>
- public override long Seek(long offset, SeekOrigin origin)
- {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Sets the length of the current stream.
- /// </summary>
- /// <param name="value">The desired length of the current stream in bytes.</param>
- public override void SetLength(long value)
- {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
- /// </summary>
- /// <param name="buffer">An array of bytes. This method copies count bytes from buffer to the current stream.</param>
- /// <param name="offset">The zero-based byte offset in buffer at which to begin copying bytes to the current stream.</param>
- /// <param name="count">The number of bytes to be written to the current stream.</param>
- public override void Write(byte[] buffer, int offset, int count)
- {
- if (offset == 0)
- {
- // Optimize common case to avoid creating extra buffers
- _iStream.Write(buffer, count, IntPtr.Zero);
- }
- else
- {
- // Easy way to provide the relevant byte[]
- _iStream.Write(buffer.Skip(offset).ToArray(), count, IntPtr.Zero);
- }
- }
- }
-
- /// <summary>
- /// Initiates a drag-and-drop operation.
- /// </summary>
- /// <param name="dragSource">A reference to the dependency object that is the source of the data being dragged.</param>
- /// <param name="dataObject">A data object that contains the data being dragged.</param>
- /// <param name="allowedEffects">One of the DragDropEffects values that specifies permitted effects of the drag-and-drop operation.</param>
- /// <returns>One of the DragDropEffects values that specifies the final effect that was performed during the drag-and-drop operation.</returns>
- /// <remarks>
- /// Call this method instead of System.Windows.DragDrop.DoDragDrop because this method handles IDataObject better.
- /// </remarks>
- [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "dragSource", Justification = "Parameter is present so the signature matches that of System.Windows.DragDrop.DoDragDrop.")]
- public static DragDropEffects DoDragDrop(DependencyObject dragSource, System.Runtime.InteropServices.ComTypes.IDataObject dataObject, DragDropEffects allowedEffects)
- {
- int[] finalEffect = new int[1];
- try
- {
- NativeMethods.DoDragDrop(dataObject, new DropSource(), (int)allowedEffects, finalEffect);
- }
- finally
- {
- var virtualFileDataObject = dataObject as VirtualFileDataObject;
- if ((null != virtualFileDataObject) && !virtualFileDataObject.IsAsynchronous && virtualFileDataObject._inOperation)
- {
- // Call the end action and exit the operation
- if (null != virtualFileDataObject._endAction)
- {
- virtualFileDataObject._endAction(virtualFileDataObject);
- }
- virtualFileDataObject._inOperation = false;
- }
- }
- return (DragDropEffects)(finalEffect[0]);
- }
-
- /// <summary>
- /// Contains the methods for generating visual feedback to the end user and for canceling or completing the drag-and-drop operation.
- /// </summary>
- private class DropSource : NativeMethods.IDropSource
- {
- /// <summary>
- /// Determines whether a drag-and-drop operation should continue.
- /// </summary>
- /// <param name="fEscapePressed">Indicates whether the Esc key has been pressed since the previous call to QueryContinueDrag or to DoDragDrop if this is the first call to QueryContinueDrag. A TRUE value indicates the end user has pressed the escape key; a FALSE value indicates it has not been pressed.</param>
- /// <param name="grfKeyState">The current state of the keyboard modifier keys on the keyboard. Possible values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON.</param>
- /// <returns>This method returns S_OK/DRAGDROP_S_DROP/DRAGDROP_S_CANCEL on success.</returns>
- public int QueryContinueDrag(int fEscapePressed, uint grfKeyState)
- {
- var escapePressed = (0 != fEscapePressed);
- var keyStates = (DragDropKeyStates)grfKeyState;
- if (escapePressed)
- {
- return NativeMethods.DRAGDROP_S_CANCEL;
- }
- else if (DragDropKeyStates.None == (keyStates & DragDropKeyStates.LeftMouseButton))
- {
- return NativeMethods.DRAGDROP_S_DROP;
- }
- return NativeMethods.S_OK;
- }
-
- /// <summary>
- /// Gives visual feedback to an end user during a drag-and-drop operation.
- /// </summary>
- /// <param name="dwEffect">The DROPEFFECT value returned by the most recent call to IDropTarget::DragEnter, IDropTarget::DragOver, or IDropTarget::DragLeave. </param>
- /// <returns>This method returns S_OK on success.</returns>
- public int GiveFeedback(uint dwEffect)
- {
- return NativeMethods.DRAGDROP_S_USEDEFAULTCURSORS;
- }
- }
-
- /// <summary>
- /// Provides access to Win32-level constants, structures, and functions.
- /// </summary>
- private static class NativeMethods
- {
- public const int DRAGDROP_S_DROP = 0x00040100;
- public const int DRAGDROP_S_CANCEL = 0x00040101;
- public const int DRAGDROP_S_USEDEFAULTCURSORS = 0x00040102;
- public const int DV_E_DVASPECT = -2147221397;
- public const int DV_E_FORMATETC = -2147221404;
- public const int DV_E_TYMED = -2147221399;
- public const int E_FAIL = -2147467259;
- public const uint FD_CREATETIME = 0x00000008;
- public const uint FD_WRITESTIME = 0x00000020;
- public const uint FD_FILESIZE = 0x00000040;
- public const int OLE_E_ADVISENOTSUPPORTED = -2147221501;
- public const int S_OK = 0;
- public const int S_FALSE = 1;
- public const int VARIANT_FALSE = 0;
- public const int VARIANT_TRUE = -1;
-
- public const string CFSTR_FILECONTENTS = "FileContents";
- public const string CFSTR_FILEDESCRIPTORW = "FileGroupDescriptorW";
- public const string CFSTR_PASTESUCCEEDED = "Paste Succeeded";
- public const string CFSTR_PERFORMEDDROPEFFECT = "Performed DropEffect";
- public const string CFSTR_PREFERREDDROPEFFECT = "Preferred DropEffect";
-
- [SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "Structure exists for interop.")]
- [StructLayout(LayoutKind.Sequential)]
- public struct FILEGROUPDESCRIPTOR
- {
- public UInt32 cItems;
- // Followed by 0 or more FILEDESCRIPTORs
- }
-
- [SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "Structure exists for interop.")]
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct FILEDESCRIPTOR
- {
- public UInt32 dwFlags;
- public Guid clsid;
- public Int32 sizelcx;
- public Int32 sizelcy;
- public Int32 pointlx;
- public Int32 pointly;
- public UInt32 dwFileAttributes;
- public System.Runtime.InteropServices.ComTypes.FILETIME ftCreationTime;
- public System.Runtime.InteropServices.ComTypes.FILETIME ftLastAccessTime;
- public System.Runtime.InteropServices.ComTypes.FILETIME ftLastWriteTime;
- public UInt32 nFileSizeHigh;
- public UInt32 nFileSizeLow;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
- public string cFileName;
- }
-
- [ComImport]
- [Guid("00000121-0000-0000-C000-000000000046")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- public interface IDropSource
- {
- [PreserveSig]
- int QueryContinueDrag(int fEscapePressed, uint grfKeyState);
- [PreserveSig]
- int GiveFeedback(uint dwEffect);
- }
-
- [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "2#", Justification = "Win32 API.")]
- [DllImport("shell32.dll")]
- public static extern int SHCreateStdEnumFmtEtc(uint cfmt, FORMATETC[] afmt, out IEnumFORMATETC ppenumFormatEtc);
-
- [return: MarshalAs(UnmanagedType.Interface)]
- [DllImport("ole32.dll", PreserveSig = false)]
- public static extern IStream CreateStreamOnHGlobal(IntPtr hGlobal, [MarshalAs(UnmanagedType.Bool)] bool fDeleteOnRelease);
-
- [DllImport("ole32.dll", CharSet = CharSet.Auto, ExactSpelling = true, PreserveSig = false)]
- public static extern void DoDragDrop(System.Runtime.InteropServices.ComTypes.IDataObject dataObject, IDropSource dropSource, int allowedEffects, int[] finalEffect);
-
- [DllImport("kernel32.dll")]
- public static extern IntPtr GlobalLock(IntPtr hMem);
-
- [return: MarshalAs(UnmanagedType.Bool)]
- [DllImport("kernel32.dll")]
- public static extern bool GlobalUnlock(IntPtr hMem);
-
- [DllImport("kernel32.dll")]
- public static extern IntPtr GlobalSize(IntPtr handle);
-
- /// <summary>
- /// Returns true iff the HRESULT is a success code.
- /// </summary>
- /// <param name="hr">HRESULT to check.</param>
- /// <returns>True iff a success code.</returns>
- public static bool SUCCEEDED(int hr)
- {
- return (0 <= hr);
- }
- }
- }
-
- /// <summary>
- /// Definition of the IAsyncOperation COM interface.
- /// </summary>
- /// <remarks>
- /// Pseudo-public because VirtualFileDataObject implements it.
- /// </remarks>
- [ComImport]
- [Guid("3D8B0590-F691-11d2-8EA9-006097DF5BD4")]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- internal interface IAsyncOperation
- {
- void SetAsyncMode([In] Int32 fDoOpAsync);
- void GetAsyncMode([Out] out Int32 pfIsOpAsync);
- void StartOperation([In] IBindCtx pbcReserved);
- void InOperation([Out] out Int32 pfInAsyncOp);
- void EndOperation([In] Int32 hResult, [In] IBindCtx pbcReserved, [In] UInt32 dwEffects);
- }
-}