Пример #1
0
        public static void BuildCodeAuthor(CodeAuthorInfo codeAuthor, PdbFileInfo pdbFile, List <GitFileInfo> gitFileInfos)
        {
            var gitFiles = gitFileInfos.Where(q => q.File == pdbFile.File && q.Line >= pdbFile.LineStart && q.Line <= pdbFile.LineEnd);

            foreach (var file in gitFiles)
            {
                codeAuthor.AddAuthor(pdbFile.Namespace, pdbFile.Class, pdbFile.Method, file.Author, file.CommitTime);
            }
        }
Пример #2
0
        private static void Analysis()
        {
            var path     = options.FolderPath;
            var pdbFiles = PdbFileHelper.GetPdbFiles(path);

            CodeAuthorInfo authorInfo = new CodeAuthorInfo();

            foreach (var pdbFile in pdbFiles)
            {
                var pdbFileInfos = PdbFileHelper.GetPdbInfos(pdbFile);

                var files = PdbFileHelper.GetFiles(pdbFileInfos);
                foreach (var file in files)
                {
                    if (authorInfo.HasFile(file))
                    {
                        continue;
                    }
                    authorInfo.AddFile(file);
                }

                foreach (var file in files)
                {
                    List <GitFileInfo> gitInfos = new List <GitFileInfo>();
                    var ifs = GitFileHelper.GetFileInfo(file);
                    authorInfo.AddGitUpdate(file, ifs);
                }

                foreach (var pdbFileInfo in pdbFileInfos)
                {
                    authorInfo.AddMethod(pdbFileInfo.Namespace, pdbFileInfo.Class, pdbFileInfo.Method
                                         , pdbFileInfo.File, pdbFileInfo.LineStart, pdbFileInfo.LineEnd);
                }
            }
            File.WriteAllText(options.OutputFilePath, JsonConvert.SerializeObject(authorInfo));
        }