private async void Reparse(object sender, FileSystemEventArgs e) { if (e != null && e.Name.ToLowerInvariant() != _localFileName) { return; } var tryCount = 0; const int maxTries = 20; while (tryCount++ < maxTries) { try { var text = File.ReadAllText(_file); Reparse(text); break; } catch (IOException) { } await Task.Delay(100); } await UsageRegistry.ResynchronizeAsync(); if (IsProcessingUnusedCssRules) { UnusedCssExtension.All(x => x.SnapshotPage()); } }
private static void ResetUsageData(object sender, EventArgs e) { DocumentFactory.Clear(); UsageRegistry.Reset(); MessageDisplayManager.Refresh(); UnusedCssExtension.All(x => x.BlipRecording()); }
public IEnumerable <IStylingRule> GetUnusedRules() { lock (_sync) { var unusedRules = new HashSet <IStylingRule>(AllRules); unusedRules.ExceptWith(_ruleUsages.Select(x => x.Rule).Distinct()); return(unusedRules.Where(x => !UsageRegistry.IsAProtectedClass(x)).ToList()); } }
private void InstallIgnorePatterns(object sender, EventArgs e) { lock (validSheetUrls) { validSheetUrls.Clear(); } UsageRegistry.Reset(); GetIgnoreList(); MessageDisplayManager.Refresh(); }
private static void SolutionEventsOnProjectRemoved(Project project) { if (_lastProject == null || project == null) { return; } if (project.UniqueName == _lastProject.UniqueName) { UsageRegistry.Reset(); Refresh(); } }
public async void FinishedRecording(string operationId, string chunkContents, int chunkNumber, int chunkCount) { SessionResult result; var opId = Guid.Parse(operationId); if (_uploadHelper.TryFinishOperation(opId, chunkContents, chunkNumber, chunkCount, out result)) { lock (_operationsInProgress) { _operationsInProgress.Remove(opId); } ImportSheets(result.Sheets); using (AmbientRuleContext.GetOrCreate()) { await result.ResolveAsync(this); UsageRegistry.Merge(this, result); MessageDisplayManager.ShowWarningsFor(_connection.Url, _connection.Project, result); } } }
public static void ShowWarningsFor(Uri uri, Project project, IUsageDataSource browserSource) { using (ErrorList.UpdateSuspensionContext) { if (_currentDisplayData != null) { foreach (var item in _currentDisplayData) { ErrorList.RemoveItem(item); } } _lastSource = browserSource ?? _lastSource; _lastProject = project ?? _lastProject; _lastUri = uri ?? _lastUri; if (_lastSource == null || _lastProject == null) { _currentDisplayData = null; return; } _dontRefresh = true; try { switch (DisplaySource) { case MessageDisplaySource.Project: _currentDisplayData = UsageRegistry.GetWarnings(_lastProject).ToList(); break; case MessageDisplaySource.Url: _currentDisplayData = UsageRegistry.GetWarnings(_lastUri).ToList(); break; case MessageDisplaySource.Browser: _currentDisplayData = _lastSource.GetWarnings().ToList(); break; default: _currentDisplayData = null; return; } foreach (var item in _currentDisplayData) { ErrorList.AddItem(item); } } finally { _dontRefresh = false; } } }
private static void SolutionEventsOnAfterClosing() { UsageRegistry.Reset(); Refresh(); }
public IEnumerable <IStylingRule> GetUnusedRules() { return(AllRules.Except(_ruleUsages.Select(x => x.Rule)).Where(x => !UsageRegistry.IsAProtectedClass(x)).ToList()); }
private void CleanUpWarnings(object sender, FileSystemEventArgs e) { DocumentFactory.UnregisterDocument(this); UsageRegistry.Resynchronize(); }