Exemplo n.º 1
0
        static List <WorkspaceTreeNode> GetLockableCandidates(
            List <WorkspaceTreeNode> candidates,
            LockRule lockRule)
        {
            List <WorkspaceTreeNode> result = new List <WorkspaceTreeNode>();

            LockedFilesFilter filter = new LockedFilesFilter(lockRule.Rules);

            foreach (WorkspaceTreeNode candidate in candidates)
            {
                string cmPath = WorkspaceNodeOperations.GetCmPath(candidate);

                if (cmPath == null)
                {
                    //The node could not be on the head tree (like copied items) so when we
                    //cannot calculate the path we assume that it's lockable.
                    result.Add(candidate);
                    continue;
                }

                if (filter.IsLockable(cmPath))
                {
                    result.Add(candidate);
                }
            }

            return(result);
        }
Exemplo n.º 2
0
            internal static Dictionary <string, LockStatusData> ForLocks(
                string wkPath,
                Dictionary <WorkspaceTreeNode, LockInfo> lockInfoByNode)
            {
                Dictionary <string, LockStatusData> result =
                    BuildPathDictionary.ForPlatform <LockStatusData>();

                LockOwnerNameResolver nameResolver = new LockOwnerNameResolver();

                foreach (WorkspaceTreeNode node in lockInfoByNode.Keys)
                {
                    LockStatusData lockStatusData = BuildLockStatusData(
                        node, lockInfoByNode[node], nameResolver);

                    string nodeWkPath = WorkspacePath.GetWorkspacePathFromCmPath(
                        wkPath,
                        WorkspaceNodeOperations.GetCmPath(node),
                        PathHelper.GetDirectorySeparatorChar(wkPath));

                    result.Add(nodeWkPath, lockStatusData);
                }

                return(result);
            }