使用C#获取SharpSVN中包含.sln和.java文件的文件夹名称

本文关键字:文件 java 文件夹 sln 获取 SharpSVN 包含 使用 | 更新日期: 2023-09-27 18:26:48

我想从给定的远程URL中搜索.sln和.java文件:类似于http://olfandsub1.olf.com/nyts/.

我尝试了下面用来读取所有文件的代码,但它不起作用。你能解释一下GetList函数在代码中的作用吗?

你能告诉我是否可以在代码中使用文本框值作为projectPath吗?

我能解决问题的最好方法是什么?

    bool gotList; 
    List<string> files = new List<string>(); 
    using (SvnClient client = new SvnClient()) 
    { 
        Collection<SvnListEventArgs> list; 
        gotList = client.GetList(projectPath, out list); 
        if (gotList) 
        { 
            foreach (SvnListEventArgs item in list) 
            { 
                files.Add(item.Path); 
            } 
        } 
    } 

我还得到了"PROPFIND of '/nyts': authorization failed: Could not authenticate to server: rejected Basic challenge (http://olfandsub1.olf.com <http://olfandsub1.olf.com/> )"错误,尽管我的用户名和密码是绝对正确的。

请尽快告诉我,因为我已经试着实施了三天了。谢谢

使用C#获取SharpSVN中包含.sln和.java文件的文件夹名称

您应该添加类似的内容

client.Authentication.DefaultCredentials = new NetworkCredentials("user", "password");

或者更干净地挂接Authentication类上的事件,并仅在需要时提供凭据。

(SharpSvn.UI程序集包含您在AnkhSVN中看到的默认UI)