示例#1
0
        /// <summary>
        /// Takes a theme in memory and update the color values that the user might have changed
        /// </summary>
        /// <param name="themeToUpdate"></param>
        public static void UpdateThemeXMLValues(ThemeInfo themeToUpdate)
        {
            var bytesIn     = File.ReadAllBytes(themeToUpdate.URI);
            var manipulator = new MremoteNGPaletteManipulator(bytesIn, themeToUpdate.ExtendedPalette);
            var bytesOut    = manipulator.mergePalette(themeToUpdate.ExtendedPalette);

            File.WriteAllBytes(themeToUpdate.URI, bytesOut);
        }
示例#2
0
        /// <summary>
        /// Load a theme form an xml file
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="defaultTheme"></param>
        /// <returns></returns>
        public static ThemeInfo LoadFromXmlFile(string filename, ThemeInfo defaultTheme = null)
        {
            var bytes = File.ReadAllBytes(filename);
            //Load the dockpanel part
            var themeBaseLoad = new MremoteNGThemeBase(bytes);
            //Load the mremote part
            //Cause we cannot default the theme for the default theme
            var extColorLoader = new MremoteNGPaletteManipulator(bytes, defaultTheme?.ExtendedPalette);
            var loadedTheme    = new ThemeInfo(Path.GetFileNameWithoutExtension(filename), themeBaseLoad, filename, VisualStudioToolStripExtender.VsVersion.Vs2015, extColorLoader.getColors());

            if (new[] { "darcula", "vs2015blue", "vs2015dark", "vs2015light" }.Contains(Path.GetFileNameWithoutExtension(filename)))
            {
                loadedTheme.IsThemeBase = true;
            }
            loadedTheme.IsExtendable = true;
            return(loadedTheme);
        }