예제 #1
0
        static void Main(string[] args)
        {
            var sw  = Stopwatch.StartNew();
            var sln = new HashSolution(@"C:\Users\abart\OneDrive\Source\Reporter\Server\Server.sln");

            sw.Stop();

            foreach (var project in sln.Projects)
            {
                Console.WriteLine($"{project.Name}");
                foreach (var file in project.Files)
                {
                    Console.WriteLine($"\t{file.Name,-40} {file.Type,-10} {file.Hash}");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
            Console.WriteLine($"Solution hash: {sln.Hash}");
            Console.WriteLine($"({sw.Elapsed} elapsed, hashed {sln.Projects.SelectMany(p => p.Files).Count()} files)");
        }
예제 #2
0
        public HashProject(HashSolution solution, string name, string projectFile)
        {
            Solution         = solution;
            Name             = name;
            ProjectFile      = projectFile;
            ProjectDirectory = Path.Combine(Solution.SolutionDirectory, Path.GetDirectoryName(projectFile));

            foreach (var line in System.IO.File.ReadAllLines(Path.Combine(Solution.SolutionDirectory, projectFile)))
            {
                var ma = FileRe.Match(line);
                if (ma.Success)
                {
                    var hf = new HashFile(this, ma.Groups["FileName"].Value, ma.Groups["Type"].Value);
                    Files.Add(hf);
                }
            }
            var sb = new StringBuilder();

            foreach (var hf in Files.OrderBy(f => f.Name))
            {
                sb.Append(hf.Hash);
            }
            Hash = HashHelper.HashObject(sb.ToString());
        }