コード例 #1
0
        internal SelectedChangesGroupInfo GetSelectedChangesGroupInfo()
        {
            SelectedChangesGroupInfo result = new SelectedChangesGroupInfo();

            IList <int> selectedIds = GetSelection();

            if (selectedIds.Count == 0)
            {
                return(result);
            }

            foreach (KeyValuePair <PendingChangeInfo, int> item
                     in mTreeViewItemIds.GetInfoItems())
            {
                if (!selectedIds.Contains(item.Value))
                {
                    continue;
                }

                ChangeInfo changeInfo = item.Key.ChangeInfo;

                result.SelectedCount++;
                result.IsAnyDirectorySelected   |= changeInfo.IsDirectory;
                result.IsAnyPrivateSelected     |= !ChangeInfoType.IsControlled(changeInfo);
                result.IsAnyControlledSelected  |= ChangeInfoType.IsControlled(changeInfo);
                result.IsAnyLocalChangeSelected |= ChangeInfoType.IsLocalChange(changeInfo);

                result.FilterInfo.IsAnyIgnoredSelected       |= ChangeInfoType.IsIgnored(changeInfo);
                result.FilterInfo.IsAnyHiddenChangedSelected |= ChangeInfoType.IsHiddenChanged(changeInfo);

                string wkRelativePath = InternalNames.RootDir +
                                        WorkspacePath.GetWorkspaceRelativePath(
                    mWkInfo.ClientPath, changeInfo.GetFullPath());

                if (result.SelectedCount == 1)
                {
                    result.FilterInfo.CommonName      = Path.GetFileName(changeInfo.GetFullPath());
                    result.FilterInfo.CommonExtension = changeInfo.GetExtension();
                    result.FilterInfo.CommonFullPath  = wkRelativePath;
                    continue;
                }

                if (result.FilterInfo.CommonName != Path.GetFileName(changeInfo.GetFullPath()))
                {
                    result.FilterInfo.CommonName = null;
                }

                if (result.FilterInfo.CommonExtension != changeInfo.GetExtension())
                {
                    result.FilterInfo.CommonExtension = null;
                }

                if (result.FilterInfo.CommonFullPath != wkRelativePath)
                {
                    result.FilterInfo.CommonFullPath = null;
                }
            }

            return(result);
        }
コード例 #2
0
        internal bool GetSelectedPathsToDelete(
            out List <string> privateDirectories,
            out List <string> privateFiles)
        {
            privateDirectories = new List <string>();
            privateFiles       = new List <string>();

            List <ChangeInfo> dirChanges  = new List <ChangeInfo>();
            List <ChangeInfo> fileChanges = new List <ChangeInfo>();

            IList <int> selectedIds = GetSelection();

            if (selectedIds.Count == 0)
            {
                return(false);
            }

            foreach (KeyValuePair <PendingChangeInfo, int> item
                     in mTreeViewItemIds.GetInfoItems())
            {
                if (!selectedIds.Contains(item.Value))
                {
                    continue;
                }

                ChangeInfo changeInfo = item.Key.ChangeInfo;

                if (ChangeInfoType.IsControlled(changeInfo))
                {
                    continue;
                }

                if (changeInfo.IsDirectory)
                {
                    dirChanges.Add(changeInfo);
                    continue;
                }

                fileChanges.Add(changeInfo);
            }

            mPendingChangesTree.FillWithMeta(fileChanges);
            mPendingChangesTree.FillWithMeta(dirChanges);

            privateDirectories = dirChanges.Select(
                d => d.GetFullPath()).ToList();
            privateFiles = fileChanges.Select(
                f => f.GetFullPath()).ToList();

            return(true);
        }