public SourceCodeMarkUp(string AssemblyDirectory)
        {
            if (Directory.Exists(AssemblyDirectory + "\\Notepad++.Profiles"))
            {
                foreach (string strFile in Directory.GetFiles(AssemblyDirectory + "\\Notepad++.Profiles"))
                {
                    CodeMarkUp cmuTemp = null;

                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(strFile);

                    XmlNodeList xmlLangs = xmlDoc.GetElementsByTagName("Languages");

                    foreach (XmlNode xmlLang in xmlLangs)
                    {
                        foreach (XmlNode xmlSubNode in xmlLang.ChildNodes)
                        {
                            if (xmlSubNode.Name.Equals("Language"))
                            {
                                cmuTemp = new CodeMarkUp();

                                foreach (XmlAttribute xmlAttrib in xmlSubNode.Attributes)
                                {
                                    // Name
                                    if (xmlAttrib.Name.Equals("name"))
                                    {
                                        cmuTemp.strName = xmlAttrib.Value;
                                    }

                                    // Extensions
                                    if (xmlAttrib.Name.Equals("ext"))
                                    {
                                        string[] strExts = xmlAttrib.Value.Split(' ');
                                        foreach (string strExt in strExts)
                                        {
                                            cmuTemp.strExts.Add(strExt);
                                        }
                                    }

                                    // Comments
                                    if (xmlAttrib.Name.Equals("commentLine"))
                                    {
                                        cmuTemp.strCommentLine = xmlAttrib.Value;
                                    }
                                    if (xmlAttrib.Name.Equals("commentStart"))
                                    {
                                        cmuTemp.strCommentStart = xmlAttrib.Value;
                                    }
                                    if (xmlAttrib.Name.Equals("commentEnd"))
                                    {
                                        cmuTemp.strCommentEnd = xmlAttrib.Value;
                                    }
                                }

                                // Now
                                foreach (XmlNode xmlSubSubNode in xmlSubNode.ChildNodes)
                                {
                                    if (xmlSubSubNode.Name.Equals("Keywords"))
                                    {
                                        string[] strKeyWords = xmlSubSubNode.InnerText.Split(' ');
                                        foreach (string strKeyWord in strKeyWords)
                                        {
                                            cmuTemp.strKeyWords.Add(strKeyWord);
                                        }
                                    }
                                }

                                codeMarkUps.Add(cmuTemp);
                            }
                        }
                    }
                }
            }
            else
            {
            }
        }
Beispiel #2
0
        public SourceCodeMarkUp(string AssemblyDirectory)
        {
            if (Directory.Exists(AssemblyDirectory + "\\Notepad++.Profiles"))
            {
                foreach (string strFile in Directory.GetFiles(AssemblyDirectory + "\\Notepad++.Profiles"))
                {
                    CodeMarkUp cmuTemp = null;

                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(strFile);

                    XmlNodeList xmlLangs = xmlDoc.GetElementsByTagName("Languages");

                    foreach (XmlNode xmlLang in xmlLangs)
                    {
                        foreach (XmlNode xmlSubNode in xmlLang.ChildNodes)
                        {
                            if (xmlSubNode.Name.Equals("Language"))
                            {
                                cmuTemp = new CodeMarkUp();

                                foreach(XmlAttribute xmlAttrib in xmlSubNode.Attributes){

                                    // Name
                                    if(xmlAttrib.Name.Equals("name")) cmuTemp.strName = xmlAttrib.Value;

                                    // Extensions
                                    if(xmlAttrib.Name.Equals("ext")){
                                        string[] strExts = xmlAttrib.Value.Split(' ');
                                        foreach(string strExt in strExts){
                                            cmuTemp.strExts.Add(strExt);
                                        }
                                    }

                                    // Comments
                                    if (xmlAttrib.Name.Equals("commentLine")) cmuTemp.strCommentLine = xmlAttrib.Value;
                                    if (xmlAttrib.Name.Equals("commentStart")) cmuTemp.strCommentStart = xmlAttrib.Value;
                                    if (xmlAttrib.Name.Equals("commentEnd")) cmuTemp.strCommentEnd = xmlAttrib.Value;
                                }

                                // Now
                                foreach (XmlNode xmlSubSubNode in xmlSubNode.ChildNodes)
                                {

                                    if(xmlSubSubNode.Name.Equals("Keywords"))
                                    {
                                        string[] strKeyWords = xmlSubSubNode.InnerText.Split(' ');
                                        foreach (string strKeyWord in strKeyWords)
                                        {
                                            cmuTemp.strKeyWords.Add(strKeyWord);
                                        }
                                    }
                                }

                                codeMarkUps.Add(cmuTemp);
                            }
                        }

                    }
                }
            }
            else
            {

            }
        }