public void ConvertStringToBrushArray_ExpectedBehavior(string input, double opacityMultiplier, int solutionIndex)
        {
            Brush[] result   = ColorParser.ConvertStringToBrushArray(input, opacityMultiplier);
            Brush[] solution = solutions[solutionIndex];

            Assert.AreEqual(solution.Length, result.Length);
            for (int i = 0; i < solution.Length; i++)
            {
                Assert.AreEqual(solution[i].ToString(), result[i].ToString());
            }
        }
        /// <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 colors)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var settingsStore = GetWritableSettingsStore();

            settingsStore.SaveIndentSize(indentSize);
            settingsStore.SaveColors(colors);
            OptionsManager.indentSize = indentSize;
            OptionsManager.colors     = colors;
            brushes = ColorParser.ConvertStringToBrushArray(colors);
        }
 /// <summary>
 /// Loads the settings from the settings store
 /// </summary>
 public static void LoadSettings()
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     if (!loadedFromStorage)
     {
         var settingsStore = GetWritableSettingsStore();
         indentSize        = settingsStore.LoadIndentSize();
         colors            = settingsStore.LoadColors();
         brushes           = ColorParser.ConvertStringToBrushArray(colors);
         loadedFromStorage = true;
     }
 }
Beispiel #4
0
 /// <summary>
 /// Loads the settings from the settings store
 /// </summary>
 public static void LoadSettings()
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     if (!loadedFromStorage)
     {
         WritableSettingsStore settingsStore = GetWritableSettingsStore();
         indentSize.Set(settingsStore.LoadIndentSize());
         colors.Set(settingsStore.LoadColors());
         opacityMultiplier.Set(settingsStore.LoadOpacityMultiplier());
         highlightingMode.Set(settingsStore.LoadHighlightingMode());
         errorColor.Set(settingsStore.LoadErrorColor());
         detectErrors.Set(settingsStore.LoadDetectErrorsFlag());
         fileExtensionsString.Set(settingsStore.LoadFileExtensionsIndentSizes());
         //This fields have to be initialized after the other fields since they depend on them
         loadedFromStorage = true;
         brushes.Set(ColorParser.ConvertStringToBrushArray(colors.Get(), opacityMultiplier.Get()));
         errorBrush.Set(ColorParser.ConvertStringToBrush(errorColor.Get(), opacityMultiplier.Get()));
         fileExtensionsDictionary.Set(LanguageParser.CreateDictionaryFromString(fileExtensionsString.Get()));
     }
 }
Beispiel #5
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));
        }