예제 #1
0
 static void Main(string[] args)
 {
     CommandLine.Parser.Default.ParseArguments <Options>(args)
     .WithParsed <Options>(o =>
     {
         IOutput output;
         if (o.OutputFile.Length > 0)
         {
             output = new FileOutput(o.OutputFile);
         }
         else
         {
             output = new ConsoleOutput();
         }
         var md5sums = new RecursiveMD5ListOfDirectory(o.basedir);
         if (o.secondBasedir.Length > 0)
         {
             var secondSums = new RecursiveMD5ListOfDirectory(o.secondBasedir);
             var diffSums   = md5sums.Diff(secondSums);
             output.Write(diffSums.GetPathsWithMD5Sum());
         }
         else
         {
             output.Write(md5sums.GetPathsWithMD5Sum());
         }
     });
 }
예제 #2
0
        public static List <string> Compare(string folder1, string folder2)
        {
            var           md5sums = new RecursiveMD5ListOfDirectory(folder1);
            List <string> diffList;

            if (folder2.Length > 0)
            {
                var secondSums = new RecursiveMD5ListOfDirectory(folder2);
                var diffSums   = md5sums.Diff(secondSums);
                diffList = diffSums.GetPathsWithMD5Sum();
            }
            else
            {
                diffList = md5sums.GetPathsWithMD5Sum();
            }

            var comparedList = ListHeader(folder1, folder2);

            comparedList.AddRange(diffList);
            return(comparedList);
        }