private ImmutableDictionary <string, bool> BuildRuleMapFromOptions() { var result = new Dictionary <string, bool>(); var propertyBag = OptionsHelper.BuildDefaultPropertyBag(); if (!string.IsNullOrEmpty(OptionsFilePath)) { propertyBag.LoadFrom(OptionsFilePath); } propertyBag = (PropertyBag)propertyBag["CodeFormatterRules.Options"]; foreach (string key in propertyBag.Keys) { string[] tokens = key.Split('.'); Debug.Assert(tokens.Length == 2); Debug.Assert(tokens[1].Equals("Enabled")); string rule = tokens[0]; result[rule] = (bool)propertyBag[key]; } _ruleMap = result.ToImmutableDictionary(); return(_ruleMap); }
protected PropertyBag CreatePolicyThatDisablesAllAnalysis() { PropertyBag propertyBag = OptionsHelper.BuildDefaultPropertyBag(); foreach (string analyzerName in OptionsHelper.AllAnalyzerNames) { propertyBag.SetProperty(OptionsHelper.BuildDefaultEnabledProperty(analyzerName), false); } return(propertyBag); }
private static int RunExportOptionsCommand(ExportOptions exportOptions) { int result = FAILED; PropertyBag allOptions = OptionsHelper.BuildDefaultPropertyBag(); allOptions.SaveTo(exportOptions.OutputPath, id: "codeformatter-options"); Console.WriteLine("Options file saved to: " + Path.GetFullPath(exportOptions.OutputPath)); result = SUCCEEDED; return(result); }