private bool Equals(EditLocationResults other)
 {
     return(string.Equals(Zip, other.Zip) && NumEvents == other.NumEvents &&
            NumCompletionEvents == other.NumCompletionEvents &&
            NumLocations == other.NumLocations && AppliedEditLocations.Equals(other.AppliedEditLocations) &&
            OtherEditLocations.Equals(other.OtherEditLocations));
 }
Exemple #2
0
        private static void LogRes(IEditLocationResults res)
        {
            var tmp = new EditLocationResults {
                Zip = res.Zip
            };

            tmp.Add(res);
            tmp.AppliedEditLocations.Clear();
            tmp.OtherEditLocations.Clear();

            Console.WriteLine("NumAppliedEditLocations = {0}", res.AppliedEditLocations.Count);
            Console.WriteLine("NumOtherEditLocations = {0}", res.OtherEditLocations.Count);
            Console.Write(tmp.ToString());
        }
Exemple #3
0
        private EditLocationResults Analyze(string zip)
        {
            var res = new EditLocationResults {
                Zip = zip
            };
            var file = _io.GetFullPath_In(zip);

            using (var ra = new ReadingArchive(file))
            {
                var locAnal = new RelativeEditLocationAnalysis();
                while (ra.HasNext())
                {
                    var @event = ra.GetNext <IDEEvent>();
                    res.NumEvents++;

                    var complEvent = @event as CompletionEvent;
                    if (complEvent == null)
                    {
                        continue;
                    }

                    var fileName = complEvent.ActiveDocument.FileName;
                    if (fileName != null && !fileName.EndsWith(".cs"))
                    {
                        continue;
                    }

                    res.NumCompletionEvents++;

                    var loc = locAnal.Analyze(complEvent.Context2.SST);
                    if (!loc.HasEditLocation || loc.Size < 2)
                    {
                        continue;
                    }

                    res.NumLocations++;

                    if (complEvent.TerminatedState == TerminationState.Applied)
                    {
                        res.AppliedEditLocations.Add(loc);
                    }
                    else
                    {
                        res.OtherEditLocations.Add(loc);
                    }
                }
            }
            return(res);
        }