private void CompleteSearch(ZombieObjectDetector.SearchContext ctx, System.DateTime startTime) { var now = System.DateTime.Now; System.TimeSpan duration = now - startTime; Debug.Log($"Search completed at {now} after {duration}. Tested {ctx.NumTestsPerformed} object(s)."); }
private void PrintHit(ZombieObjectDetector.SearchContext ctx, object o) { string objType = o.GetType().FullName; var fieldChain = ctx.FieldInfoChain; // The class holding the very first field // (The one with the static field) System.Type startType = fieldChain.Last().DeclaringType; IEnumerable <string> chain = fieldChain.Reverse().Select(m => m.Name); Debug.Log($"Found zombie of type {objType}, at {startType.FullName}.{string.Join(".", chain)}"); }
private void StartSearch(ZombieObjectDetector.SearchContext search) { var startTime = System.DateTime.Now; Debug.Log($"Search started at {startTime}"); if (m_reportTest) { search.TestingObjectField += ReportTest; } if (m_reportProgress) { search.MadeProgress += () => PrintProgress(search); } if (m_reportHit) { search.ZombieHit += (obj) => PrintHit(search, obj); } if (m_reportCompletion) { search.SearchCompleted += () => CompleteSearch(search, startTime); } }
private void PrintProgress(ZombieObjectDetector.SearchContext ctx) { Debug.Log($"Searched {ctx.NumTestsPerformed} objects."); }