2010-10-07 107 views
0

我有一个项目在sharpsvn的subversion目录下进行签出。我现在要做的是在进度条中显示结帐过程,但为此,我需要知道板的大小,库的属性或决定,我将返回目录的大小?Subversion目录的大小

在此先感谢!

+0

显示使用目录大小的进度将不起作用 - 例如,实际源大小可能为100 MB,但工作副本肯定会超过该值(因为它保留原始副本)。 – VinayC 2010-10-07 09:05:20

回答

0

我设法让下载目录的大小通过结账进行颠覆,所以我得到一个变量“total_size”,其下载的整体大小。现在在进度条中显示下载过程应捕获下载的比特与总数进行比较,并将它们分配给进度条,但不知道如何获取这些数据......有没有人做过类似的事情?你会告诉我那个属性并且使用了代码吗?

   //This collection will contain property collections for each node 
       System.Collections.ObjectModel.Collection<SvnPropertyListEventArgs> proplist; 

       //This is where we can specify arguments to svn proplist 
       SvnPropertyListArgs args = new SvnPropertyListArgs(); 

       args.Depth = SvnDepth.Infinity; 

       //This method is what executes svn proplist 
       client.GetPropertyList(targetSource, args, out proplist); 

       //Each SvnPropertyListEventArgs represents the prop. set for a node 
       foreach (SvnPropertyListEventArgs node in proplist) 
       { 
        //Each SvnPropertyValue represents a single name/value property pair 
        foreach (SvnPropertyValue propVal in node.Properties) 
        { 
         items.Items.Add(node.Path); 
        } 
       } 

       int total_items = items.Items.Count; 
       long totalsize = 0; 
       for (int i = 0; i < total_items; i++) 
       { 
        client.GetInfo(new Uri(items.Items[i].ToString()), out info); 
        totalsize = totalsize + info.RepositorySize; 

       } 
       MessageBox.Show(string.Format("The total size of {0} is {1}", targetSource, totalsize)); 

感谢

0

TortoiseSVN做一个结算进度类似的东西,你可以看看它的源代码。