1 | // Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team |
---|
2 | // |
---|
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this |
---|
4 | // software and associated documentation files (the "Software"), to deal in the Software |
---|
5 | // without restriction, including without limitation the rights to use, copy, modify, merge, |
---|
6 | // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons |
---|
7 | // to whom the Software is furnished to do so, subject to the following conditions: |
---|
8 | // |
---|
9 | // The above copyright notice and this permission notice shall be included in all copies or |
---|
10 | // substantial portions of the Software. |
---|
11 | // |
---|
12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
---|
13 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
---|
14 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE |
---|
15 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
---|
16 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
17 | // DEALINGS IN THE SOFTWARE. |
---|
18 | |
---|
19 | using System; |
---|
20 | using System.IO; |
---|
21 | |
---|
22 | namespace ICSharpCode.AvalonEdit.Highlighting |
---|
23 | { |
---|
24 | static class Resources |
---|
25 | { |
---|
26 | static readonly string Prefix = typeof(Resources).FullName + "."; |
---|
27 | |
---|
28 | public static Stream OpenStream(string name) |
---|
29 | { |
---|
30 | Stream s = typeof(Resources).Assembly.GetManifestResourceStream(Prefix + name); |
---|
31 | if (s == null) |
---|
32 | throw new FileNotFoundException("The resource file '" + name + "' was not found."); |
---|
33 | return s; |
---|
34 | } |
---|
35 | |
---|
36 | internal static void RegisterBuiltInHighlightings(HighlightingManager.DefaultHighlightingManager hlm) |
---|
37 | { |
---|
38 | hlm.RegisterHighlighting("XmlDoc", null, "XmlDoc.xshd"); |
---|
39 | hlm.RegisterHighlighting("C#", new[] { ".cs" }, "CSharp-Mode.xshd"); |
---|
40 | |
---|
41 | hlm.RegisterHighlighting("JavaScript", new[] { ".js" }, "JavaScript-Mode.xshd"); |
---|
42 | hlm.RegisterHighlighting("HTML", new[] { ".htm", ".html" }, "HTML-Mode.xshd"); |
---|
43 | hlm.RegisterHighlighting("ASP/XHTML", new[] { ".asp", ".aspx", ".asax", ".asmx", ".ascx", ".master" }, "ASPX.xshd"); |
---|
44 | |
---|
45 | hlm.RegisterHighlighting("Boo", new[] { ".boo" }, "Boo.xshd"); |
---|
46 | hlm.RegisterHighlighting("Coco", new[] { ".atg" }, "Coco-Mode.xshd"); |
---|
47 | hlm.RegisterHighlighting("CSS", new[] { ".css" }, "CSS-Mode.xshd"); |
---|
48 | hlm.RegisterHighlighting("C++", new[] { ".c", ".h", ".cc", ".cpp" , ".hpp" }, "CPP-Mode.xshd"); |
---|
49 | hlm.RegisterHighlighting("Java", new[] { ".java" }, "Java-Mode.xshd"); |
---|
50 | hlm.RegisterHighlighting("Patch", new[] { ".patch", ".diff" }, "Patch-Mode.xshd"); |
---|
51 | hlm.RegisterHighlighting("PowerShell", new[] { ".ps1", ".psm1", ".psd1" }, "PowerShell.xshd"); |
---|
52 | hlm.RegisterHighlighting("PHP", new[] { ".php" }, "PHP-Mode.xshd"); |
---|
53 | hlm.RegisterHighlighting("TeX", new[] { ".tex" }, "Tex-Mode.xshd"); |
---|
54 | hlm.RegisterHighlighting("VB", new[] { ".vb" }, "VB-Mode.xshd"); |
---|
55 | hlm.RegisterHighlighting("XML", (".xml;.xsl;.xslt;.xsd;.manifest;.config;.addin;" + |
---|
56 | ".xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.ilproj;" + |
---|
57 | ".booproj;.build;.xfrm;.targets;.xaml;.xpt;" + |
---|
58 | ".xft;.map;.wsdl;.disco;.ps1xml;.nuspec").Split(';'), |
---|
59 | "XML-Mode.xshd"); |
---|
60 | hlm.RegisterHighlighting("MarkDown", new[] { ".md" }, "MarkDown-Mode.xshd"); |
---|
61 | } |
---|
62 | } |
---|
63 | } |
---|