Пример #1
0
        void AddFoldersToFolderMenuItem(FolderMenuItem item, string overridePath = null, BackupSessionHistory history = null)
        {
            var path = overridePath == null ? item.Path : overridePath;

            if (!m_IStorage.DirectoryExists(path))
            {
                return;
            }

            var subdirectoryList = m_IStorage.GetDirectoriesNames(path);

            foreach (string subdirectory in subdirectoryList)
            {
                string         newPath = m_IStorage.Combine(path, subdirectory);
                FileAttributes attr    = m_IStorage.GetFileAttributes(newPath);
                if (!IsHidden(attr) && !IsNameExistsInNameList(subdirectory, item.ChildFolderMenuItems))
                {
                    HistoryTypeEnum?historyType = GetFolderHistoryType(m_IStorage.Combine(item.RelativePath, subdirectory));
                    //if (history == null)// || history.SessionHistoryIndex == 1 || historyType == HistoryTypeEnum.Deleted)
                    {
                        bool bSelected = item.Selected == true;

                        var rp = m_IStorage.Combine(item.RelativePath, subdirectory);
                        Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            item.ChildFolderMenuItems.Add(CreateMenuItem(m_IStorage.IsFolder(newPath), bSelected, newPath, rp, subdirectory, item, attr, historyType));
                        }));
                    }
                }
            }
        }
Пример #2
0
        protected bool MoveDirectory(string sourcePath, string targetPath, bool bCreateFolder = false)
        {
            if (m_Profile.IsDetaledLog)
            {
                m_Logger.Writeln($"Move Directory {sourcePath} To {targetPath}");
            }
            else
            {
                m_Logger.Writeln($"Move Directory {sourcePath}");
            }

            var parentDir = m_IStorage.GetDirectoryName(targetPath);

            if (!m_IStorage.DirectoryExists(parentDir))
            {
                CreateDirectory(parentDir);
            }

            return(m_IStorage.MoveDirectory(sourcePath, targetPath, bCreateFolder));
        }