public Entry(QualityScope scope, InclusiveMode mode, Style.ConfigStyle configStyle, Checker check, Fixer fix, bool forceDisplayCheck = false, bool skipErrorIcon = false, bool displayAssetName = false) { this.scope = scope; this.inclusiveScope = mode; this.configStyle = configStyle; this.check = check; this.fix = fix; this.forceDisplayCheck = forceDisplayCheck; indent = mode == InclusiveMode.XRManagement ? 1 : 0; this.skipErrorIcon = skipErrorIcon; this.displayAssetName = displayAssetName; }
// Utility that grab all check and fix within the scope or in sub scope included and performe fix if check return incorrect void FixAllEntryInScope(InclusiveMode scope) { IEnumerable <(Entry.Checker, Entry.Fixer)> pairs = entries.Where(e => scope.Contains(e.inclusiveScope)).Select(e => (e.check, e.fix)); if (pairs.Count() == 0) { return; } foreach ((Entry.Checker check, Entry.Fixer fix) in pairs) { if (fix != null) { 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(InclusiveMode scope) { IEnumerable <Entry.Checker> checks = entries.Where(e => scope.Contains(e.inclusiveScope)).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); }
public static bool Contains(this InclusiveMode thisScope, InclusiveMode scope) => ((~thisScope) & scope) == 0;