2013-05-22 66 views
0

如何獲取存儲庫中的文件數量? 我試過這個C#代碼來獲得存儲庫的樹:獲取存儲庫中的文件數

private TreeNode GetRepoTreeNodes(string currentrepourl, string currentnodepath, ref SvnClient sc) 
     { 
      List<TreeNode> tnkids = new List<TreeNode>(); 

      //using (SvnClient sc = new SvnClient()) 
      //{ 
       Collection<SvnLis​tEventArgs> repocontents = null; 
       if (sc.GetList(new Uri(currentrepourl), out repocontents)) 
       { 
        foreach (SvnListEventArgs kiditem in repocontents) 
        { 
         if (!string.IsNullOrEmp​ty(kiditem.Path)) 
         { 
          TreeNode tn = GetRepoTreeNodes(currentrepourl + @"/" + kiditem.Path, kiditem.Path, ref sc); 
          // TreeNode tn = new TreeNode(kiditem.Path, tnkids.ToArray()); 
          tnkids.Add(tn); 
         } 
        } 
       } 
      //} 

      TreeNode thenode = new TreeNode(currentnodepath, tnkids.ToArray()); 
      return thenode; 
     } 

的問題是,當它達到loap結束,它仍然會將文件當作一個目錄,它拋出一個異常。我找不到解決辦法。如果您有其他方式來滿足這個目的,請與它協助。謝謝

回答

相關問題