コード例 #1
0
        public static List <TfsItemViewModel> SetPathParams(string projPath, string tfsPath)
        {
            _projPath = projPath;
            _tfsPath  = tfsPath;

            var files = new List <string>();

            if (File.Exists(projPath) && projPath.EndsWith(".csproj"))
            {
                GenerateCodeMetrics(projPath);
            }

            if (Directory.Exists(projPath))
            {
                //TODO: limited file types to cs
                files = Directory.GetFiles(projPath, "*.cs", SearchOption.AllDirectories).ToList();
                //files = Directory.GetFiles(Path.GetDirectoryName(projPath), "*.cs", SearchOption.AllDirectories).ToList();
            }

            data.Clear();
            Parallel.ForEach(files, file =>
            {
                var tfsFile = tfsPath + file.Replace(projPath, "").Replace(@"\", "/");
                var result  = TfsHelper.GetItemHistory(tfsFile);
                if (result != null)
                {
                    data.Add(new TfsItemViewModel()
                    {
                        FullPath = file,
                        Name     = Path.GetFileName(file),
                        BugCount = GetBugCount(result),
                        Score    = GetCodeMetricsScore(file),
                        Size     = new FileInfo(file).Length
                    });
                }
            });

            return(data);
        }
コード例 #2
0
 public TreeMapSelection()
 {
     InitializeComponent();
     this.DataContext = TfsHelper.GetData();
     SubItems         = TfsHelper.GetData();
 }