/// <summary> /// Sets the location of the StyleCop .Settings XML file, and validates it /// </summary> /// <param name="filePath">UniversalPath to the StyleCop .Settings file</param> internal void SetStyleCopFile(UniversalPath filePath) { string errorMessage; if (!XMLTool.IsStyleCopFileValid(filePath, out errorMessage)) { throw new System.ArgumentException(errorMessage); } this.saveData.StyleCopSettingsFilePath = filePath; this.cachedIsStyleCopSettingsFileValid = true; this.CheckStyleCopFileSynced(); }
/// <summary> /// Applies the user's current selection of ignored files/directories to StyleCop's .Settings file /// </summary> internal void OnLoadToStyleCop() { var allSelectedIgnoredFiles = this.view.GetSelectedFiles().ToArray(); // Convert full file paths to just file names var ignoredFileNames = new string[allSelectedIgnoredFiles.Length]; for (int i = 0; i < allSelectedIgnoredFiles.Length; ++i) { ignoredFileNames[i] = new System.IO.FileInfo((string)allSelectedIgnoredFiles[i]).Name; } XMLTool.ReplaceIgnoreFileNames(this.saveData.StyleCopSettingsFilePath, ignoredFileNames); this.CheckStyleCopFileSynced(); }
/// <summary> /// Removes all ignores filenames from StyleCop's .Settings file, regardless of their ignore status in the View /// </summary> internal void OnUnloadFromStyleCop() { XMLTool.ReplaceIgnoreFileNames(this.saveData.StyleCopSettingsFilePath, new string[0]); this.CheckStyleCopFileSynced(); }
/// <summary> /// Checks and caches whether the StyleCop .Settings file is sync'd with the SaveData /// </summary> internal void CheckStyleCopFileSynced() { if (this.CachedIsStyleCopSettingsFileValid) { this.cachedIsStyleCopSynced = this.SaveData.IsIgnoredFilesEqualToFileNameList(XMLTool.GetIgnoredFileNames(this.SaveData.StyleCopSettingsFilePath)); } }
/// <summary> /// Checks and caches whether the current StyleCop .Settings file is valid /// </summary> internal void CheckStyleCopFileValidity() { this.cachedIsStyleCopSettingsFileValid = XMLTool.IsStyleCopFileValid(this.saveData.StyleCopSettingsFilePath); }