public DirectorySynchronizeOperation(DirectorySynchronizeResult syncRes, IDirectoryViewItem[] items, FileSystemBase leftSystem, FileSystemBase rightSystem) : base(items, leftSystem)
 {
     SyncResult    = syncRes;
     LeftSystem    = leftSystem;
     RightSystem   = rightSystem;
     OperationName = "Synchronizacja katalogów";
 }
Пример #2
0
        public void ChangeFileSystem(FileSystemBase fileSystem)
        {
            fileSystem1 = fileSystem.GetCopy();
            fileSystem2 = fileSystem;
            fileSystem3 = fileSystem.GetCopy();

            //set up binding for second column
            Binding bind2 = new Binding("Items");//bind to  ListBox

            bind2.Source = FileSystem;
            lbContent2.SetBinding(ListBox.ItemsSourceProperty, bind2);

            //loading files into first column
            lbContent1.ItemsSource = null;//clear items
            if (!FileSystem.IsRootPath(FileSystem.CurrentPlace.FullName))
            {
                fileSystem1.LoadDirectory(PathExt.GetDirectoryName(FileSystem.CurrentPlace.FullName, FileSystem.IsWindowsFileSystem));
                lbContent1.ItemsSource = fileSystem1.Items;
            }

            //third column is loaded by selecting items in second

            //save in history
            HistoryGlobal.AddItem(FileSystem.CurrentPlace);
            history.AddItem(FileSystem.CurrentPlace, false);

            dirChanged = true;
            //SetFocusOnContent();
            OnPropertyChanged("FileSystem");
        }
Пример #3
0
 public void ChangeFileSystem(FileSystemBase fileSystem)
 {
     DisableSearch();
     FileSystem.Dispose();
     FileSystem = fileSystem;
     LoadDirectory(FileSystem.CurrentPlace.FullName);
 }
Пример #4
0
 public MoveOperation(IDirectoryViewItem[] items, string destPath, FileSystemBase sourceFileSystem, FileSystemBase destFileSystem)
     : base(items, sourceFileSystem)
 {
     DestinationPath = destPath;
     DestFileSystem  = destFileSystem;
     ProcessedItems  = new List <IDirectoryViewItem>(items.Length);
     SizeInBytes     = ItemsSize.ToBytes();
 }
Пример #5
0
        public StoreBase(
            FileSystemBase fileSystem,
            Type entityType)
        {
            _entityType = entityType;

            _asyncFileSystem = fileSystem as IAsyncFileSystem;
            _fileSystem      = fileSystem as IFileSystem;
        }
        public int ExceptionHandler(Exception ex)
        {
            var HResult = ex.HResult;

            if (0x80070000 == (HResult & 0xFFFF0000))
            {
                return(FileSystemBase.NtStatusFromWin32((uint)HResult & 0xFFFF));
            }
            return(FileSystemBase.STATUS_SUCCESS);
        }
Пример #7
0
        public BsonStore(
            FileSystemBase fileSystem,
            Type entityType)
            : base(fileSystem, entityType)
        {
            _lock       = new ReaderWriterLockSlim();
            _serializer = JsonSerializer.CreateDefault();

            _path = FileSystemPath.Root.AppendDirectory(EntityType.ToFriendlyName());
        }
Пример #8
0
 public RenameOperation(IDirectoryViewItem objectToRename, string newName, FileSystemBase fileSystem)
     : base(fileSystem)
 {
     ObjectToRename = objectToRename;
     OldName        = ObjectToRename.Name;
     OldPath        = ObjectToRename.FullName;
     NewName        = newName;
     NewPath        = PathExt.Combine(PathExt.GetDirectoryName(ObjectToRename.FullName, ObjectToRename.IsWindowsFile), NewName, ObjectToRename.IsWindowsFile);
     OperationName  = "Zmiana nazwy z " + OldName + " na " + NewName;
 }
Пример #9
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="items">Items to work on</param>
        public MultiFileOperation(IDirectoryViewItem[] items, FileSystemBase fileSystem) : base(fileSystem)
        {
            //TODO: Files in folders should be diffirent objects
            ItemsSize = FileSize.Empty;

            System.Diagnostics.Debug.Assert(items.Length > 0, "Empty operation!");
            Items = items;
            //CurrentItem = items[0];

            CountSize();
        }
Пример #10
0
        void DisplayPartitionStatus(FileSystemBase partition)
        {
            var bs    = partition.BootSector;
            var fsstr = string.Format("File System: {0}  |  {1}", (FsTypesMbr)bs.MbrPartitionTable.First().FileSystemMbr, bs.FsType);
            var psize = string.Format("Partition Size: {0}", bs.PartitionSizeString);

            Invoke(new MethodInvoker(() =>
            {
                toolStripStatusFSType.Text = fsstr;
                toolStripStatusSize.Text   = psize;
            }));
        }
Пример #11
0
        public ThreeColumnView()
        {
            InitializeComponent();
            fileSystem1 = new WindowsFileSystem();
            fileSystem2 = new WindowsFileSystem();
            fileSystem3 = new WindowsFileSystem();
            history     = new History <IDirectoryViewItem>();

            Binding bind2 = new Binding("Items");//bind to second(middle) ListBox

            bind2.Source = FileSystem;
            lbContent2.SetBinding(ListBox.ItemsSourceProperty, bind2);

            lbContent2.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged);
        }
Пример #12
0
        // <Key, Tuple<Entity, Metadata>>

        public JsonStore(
            FileSystemBase fileSystem,
            Type entityType
            )
            : base(fileSystem, entityType)
        {
            _entities       = new Dictionary <object, Tuple <object, MetadataEntity> >();
            _listSerializer = new SimpleListSerializer();
            _serializer     = JsonSerializer.CreateDefault();
            _lock           = new ReaderWriterLockSlim();
            _initialized    = false;

            _path = FileSystemPath.Root.AppendFile(
                String.Format(FileFormatString, EntityType.ToFriendlyName()));
        }
Пример #13
0
        public void ApplyLoadedData()
        {
            SerializationData           data = SerializationHelper.GetData(SerializationKey);
            Dictionary <string, object> dict = data.Data;
            int count = (int)dict["Count"];

            for (int i = 0; i < count; i++)
            {
                Type           viewType = (Type)dict[i + "Type"];
                IDirectoryView view     = (IDirectoryView)Activator.CreateInstance(viewType);

                FileSystemBase fileSystem = (FileSystemBase)dict[i + "FileSystem"];

                //AddNewTab(view, fileSystem);
            }

            tcViews.SelectedIndex = (int)dict["ActiveView"];
        }
Пример #14
0
        private void ToolStripButtonDiskList_Click(object sender, EventArgs e)
        {
            try
            {
                var disklist  = GetPhysicalDiskList();
                var drivelist = DriveInfo.GetDrives();

                var tableview = new TableViwForm();
                tableview.Tittle = "Physical Disk and Drive List";
                tableview.ColumnHeaders.Add(new ColumnHeader("Name", 150));
                tableview.ColumnHeaders.Add(new ColumnHeader("Capacity", 100));
                tableview.ColumnHeaders.Add(new ColumnHeader("Description", 200));
                tableview.ColumnHeaders.Add(new ColumnHeader("Model", 300));
                foreach (var item in disklist)
                {
                    var sizestr  = FileSystemBase.GetFormatedSizeString(long.Parse(item.TotalSize));
                    var descstr  = string.Format("{0}, {1}, {2}", item.InterfaceType, item.Description, item.MediaType);
                    var modelstr = string.Format("{0}, {1}", item.Model, item.SerialNumber);
                    tableview.DataRows.Add(new[] { item.FileName, sizestr, descstr, modelstr });
                }
                foreach (var item in drivelist)
                {
                    if (!item.IsReady)
                    {
                        continue;
                    }
                    var namestr = @"\\.\" + item.Name.Substring(0, 2);
                    var sizestr = FileSystemBase.GetFormatedSizeString(item.TotalSize);
                    var descstr = string.Format("{0}, {1}, {2}", item.VolumeLabel, item.DriveFormat, item.DriveType);
                    tableview.DataRows.Add(new[] { namestr, sizestr, descstr });
                }
                tableview.ShowDialog();
                var idx = tableview.SelectedIndex;
                if (idx >= 0)
                {
                    ReloadDiskNames();
                    comboBoxStorageName.SelectedIndex = idx;
                }
            }
            catch (Exception ex)
            {
                PopupException(ex.Message);
            }
        }
 private void CommenceCopy(string destPath, FileSystemBase sourceFS, FileSystemBase destFS)
 {
     if (IsWindowsCopy())
     {
         ((WindowsFile)CurrentItem).SimpleCopyTo(destPath);
     }
     else if (sourceFS.IsWindowsFileSystem && !destFS.IsWindowsFileSystem)
     {
         ((FTPFileSystem)destFS).Upload((WindowsFile)CurrentItem);
     }
     else if (!sourceFS.IsWindowsFileSystem && destFS.IsWindowsFileSystem)
     {
         ((FTPFileSystem)sourceFS).Download((FTPFile)CurrentItem, destPath);
     }
     else
     {
         System.Diagnostics.Debug.Assert(true, "Not supported copy");
     }
 }
Пример #16
0
        private void AddNewTab(IDirectoryView view, FileSystemBase fileSystem)
        {
            //create new TabItem & apply style
            TabItem ti = new TabItem();

            ti.Style = (Style)Resources["CloseableTabItem"];

            UserControl viewCtrl = (UserControl)view;

            viewCtrl.Height              = double.NaN;//same as Auto in XAML
            viewCtrl.VerticalAlignment   = VerticalAlignment.Stretch;
            viewCtrl.Width               = double.NaN;
            viewCtrl.HorizontalAlignment = HorizontalAlignment.Stretch;

            //events
            view.ItemExecuted += ActiveView_ItemExecuted;

            //set file system
            if (fileSystem != null)
            {
                view.ChangeFileSystem(fileSystem);
            }

            //set content listview as content of tabitem
            ti.Content = view;

            //add tabitem to tabcontrol
            tcViews.Items.Insert(tcViews.Items.Count - 1, ti);
            tcViews.SelectedIndex = tcViews.Items.Count - 2;//QSTN: Why new tab must be selected, to gain header?

            //bind header
            Binding bind = new Binding("FileSystem.DirectoryName");

            bind.Source = view;
            ti.SetBinding(TabItem.HeaderProperty, bind);
        }
Пример #17
0
 public VolumeManager(FileSystemBase pFileSystem, string pSource)
 {
     Host   = new FileSystemHostWrapper(new FileSystemHost(pFileSystem));
     Source = pSource;
 }
Пример #18
0
 public NewFolderOperation(string folderPath, FileSystemBase fileSystem)
     : base(fileSystem)
 {
     FolderPath    = folderPath;
     OperationName = "Tworzenie folderu " + Path.GetFileName(FolderPath);
 }
Пример #19
0
 //OPT: Make this ctor in more elegant way
 public MultiRenameOperation(IEnumerable <MultiRenameItem> mrItems, IDirectoryViewItem[] dvItems, FileSystemBase fileSystem)
     : base(dvItems, fileSystem)
 {
     MRItems       = mrItems;
     OperationName = string.Format("Zmiana nazwy {0} obiektów", mrItems.Count());
 }
Пример #20
0
 public static void ThrowIoExceptionWithNtStatus(Int32 Status)
 {
     ThrowIoExceptionWithWin32((Int32)FileSystemBase.Win32FromNtStatus(Status));
 }
Пример #21
0
 public DeleteOperation(FileSystemBase fileSystem, IDirectoryViewItem[] items)
     : base(items, fileSystem)
 {
 }
Пример #22
0
 public void ChangeFileSystem(FileSystemBase fileSystem)
 {
     DisableSimpleSearch();
     ActiveView.ChangeFileSystem(fileSystem);
 }
Пример #23
0
 /// <summary>
 /// Ctor
 /// </summary>
 public OperationBase(FileSystemBase fileSystem)
 {
     IsCanceled = false;
     IsFinished = false;
     FileSystem = fileSystem;
 }
Пример #24
0
 public static IOException GetIOException(INTException ex)
 {
     return(GetIOExceptionWithWin32((int)FileSystemBase.Win32FromNtStatus(ex.GetCode())));
 }