private static void LoadConstants(Visual_NXC.Controls.highlighterBox h) { using (StreamReader r = File.OpenText(new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + "\\Codeview\\constants.shf")) { string color = r.ReadLine(); color = color.Replace("#COLOR=", ""); Color c = Tools.stringToColor(color); while (!r.EndOfStream) { string line = r.ReadLine(); h.HighlightDescriptors.Add( new HighlightDescriptor(line.Trim(), c, null, DescriptorType.Word, DescriptorRecognition.WholeWord, false)); } } }
private void InitSyntaxHighlighter(Visual_NXC.Controls.highlighterBox h) { h.Seperators.Add(' '); h.Seperators.Add('.'); h.Seperators.Add(','); h.Seperators.Add('\r'); h.Seperators.Add('\n'); h.Seperators.Add('+'); h.Seperators.Add('-'); h.Seperators.Add('\t'); h.Seperators.Add('('); h.Seperators.Add(')'); h.Seperators.Add('{'); h.Seperators.Add('}'); h.WordWrap = false; h.ScrollBars = RichTextBoxScrollBars.Both; h.HighlightDescriptors.Add(new HighlightDescriptor("/*", "*/", Color.Green, null, DescriptorType.ToCloseToken, DescriptorRecognition.StartsWith, false)); //h.HighlightDescriptors.Add(new HighlightDescriptor("\"", "\"", Color.Maroon, null, DescriptorType.ToCloseToken, DescriptorRecognition.StartsWith, false)); h.HighlightDescriptors.Add(new HighlightDescriptor("//", Color.Green, null, DescriptorType.ToEOL, DescriptorRecognition.StartsWith, false)); h.HighlightDescriptors.Add(new HighlightDescriptor("#", Color.Navy, null, DescriptorType.ToEOL, DescriptorRecognition.StartsWith, false)); LoadCommands(h); LoadConstants(h); LoadKeywords(h); }