Beispiel #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));
                        }));
                    }
                }
            }
        }
Beispiel #2
0
        protected List <string> GetDirectoriesNames(string path)
        {
            //Process directories
            string[] sourceSubdirectoryEntries = m_IStorage.GetDirectories(path);

            var sourceSubdirectoryEntriesList = new List <string>();

            foreach (var entry in sourceSubdirectoryEntries)
            {
                string         newPath = m_IStorage.Combine(path, entry);
                FileAttributes attr    = m_IStorage.GetFileAttributes(newPath);
                if (((attr & FileAttributes.System) != FileAttributes.System) &&
                    ((attr & FileAttributes.Hidden) != FileAttributes.Hidden))
                {
                    sourceSubdirectoryEntriesList.Add(m_IStorage.GetFileName(entry));
                }
            }

            return(sourceSubdirectoryEntriesList);
        }