Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceSyntaxModeProvider"/> class.
        /// </summary>
        public ResourceSyntaxModeProvider()
        {
            Assembly assembly         = typeof(SyntaxMode).Assembly;
            Stream   syntaxModeStream = assembly.GetManifestResourceStream("DigitalRune.Windows.TextEditor.Resources.SyntaxModes.xml");

            _syntaxModes = (syntaxModeStream != null) ? SyntaxMode.GetSyntaxModes(syntaxModeStream) : new List <SyntaxMode>();
        }
        /// <summary>
        /// Updates the list of syntax highlighting modes.
        /// </summary>
        public void UpdateSyntaxModeList()
        {
            string syntaxModeFile = Path.Combine(_directory, "SyntaxModes.xml");

            if (File.Exists(syntaxModeFile))
            {
                Stream s = File.OpenRead(syntaxModeFile);
                _syntaxModes = SyntaxMode.GetSyntaxModes(s);
                s.Close();
            }
            else
            {
                _syntaxModes = ScanDirectory(_directory);
            }
        }