//PLEASE NOTE: This is not reusable/general-purpose key-value serialization: it does not handle commas in data. // For now, this is used in the Test library only. public string ToSerializedString() { var overrides = new Dictionary <string, string>(); if (IndentString != _defaultOptions.IndentString) { overrides.Add("IndentString", IndentString); } if (SpacesPerTab != _defaultOptions.SpacesPerTab) { overrides.Add("SpacesPerTab", SpacesPerTab.ToString()); } if (MaxLineWidth != _defaultOptions.MaxLineWidth) { overrides.Add("MaxLineWidth", MaxLineWidth.ToString()); } if (ExpandCommaLists != _defaultOptions.ExpandCommaLists) { overrides.Add("ExpandCommaLists", ExpandCommaLists.ToString()); } if (TrailingCommas != _defaultOptions.TrailingCommas) { overrides.Add("TrailingCommas", TrailingCommas.ToString()); } if (SpaceAfterExpandedComma != _defaultOptions.SpaceAfterExpandedComma) { overrides.Add("SpaceAfterExpandedComma", SpaceAfterExpandedComma.ToString()); } if (ExpandBooleanExpressions != _defaultOptions.ExpandBooleanExpressions) { overrides.Add("ExpandBooleanExpressions", ExpandBooleanExpressions.ToString()); } if (ExpandBetweenConditions != _defaultOptions.ExpandBetweenConditions) { overrides.Add("ExpandBetweenConditions", ExpandBetweenConditions.ToString()); } if (ExpandCaseStatements != _defaultOptions.ExpandCaseStatements) { overrides.Add("ExpandCaseStatements", ExpandCaseStatements.ToString()); } if (UppercaseKeywords != _defaultOptions.UppercaseKeywords) { overrides.Add("UppercaseKeywords", UppercaseKeywords.ToString()); } if (BreakJoinOnSections != _defaultOptions.BreakJoinOnSections) { overrides.Add("BreakJoinOnSections", BreakJoinOnSections.ToString()); } if (HTMLColoring != _defaultOptions.HTMLColoring) { overrides.Add("HTMLColoring", HTMLColoring.ToString()); } if (KeywordStandardization != _defaultOptions.KeywordStandardization) { overrides.Add("KeywordStandardization", KeywordStandardization.ToString()); } if (overrides.Count == 0) { return(string.Empty); } return(string.Join(",", overrides.Select((kvp) => kvp.Key + "=" + kvp.Value).ToArray())); }
public void SaveAllSettings() { //ParamParseSettings WriteString(SettingsSection.ParamParseSettings, SettingName.ParamIdentificator, ParamIdentificator); WriteString(SettingsSection.ParamParseSettings, SettingName.DateFormat, DateFormat); //FormatSettings WriteString(SettingsSection.FormatSettings, SettingName.IndentString, IndentString); WriteString(SettingsSection.FormatSettings, SettingName.SpacesPerTab, SpacesPerTab.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.MaxLineWidth, MaxLineWidth.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.ExpandCommaList, ExpandCommaList.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.TrailingCommas, TrailingCommas.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.SpaceAfterExpandedComma, SpaceAfterExpandedComma.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.ExpandBooleanExpressions, ExpandBooleanExpressions.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.ExpandCaseStatements, ExpandCaseStatements.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.ExpandBetweenConditions, ExpandBetweenConditions.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.BreakJoinOnSections, BreakJoinOnSections.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.UppercaseKeywords, UppercaseKeywords.ToString()); WriteString(SettingsSection.FormatSettings, SettingName.KeywordStandardization, KeywordStandardization.ToString()); //Execute settings WriteString(SettingsSection.ExecuteSettings, SettingName.ConnectionString, ConnectionString); }