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); }
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); }