static TextEditorViewType()
		{
			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
			if(propertyService != null)
			{
				//实例化一个高亮度显示语法的对象.(该对象包含各种文件的高亮度显示策略)
				SyntaxModeProvider syntaxModeProvider = new SyntaxModeProvider(Path.Combine(propertyService.DataDirectory,"modes"));

				HighlightingManager.Manager.AddSyntaxModeProvider(syntaxModeProvider);//添加一个语法醒目显示提供者.
			}
		}
Beispiel #2
0
        public void AddSyntaxModeProvider(SyntaxModeProvider syntaxModeProvider)
        {
            foreach (SyntaxMode syntaxMode in syntaxModeProvider.SyntaxModes)
            {
                DefaultHighlightingStrategy highlightingStrategy = ParseSyntaxMode(syntaxMode, syntaxModeProvider.GetSyntaxModeXmlTextReader(syntaxMode));
                highlightingStrategy.ResolveReferences();

                highlightingDefs[syntaxMode.Name] = highlightingStrategy;

                foreach (string extension in syntaxMode.Extensions)
                {
                    extensionsToName[extension.ToUpper()] = syntaxMode.Name;                    //对某一类文件都使用这个语法模式.
                }
            }
            if (!syntaxModeProviders.Contains(syntaxModeProvider))
            {
                syntaxModeProviders.Add(syntaxModeProvider);                //注意:这里添加对象.
            }
        }
		public void AddSyntaxModeProvider(SyntaxModeProvider syntaxModeProvider)
		{
			foreach (SyntaxMode syntaxMode in syntaxModeProvider.SyntaxModes) 
			{
				DefaultHighlightingStrategy highlightingStrategy = ParseSyntaxMode(syntaxMode, syntaxModeProvider.GetSyntaxModeXmlTextReader(syntaxMode));
				highlightingStrategy.ResolveReferences();

				highlightingDefs[syntaxMode.Name] = highlightingStrategy;
				
				foreach (string extension in syntaxMode.Extensions) 
				{
					extensionsToName[extension.ToUpper()] = syntaxMode.Name;//对某一类文件都使用这个语法模式.
				}
			}
			if (!syntaxModeProviders.Contains(syntaxModeProvider)) 
			{
				syntaxModeProviders.Add(syntaxModeProvider);//注意:这里添加对象.
			}
		}