zoukankan      html  css  js  c++  java
  • IFS二次开发03——Item

    在TFS 中把每个文件夹被抽象成“ItemSet”或“Item”,相对于父级目录来讲就是Item ,相对于子级目录来讲就是“ItemSet”。每个文件都被抽象成“Item”。

     

    //连接TFS
    string tpcURL = "http://192.168.83.62:8080";
    TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(tpcURL));
    VersionControlServer version = tpc.GetService(typeof(VersionControlServer)) as VersionControlServer;
    
    //获取指定目录下的Item
    String Path="$/"  ;         
    ItemSet its = version.GetItems("$/", RecursionType.OneLevel); //获取Path 下的所有Item, 包括Path 自己,并且是第一个。第一个参数支持通配符,如:ItemSet its = version.GetItems("$/*.xaml", RecursionType.OneLevel);
    // RecursionType.OneLevel 递归向下读取一层 // RecursionType.Full 递归读取所有 // RecursionType.None 不递归
    //遍历Item foreach (Item item in its.Items) { //item.ArtifactUri 在服务器上的绝对路径 如:http://192.168.82.63:88/######## //item.ItemType 枚举,表明是文件还是文件 //item.ServerItem 在服务器上的绝对路径 如:$/CtripSolution/CommDll // item.IsBranch 是否是分支 //item.DownloadFile() 下载到本地 //.........
    }

    结合上面的代码,我们可以做出下面的效果:

     

     //显示已经删除掉的Item
    string tpcURL = "http://192.168.83.62:8080"; TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(tpcURL)); VersionControlServer version = tpc.GetService(typeof(VersionControlServer)) as VersionControlServer; ItemSpec spec = new ItemSpec("$/CtripSolution/Customer/MAINLINE/ScrmApp/SinaWeiTravel", RecursionType.Full); var deletedItems = version.GetItems(spec, VersionSpec.Latest, DeletedState.Deleted, ItemType.Any, true);
  • 相关阅读:
    小李子和他的水枪
    尼布尔的祈祷文
    牢骚太盛防肠断,风物长宜放眼量。
    常见浏览器userAgent请求头信息
    微信浏览器点击事件不生效怎么解决?
    2019上半年软件设计师上午考试真题
    360浏览器断网广告怎么去?
    谷歌浏览器打开一个新页面时使用新的标签
    Deep Learning in Bioinformatics
    TensorFlow Playground
  • 原文地址:https://www.cnblogs.com/xumingxiang/p/3101626.html
Copyright © 2011-2022 走看看