public static void InitializeNameLookup()
        {
            NameLookup = new Dictionary <string, string>();
            {
                XmlFile names = PartNamesXml;

                foreach (string section in names.stListSectionNames())
                {
                    List <string> entries = names.XmlReadSection(section);
                    foreach (string entry in entries)
                    {
                        int    index = entry.IndexOf(':');
                        string part  = entry.Substring(0, index);
                        string name  = entry.Substring(index + 1);
                        NameLookup.Add(part, name);
                    }
                }
            }
        }
        // 2 references
        public static List <string> GetPartSection(string part)
        {
            string Database = part.Before('.');

            if (Database == "")
            {
                return(null);
            }

            string PartName = part.After('.');

            string DbFileName = XmlPath + Database + ".xml";

            if (!System.IO.File.Exists(DbFileName))
            {
                return(null);
            }

            XmlFile DataFile = XmlFile.XmlFileFromCache(DbFileName);

            List <string> section = DataFile.XmlReadSection(PartName);

            return(section);
        }
        private void PartCategories_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            WeaponPartInfo.Clear();
            try
            {
                // Read ALL subsections of a given XML section
                // File: (AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt")
                XmlFile Category = new XmlFile(AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt");

                // XML Section: PartCategories.SelectedNode.Text
                List<string> xmlSection = Category.XmlReadSection(PartCategories.SelectedNode.Text);

                WeaponPartInfo.Lines = xmlSection.ToArray();
                /*
                if (File.Exists(AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt"))
                {
                    string[] InText = File.ReadAllLines(AppDir + "\\Data\\" + PartCategories.SelectedNode.Parent.Text + ".txt");
                    int start = 0;
                    int end = 1;
                    string search = "[" + PartCategories.SelectedNode.Text + "]";
                    ArrayList Lines = new ArrayList();
                    for (int i1 = 0; i1 < InText.Length; i1++)
                    {
                        if (InText[i1].Contains(search))
                        {
                            start = i1;
                            i1 = InText.Length;
                        }
                    }
                    for (int i2 = start + 1; i2 < InText.Length; i2++)
                    {
                        if (InText[i2].Contains("[") == true && InText[i2].Contains("=") == false)
                        {
                            end = i2;
                            i2 = InText.Length;
                        }
                    }
                    if(start > end)
                        for (start++; start < InText.Length; start++)
                        {

                                InText[start].Replace("=", ": ");
                                Lines.Add(InText[start]);

                        }
                    else
                    for (start++; start < end; start++)
                    {

                            InText[start].Replace("=", ": ");
                            Lines.Add(InText[start]);

                    }
                    WeaponPartInfo.Lines = (string[])Lines.ToArray(typeof(string));

                }*/
            }
            catch { }
        }