public override void LoadSettingsFromStorage()
        {
            string path         = mSettingsPathBuilder.GetPath(kTidyOptionsFileName);
            var    loadedConfig = LoadFromFile(path);

            AutoTidyOnSave  = loadedConfig.AutoTidyOnSave;
            FormatAfterTidy = loadedConfig.FormatAfterTidy;

            if (null == loadedConfig.HeaderFilter)
            {
                HeaderFilter = new HeaderFiltersValue(ComboBoxConstants.kDefaultHeaderFilter);
            }
            else if (false == string.IsNullOrWhiteSpace(ClangTidyHeaderFiltersConvertor.ScriptDecode(loadedConfig.HeaderFilter)))
            {
                HeaderFilter = new HeaderFiltersValue(ClangTidyHeaderFiltersConvertor.ScriptDecode(loadedConfig.HeaderFilter));
            }
            else
            {
                HeaderFilter = new HeaderFiltersValue(loadedConfig.HeaderFilter);
            }

            if (null == loadedConfig.TidyMode)
            {
                UseChecksFrom = string.IsNullOrWhiteSpace(loadedConfig.TidyChecksCollection) ?
                                ClangTidyUseChecksFrom.PredefinedChecks : ClangTidyUseChecksFrom.CustomChecks;
            }
            else
            {
                UseChecksFrom = loadedConfig.TidyMode;
            }
        }
Exemple #2
0
        public override void SaveSettingsToStorage()
        {
            string path = mSettingsPathBuilder.GetPath(kTidyOptionsFileName);

            ClangTidyOptions updatedConfig = LoadFromFile(path);

            updatedConfig.AutoTidyOnSave  = AutoTidyOnSave;
            updatedConfig.FormatAfterTidy = FormatAfterTidy;

            if (HeaderFilter == null)
            {
                HeaderFilter = new HeaderFiltersValue(ComboBoxConstants.kDefaultHeaderFilter);
            }
            updatedConfig.HeaderFilter = string.IsNullOrWhiteSpace(ClangTidyHeaderFiltersConvertor.ScriptEncode(HeaderFilter.HeaderFilters)) == true
      ? HeaderFilter.HeaderFilters : ClangTidyHeaderFiltersConvertor.ScriptEncode(HeaderFilter.HeaderFilters);


            updatedConfig.TidyMode      = UseChecksFrom;
            updatedConfig.ClangTidyPath = ClangTidyPath;

            SaveToFile(path, updatedConfig);

            SetEnvironmentVariableTidyPath();
        }