private static LocalStats Sum(Results lr)
        {
            var result = new LocalStats();

            foreach (var value in lr.Values)
            {
                result.Add(value);
            }
            return(result);
        }
        private static Dictionary <string, LocalStats> OneFileStats(string file)
        {
            var result = new Dictionary <string, LocalStats>();

            try
            {
                var lines = File.ReadAllLines(file);

                LocalStats last = null;
                for (int i = 0; i < lines.Length; i++)
                {
                    var    line        = lines[i];
                    string projectName = null;
                    if (MatchOneValue(ref projectName, line, @"^\s*(\d+(:\d+)?>)?\s*CodeContracts:\s+([^:]+):", groupNo: 3) /*&& projectName != null*/)
                    {
                        if (!projectName.StartsWith("Checked ") && !projectName.StartsWith("Suggested requires"))
                        {
                            last = GetOrMaterialize(projectName, result);
                            MatchOneValue(ref last.MethodsAnalyzed, line, @"Total methods analyzed\s+(\d+)");
                            MatchOneValue(ref last.MethodsWith0Warnings, line, @"Methods with 0 warnings\s+(\d+)");
                            MatchOneValue(ref last.MethodsWithBaseLine, line, @"Methods with baseline:\s+(\d+)");
                            MatchOneValue(ref last.MethodsWithoutBaseLine, line, @"Methods w/o  baseline:\s+(\d+)");
                            MatchOneValue(ref last.MethodsReadFromCache, line, @"Total method analysis read from the cache\s+(\d+)");
                            MatchOneValue(ref last.MethodsWithIdenticalBaseLine, line, @"Methods with identical baseline:\s+(\d+)");
                            MatchOneValue(ref last.Checked, line, @"Checked\s+(\d+)\s+assertion");
                            MatchOneValue(ref last.Correct, line, @"(\d+)\s+correct");
                            MatchOneValue(ref last.Unknown, line, @"(\d+)\s+unknown");
                            MatchOneValue(ref last.Unreached, line, @"(\d+)\s+unreached");
                            MatchOneValue(ref last.TotalTime, line, @"Total time\s+(\d+.\d+)sec.");
                            if (MatchOneValue(ref last.TotalTime, line, @"Total time\s+(\d+:\d+)min."))
                            {
                                var minsec = last.TotalTime.Split(':');
                                Contract.Assume(minsec.Length >= 2);
                                var min = Int32.Parse(minsec[0]);
                                var sec = Int32.Parse(minsec[1]);
                                last.TotalTime = (min * 60 + sec).ToString();
                            }
                            if (MatchOneValue(ref last.TotalTime, line, @"Total time\s+(\d+)ms."))
                            {
                                var sec = Int32.Parse(last.TotalTime);
                                last.TotalTime = (sec / 1000.0).ToString();
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            return(result);
        }
 internal void Add(LocalStats value)
 {
     AddInts(ref MethodsAnalyzed, value.MethodsAnalyzed);
     AddInts(ref MethodsWithBaseLine, value.MethodsWithBaseLine);
     AddInts(ref MethodsWithoutBaseLine, value.MethodsWithoutBaseLine);
     AddInts(ref MethodsWithIdenticalBaseLine, value.MethodsWithIdenticalBaseLine);
     AddInts(ref MethodsWith0Warnings, value.MethodsWith0Warnings);
     AddInts(ref MethodsReadFromCache, value.MethodsReadFromCache);
     AddInts(ref Checked, value.Checked);
     AddInts(ref Correct, value.Correct);
     AddInts(ref Unknown, value.Unknown);
     AddInts(ref Unreached, value.Unreached);
     AddFloat(ref TotalTime, value.TotalTime);
 }
 internal void Add(LocalStats value)
 {
   AddInts(ref MethodsAnalyzed, value.MethodsAnalyzed);
   AddInts(ref MethodsWithBaseLine, value.MethodsWithBaseLine);
   AddInts(ref MethodsWithoutBaseLine, value.MethodsWithoutBaseLine);
   AddInts(ref MethodsWithIdenticalBaseLine, value.MethodsWithIdenticalBaseLine);
   AddInts(ref MethodsWith0Warnings, value.MethodsWith0Warnings);
   AddInts(ref MethodsReadFromCache, value.MethodsReadFromCache);
   AddInts(ref Checked, value.Checked);
   AddInts(ref Correct, value.Correct);
   AddInts(ref Unknown, value.Unknown);
   AddInts(ref Unreached, value.Unreached);
   AddFloat(ref TotalTime, value.TotalTime);
 }
        private static LocalStats GetOrMaterialize(string project, Dictionary <string, LocalStats> dic)
        {
            LocalStats result;

            if (!dic.TryGetValue(project, out result))
            {
                result = new LocalStats();
                dic.Add(project, result);
            }
            else
            {
                Contract.Assume(result != null);
            }
            return(result);
        }
 private static LocalStats GetOrMaterialize(string project, Dictionary<string, LocalStats> dic)
 {
   LocalStats result;
   if (!dic.TryGetValue(project, out result))
   {
     result = new LocalStats();
     dic.Add(project, result);
   }
   else
   {
     Contract.Assume(result != null);
   }
   return result;
 }
 private static LocalStats Sum(Results lr)
 {
   var result = new LocalStats();
   foreach (var value in lr.Values)
   {
     result.Add(value);
   }
   return result;
 }