Example #1
0
        /// <summary>
        /// Loads the detect errors flag
        /// </summary>
        /// <param name="store">The writable settings store</param>
        /// <returns>The detect error flag or if not found, the default detect error flag</returns>
        public static bool LoadDetectErrorsFlag(this WritableSettingsStore store)
        {
            bool detectErrorFlag = DefaultRainbowIndentOptions.defaultDetectErrorsFlag;

            if (store == null)
            {
                return(detectErrorFlag);
            }
            if (!store.PropertyExists(CollectionName, DetectErrorsPropertyName))
            {
                store.SaveDetectErrorsFlag(detectErrorFlag);
            }
            else
            {
                detectErrorFlag = store.GetBoolean(CollectionName, DetectErrorsPropertyName);
            }
            return(detectErrorFlag);
        }
Example #2
0
        /// <summary>
        /// Saves the settings to the settings store
        /// </summary>
        /// <param name="indentSize">The indent size specifiyng the number of spaces for indentation detection</param>
        /// <param name="colors">The colors as string</param>
        public static void SaveSettings(int indentSize, string fileExtensionsString, string colors, double opacityMultiplier, HighlightingMode highlightingmode, string errorColor, bool detectError)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            WritableSettingsStore settingsStore = GetWritableSettingsStore();

            settingsStore.SaveIndentSize(indentSize);
            settingsStore.SaveFileExtensionsIndentSizes(fileExtensionsString);
            settingsStore.SaveColors(colors);
            settingsStore.SaveOpacityMultiplier(opacityMultiplier);
            settingsStore.SaveHighlightingMode(highlightingmode);
            settingsStore.SaveDetectErrorsFlag(detectError);
            settingsStore.SaveErrorColor(errorColor);

            OptionsManager.indentSize.Set(indentSize);
            OptionsManager.fileExtensionsString.Set(fileExtensionsString);
            fileExtensionsDictionary.Set(LanguageParser.CreateDictionaryFromString(fileExtensionsString));
            OptionsManager.colors.Set(colors);
            brushes.Set(ColorParser.ConvertStringToBrushArray(colors, opacityMultiplier));
            OptionsManager.opacityMultiplier.Set(opacityMultiplier);
            OptionsManager.highlightingMode.Set(highlightingmode);
            OptionsManager.errorColor.Set(errorColor);
            detectErrors.Set(detectError);
            errorBrush.Set(ColorParser.ConvertStringToBrush(errorColor, opacityMultiplier));
        }