// Utility that grab all check and fix within the scope or in sub scope included and performe fix if check return incorrect void FixAllEntryInScope(InclusiveScope scope) { IEnumerable <(Entry.Checker, Entry.Fixer)> pairs = entries.Where(e => scope.Contains(e.scope)).Select(e => (e.check, e.fix)); if (pairs.Count() == 0) { return; } foreach ((Entry.Checker check, Entry.Fixer fix) in pairs) { m_Fixer.Add(() => { if (!check()) { fix(fromAsync: true); } }); } }
// Utility that grab all check within the scope or in sub scope included and check if everything is correct bool IsAllEntryCorrectInScope(InclusiveScope scope) { IEnumerable <Entry.Checker> checks = entries.Where(e => scope.Contains(e.scope)).Select(e => e.check); if (checks.Count() == 0) { return(true); } IEnumerator <Entry.Checker> enumerator = checks.GetEnumerator(); enumerator.MoveNext(); bool result = enumerator.Current(); if (enumerator.MoveNext()) { for (; result && enumerator.MoveNext();) { result &= enumerator.Current(); } } return(result); }