コード例 #1
0
        public static bool DeleteDirectory(string fullPath, bool recursive)
        {
            if (recursive)
            {
                bool allOk = true;
                foreach (SccFileSystemNode n in SccFileSystemNode.GetDirectoryNodes(fullPath))
                {
                    if (n.IsDirectory)
                    {
                        if (!DeleteDirectory(n.FullPath, true))
                        {
                            allOk = false;
                        }
                    }
                    else if (!DeleteFile(n.FullPath))
                    {
                        allOk = false;
                    }
                }
                if (!allOk)
                {
                    return(false);
                }
            }

            return(DeleteDirectory(fullPath));
        }
コード例 #2
0
        public void Refresh()
        {
            StateImageIndex = (int)AnkhGlyph.None;

            if (SvnItem == null)
            {
                return;
            }

            if (SvnItem.IsDirectory)
            {
                bool canRead;

                foreach (SccFileSystemNode node in SccFileSystemNode.GetDirectoryNodes(SvnItem.FullPath, out canRead))
                {
                    canRead = true;
                    break;
                }

                if (!canRead)
                {
                    return;
                }
            }

            StateImageIndex = (int)TreeView.StatusMapper.GetStatusImageForSvnItem(SvnItem);
        }
コード例 #3
0
ファイル: WCDirectoryNode.cs プロジェクト: windygu/AnkhSVN
        public override IEnumerable <WCTreeNode> GetChildren()
        {
            foreach (SccFileSystemNode node in SccFileSystemNode.GetDirectoryNodes(SvnItem.FullPath))
            {
                if (node.IsHiddenOrSystem)
                {
                    continue;
                }

                if ((node.Attributes & FileAttributes.Offline) != 0)
                {
                    continue;
                }

                if (node.IsDirectory)
                {
                    yield return(new WCDirectoryNode(Context, this, StatusCache[node.FullPath]));
                }
                else
                {
                    yield return(new WCFileNode(Context, this, StatusCache[node.FullPath]));
                }
            }
        }
コード例 #4
0
        private void StatDirectory(string walkPath, SvnDirectory directory, bool noWcAtAll)
        {
            // Note: There is a lock(_lock) around this in our caller

            bool canRead;
            var  adminName   = SvnClient.AdministrativeDirectoryName;
            var  noSccStatus = noWcAtAll ? NoSccStatus.NotVersionable : NoSccStatus.NotVersioned;

            foreach (var node in SccFileSystemNode.GetDirectoryNodes(walkPath, out canRead))
            {
                if (string.Equals(node.Name, adminName, StringComparison.OrdinalIgnoreCase) || node.IsHiddenOrSystem)
                {
                    continue;
                }

                SvnItem item;
                if (node.IsFile)
                {
                    if (!Map.TryGetValue(node.FullPath, out item))
                    {
                        StoreItem(CreateItem(node.FullPath, noSccStatus, SvnNodeKind.File));
                    }
                    else
                    {
                        ISvnItemUpdate updateItem = item;
                        if (updateItem.ShouldRefresh())
                        {
                            updateItem.RefreshTo(noSccStatus, SvnNodeKind.File);
                        }
                    }
                }
                else
                {
                    if (!Map.TryGetValue(node.FullPath, out item))
                    {
                        StoreItem(CreateItem(node.FullPath, noSccStatus, SvnNodeKind.Directory));
                    }
                    // Don't clear state of a possible working copy
                }
            }

            if (canRead) // The directory exists
            {
                SvnItem item;

                if (!Map.TryGetValue(walkPath, out item))
                {
                    StoreItem(CreateItem(walkPath, NoSccStatus.NotVersioned, SvnNodeKind.Directory));
                    // Mark it as existing if we are sure
                }
                else
                {
                    ISvnItemUpdate updateItem = item;
                    if (updateItem.ShouldRefresh())
                    {
                        updateItem.RefreshTo(NoSccStatus.NotVersioned, SvnNodeKind.Directory);
                    }
                }
            }

            // Note: There is a lock(_lock) around this in our caller
        }