コード例 #1
0
ファイル: LanguageInfo.cs プロジェクト: TerabyteX/main
        public object Create(object parent, object configContext, XmlNode section)
        {
            Dictionary<string, LanguageInfo> languages = new Dictionary<string, LanguageInfo>();
            char[] splitChars = new char[] { ' ', '\t', ',', ';', '\r', '\n' };

            foreach (XmlElement elem in ((XmlElement)section).GetElementsByTagName("Language")) {
                var external = elem.GetAttribute("external");
                if (Chiron.UrlPrefix != null) {
                    external = string.Format("{0}{1}", Chiron.UrlPrefix, external);
                }

                LanguageInfo info = new LanguageInfo(
                    elem.GetAttribute("extensions").Split(splitChars, StringSplitOptions.RemoveEmptyEntries),
                    elem.GetAttribute("assemblies").Split(splitChars, StringSplitOptions.RemoveEmptyEntries),
                    elem.GetAttribute("languageContext"),
                    elem.GetAttribute("names").Split(splitChars, StringSplitOptions.RemoveEmptyEntries),
                    external
                );

                foreach (string ext in info.Extensions) {
                    var _ext = ext;
                    if(!_ext.StartsWith(".")) _ext = "." + _ext.ToLower();
                    languages[_ext] = info;
                }

            }

            return languages;
        }
コード例 #2
0
ファイル: LanguageInfo.cs プロジェクト: jcteague/ironruby
        public object Create(object parent, object configContext, XmlNode section) {
            Dictionary<string, LanguageInfo> languages = new Dictionary<string, LanguageInfo>();
            char[] splitChars = new char[] { ' ', '\t', ',', ';', '\r', '\n' };

            foreach (XmlElement elem in ((XmlElement)section).GetElementsByTagName("Language")) {
                LanguageInfo info = new LanguageInfo(
                    elem.GetAttribute("extensions").Split(splitChars, StringSplitOptions.RemoveEmptyEntries),
                    elem.GetAttribute("assemblies").Split(splitChars, StringSplitOptions.RemoveEmptyEntries),
                    elem.GetAttribute("languageContext")
                );

                foreach (string ext in info.Extensions) {
                    languages["." + ext.ToLower()] = info;
                }
            }

            return languages;
        }