/// <summary>
        /// Static class constructor
        /// </summary>
        static DefaultHighlightingManager()
        {
            var defaultManager = new DefaultHighlightingManager();

            var theme = new HLTheme("Dark", "Light", "Dark",
                                    HL_THEMES_NAMESPACE_ROOT, "Dark.xshtd", defaultManager);

            defaultManager.ThemedHighlightingAdd(theme.Key, theme);

            theme = new HLTheme("Light", HL_GENERIC_NAMESPACE_ROOT, "Light");
            defaultManager.ThemedHighlightingAdd(theme.Key, theme);

            // Setup default theme without registration of Highlightings
            defaultManager.SetCurrentThemeInternal(theme.Key);

            theme = new HLTheme("TrueBlue", "Light", "True Blue",
                                HL_THEMES_NAMESPACE_ROOT, "TrueBlue.xshtd", defaultManager);
            defaultManager.ThemedHighlightingAdd(theme.Key, theme);

            theme = new HLTheme("VS2019_Dark", "Light", "VS2019 Dark",
                                HL_THEMES_NAMESPACE_ROOT, "VS2019_Dark.xshtd", defaultManager);
            defaultManager.ThemedHighlightingAdd(theme.Key, theme);

            HLResources.RegisterBuiltInHighlightings(defaultManager, defaultManager.CurrentTheme);

            Instance = defaultManager;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Static class constructor
        /// </summary>
        static DefaultHighlightingManager()
        {
            var defaultManager = new DefaultHighlightingManager();
            var themeNamespace = Assembly.GetExecutingAssembly().GetManifestResourceNames().First(name => name.EndsWith(FilenameXmldocXshd));

            foreach (var resourceName in Assembly.GetExecutingAssembly().GetManifestResourceNames())
            {
                if (!resourceName.EndsWith(ExtensionXshtd))
                {
                    continue;
                }

                var split    = resourceName.Split('.');
                var name     = split[split.Length - 2];
                var filename = string.Join(".", split, split.Length - 2, 2);
                var ns       = resourceName.Remove(resourceName.Length - (split[split.Length - 1].Length + split[split.Length - 2].Length) - 2);
                var theme    = new HLTheme(name, LightThemeName, name, ns, filename, defaultManager);
                defaultManager.ThemedHighlightingAdd(theme.Key, theme);
            }

            themeNamespace = themeNamespace.Remove(themeNamespace.Length - FilenameXmldocXshd.Length - 1);
            defaultManager.ThemedHighlightingAdd(LightThemeName, new HLTheme(LightThemeName, themeNamespace, LightThemeName));
            defaultManager.SetCurrentThemeInternal(LightThemeName);

            HLResources.RegisterBuiltInHighlightings(defaultManager, defaultManager.CurrentTheme);
            Instance = defaultManager;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets the current highlighting based on the name of the given highöighting theme.
 /// (eg: WPF APP Theme 'TrueBlue' -> Resolve highlighting 'C#' to 'TrueBlue'->'C#')
 ///
 /// Throws an <see cref="IndexOutOfRangeException"/> if the WPF APP theme is not known.
 /// </summary>
 /// <param name="themeNameKey"></param>
 public void SetCurrentTheme(string themeNameKey)
 {
     SetCurrentThemeInternal(themeNameKey);
     HLResources.RegisterBuiltInHighlightings(DefaultHighlightingManager.Instance, CurrentTheme);
 }