private CssRule(string sourceFile, string fileText, RuleSet ruleSet, string selectorName) { SelectorName = selectorName; CleansedSelectorName = RuleRegistry.StandardizeSelector(SelectorName); DisplaySelectorName = SelectorName.Replace('\r', '\n').Replace("\n", "").Trim(); string oldDisplaySelectorName = null; while (DisplaySelectorName != oldDisplaySelectorName) { oldDisplaySelectorName = DisplaySelectorName; DisplaySelectorName = DisplaySelectorName.Replace(" ", " "); } File = sourceFile; int line, column; CalculateLineAndColumn(fileText, ruleSet, out line, out column); Line = line; Column = column; Offset = ruleSet.Range.Start; Length = ruleSet.Range.Length; var lastSelector = ruleSet.Selectors[ruleSet.Selectors.Count - 1]; SelectorLength = lastSelector.Length + lastSelector.Start - ruleSet.Selectors[0].Start; _ruleSet = ruleSet; }
public static bool IsAProtectedClass(IStylingRule rule) { var selectorName = rule.DisplaySelectorName; var cleansedName = RuleRegistry.StandardizeSelector(selectorName); return(cleansedName.IndexOf(":visited", StringComparison.Ordinal) > -1 || cleansedName.IndexOf(":hover", StringComparison.Ordinal) > -1 || cleansedName.IndexOf(":active", StringComparison.Ordinal) > -1); }
public async System.Threading.Tasks.Task ResolveAsync(UnusedCssExtension extension) { if (Interlocked.CompareExchange(ref _isResolved, 1, 0) == 1) { throw new InvalidOperationException("Data source has already been resolved"); } _extension = extension; _ruleUsages = await RuleRegistry.ResolveAsync(RawUsageData); }
public async System.Threading.Tasks.Task ResyncAsync() { _ruleUsages = await RuleRegistry.ResolveAsync(RawUsageData); }
public void Resync() { _ruleUsages = RuleRegistry.Resolve(RawUsageData); }
public void Update() { Rules = RuleRegistry.GetAllRules(); }