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);
                    }
                }
            }
        }
        public static void DoPartsCategory(string Category, TreeViewAdv Tree)
        {
            XmlFile   PartList = XmlFile.XmlFileFromCache(db.DataPath + Category + ".txt");
            TreeModel model    = Tree.Model as TreeModel;

            Tree.BeginUpdate();
            Tree.Model = model;

            ColoredTextNode parent = new ColoredTextNode(Category);

            parent.Tag = Category;
            model.Nodes.Add(parent);

            foreach (string section in PartList.stListSectionNames())
            {
                ColoredTextNode child = new ColoredTextNode();
                child.Text = section;
                child.Tag  = section;
                parent.Nodes.Add(child);
            }
            Tree.EndUpdate();
        }
        private void SaveToFile(string filename)
        {
            //Ini.IniFile Locations = new Ini.IniFile(AppDir + "\\Data\\Locations.ini");
            XmlFile Locations = new XmlFile(AppDir + "\\Data\\Locations.ini");

            if (BankSpace.Enabled)
                CurrentWSG.DLC.BankSize = (int)BankSpace.Value;

            if (Class.SelectedIndex == 0) CurrentWSG.Class = "gd_Roland.Character.CharacterClass_Roland";
            else if (Class.SelectedIndex == 1) CurrentWSG.Class = "gd_lilith.Character.CharacterClass_Lilith";
            else if (Class.SelectedIndex == 2) CurrentWSG.Class = "gd_mordecai.Character.CharacterClass_Mordecai";
            else if (Class.SelectedIndex == 3) CurrentWSG.Class = "gd_Brick.Character.CharacterClass_Brick";
            CurrentWSG.CharacterName = CharacterName.Text;
            CurrentWSG.Level = (int)Level.Value;
            CurrentWSG.Experience = (int)Experience.Value;
            CurrentWSG.SkillPoints = (int)SkillPoints.Value;
            CurrentWSG.FinishedPlaythrough1 = PT2Unlocked.SelectedIndex;
            CurrentWSG.Cash = (int)Cash.Value;
            CurrentWSG.BackpackSize = (int)BackpackSpace.Value;
            CurrentWSG.EquipSlots = (int)EquipSlots.Value;
            CurrentWSG.SaveNumber = (int)SaveNumber.Value;
            if (CurrentLocation.SelectedText != "" && CurrentLocation.SelectedText != null)
                CurrentWSG.CurrentLocation = Locations.stListSectionNames()[CurrentLocation.SelectedIndex];

            if (CurrentWSG.Platform == "PS3" || CurrentWSG.Platform == "PC")
            {
                using (BinaryWriter Save = new BinaryWriter(new FileStream(filename, FileMode.Create)))
                {
                    Save.Write(CurrentWSG.SaveWSG());
                }
            }

            else if (CurrentWSG.Platform == "X360")
            {
                string tempSaveName = filename + ".temp";
                using (BinaryWriter Save = new BinaryWriter(new FileStream(tempSaveName, FileMode.Create)))
                {
                    Save.Write(CurrentWSG.SaveWSG());
                }

                BuildXboxPackage(filename, tempSaveName);
                File.Delete(tempSaveName);
            }
            CurrentWSG.OpenedWSG = filename;
        }
        private void QuestList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int SelectedItem = QuestList.SelectedIndex;
            NewQuest.ClosePopup();
            try
            {
                //Ini.IniFile Quests = new Ini.IniFile(AppDir + "\\Data\\Quests.ini");
                XmlFile Quests = new XmlFile(AppDir + "\\Data\\Quests.ini");
                if (QuestTree.SelectedNode.Name == "PT1" || QuestTree.SelectedNode == QuestTree.Nodes[0])
                {
                    int TotalObjectives = 0;
                    CurrentWSG.TotalPT1Quests = CurrentWSG.TotalPT1Quests + 1;
                    ResizeArrayLarger(ref CurrentWSG.PT1Strings, CurrentWSG.TotalPT1Quests);
                    ResizeArrayLarger(ref CurrentWSG.PT1Values, CurrentWSG.TotalPT1Quests, 9);
                    ResizeArrayLarger(ref CurrentWSG.PT1Subfolders, CurrentWSG.TotalPT1Quests, 5);
                    CurrentWSG.PT1Strings[CurrentWSG.TotalPT1Quests - 1] = Quests.stListSectionNames()[SelectedItem];
                    CurrentWSG.PT1Values[CurrentWSG.TotalPT1Quests - 1, 0] = 1;
                    for (int Progress = 0; Progress < 5; Progress++)
                        if (Quests.XmlReadValue(Quests.stListSectionNames()[SelectedItem], "Objectives" + Progress) == "") break;
                        else TotalObjectives = Progress + 1;
                    CurrentWSG.PT1Values[CurrentWSG.TotalPT1Quests - 1, 3] = TotalObjectives;
                    for (int Progress = 0; Progress < 5; Progress++)
                        CurrentWSG.PT1Subfolders[CurrentWSG.TotalPT1Quests - 1, Progress] = "None";

                    DoQuestTree();
                    QuestTree.SelectedNode = QuestTree.Nodes[0].Nodes[CurrentWSG.TotalPT1Quests - 1];
                }
                if (QuestTree.SelectedNode.Name == "PT2" || QuestTree.SelectedNode.Text == "Playthrough 2 Quests")
                {
                    int TotalObjectives = 0;
                    CurrentWSG.TotalPT2Quests = CurrentWSG.TotalPT2Quests + 1;
                    ResizeArrayLarger(ref CurrentWSG.PT2Strings, CurrentWSG.TotalPT2Quests);
                    ResizeArrayLarger(ref CurrentWSG.PT2Values, CurrentWSG.TotalPT2Quests, 9);
                    ResizeArrayLarger(ref CurrentWSG.PT2Subfolders, CurrentWSG.TotalPT2Quests, 5);
                    CurrentWSG.PT2Strings[CurrentWSG.TotalPT2Quests - 1] = Quests.stListSectionNames()[SelectedItem];
                    CurrentWSG.PT2Values[CurrentWSG.TotalPT2Quests - 1, 0] = 1;
                    for (int Progress = 0; Progress < 5; Progress++)
                        if (Quests.XmlReadValue(Quests.stListSectionNames()[SelectedItem], "Objectives[" + Progress + "]") == "") break;
                        else TotalObjectives = Progress + 1;
                    CurrentWSG.PT2Values[CurrentWSG.TotalPT2Quests - 1, 3] = TotalObjectives;
                    for (int Progress = 0; Progress < 5; Progress++)
                        CurrentWSG.PT2Subfolders[CurrentWSG.TotalPT2Quests - 1, Progress] = "None";

                    DoQuestTree();
                    QuestTree.SelectedNode = QuestTree.Nodes[1].Nodes[CurrentWSG.TotalPT2Quests - 1];
                }
            }
            catch { }
        }
        private void LocationsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {

                XmlFile Locations = new XmlFile(AppDir + "\\Data\\Locations.ini");
                int SelectedItem = LocationsList.SelectedIndex;
                CurrentWSG.TotalLocations = CurrentWSG.TotalLocations + 1;
                ResizeArrayLarger(ref CurrentWSG.LocationStrings, CurrentWSG.TotalLocations);
                CurrentWSG.LocationStrings[CurrentWSG.TotalLocations - 1] = Locations.stListSectionNames()[SelectedItem];
                DoLocationTree();

            }
            catch { }
        }
        private void InsertItemsFromXml_Click(object sender, EventArgs e)
        {
            OpenFileDialog tempImport = new OpenFileDialog();
            tempImport.DefaultExt = "*.xml";
            tempImport.Filter = "WillowTree Locker(*.xml)|*.xml";

            tempImport.FileName = CurrentWSG.CharacterName + "'s Items.xml";
            if (tempImport.ShowDialog() == DialogResult.OK)
            {
                //Ini.IniFile ImportWTL = new Ini.IniFile(tempImport.FileName);
                XmlFile ImportWTL = new XmlFile(tempImport.FileName);
                if (IsDLCItemMode)
                {

                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Item").Count; Progress++)
                    {
                        CurrentWSG.DLC.ItemParts.Add(new List<string>());

                        for (int ProgressStrings = 0; ProgressStrings < 9; ProgressStrings++)
                            CurrentWSG.DLC.ItemParts[CurrentWSG.DLC.ItemParts.Count - 1].Add(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Part" + (ProgressStrings + 1)));

                        CurrentWSG.DLC.ItemQuantity.Add(1);
                        CurrentWSG.DLC.ItemQuality.Add(0);
                        CurrentWSG.DLC.ItemLevel.Add(0);
                        CurrentWSG.DLC.ItemEquipped.Add(0);
                        CurrentWSG.DLC.TotalItems++;
                    }
                    DoDLCItemTree();
                }

                else
                {
                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Item").Count; Progress++)
                    {
                        List<string> itemstrings = new List<string>();
                        List<int> itemvalues = new List<int>();

                        try
                        {
                            for (int ProgressStrings = 0; ProgressStrings < 9; ProgressStrings++)
                            {
                                string part = ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Part" + (ProgressStrings + 1));
                                ThrowExceptionIfIntString(part);
                                itemstrings.Add(part);
                            }

                            itemvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "RemAmmo_Quantity"),0));
                            itemvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Quality"),0));
                            itemvalues.Add(0); // set equipped slot to 0
                            itemvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Item")[Progress], "Level"),0));
                        }
                        catch
                        {
                            MessageBox.Show("Error reading XML file.  Some items were not read.");
                            break;
                        }

                        CurrentWSG.ItemStrings.Add(itemstrings);
                        CurrentWSG.ItemValues.Add(itemvalues);
                        CurrentWSG.NumberOfItems++;
                    }
                    DoItemTree();
                }
            }
        }
        private void ImportWeaponsFromXml_Click(object sender, EventArgs e)
        {
            OpenFileDialog tempImport = new OpenFileDialog();
            tempImport.DefaultExt = "*.xml";
            tempImport.Filter = "WillowTree Locker(*.xml)|*.xml";

            tempImport.FileName = CurrentWSG.CharacterName + "'s Weapons.xml";
            if (tempImport.ShowDialog() == DialogResult.OK)
            {
                //Ini.IniFile ImportWTL = new Ini.IniFile(tempImport.FileName);
                XmlFile ImportWTL = new XmlFile(tempImport.FileName);
                if (IsDLCWeaponMode)
                {

                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Weapon").Count; Progress++)
                    {
                        CurrentWSG.DLC.WeaponParts.Add(new List<string>());
                        for (int ProgressStrings = 0; ProgressStrings < 14; ProgressStrings++)
                            CurrentWSG.DLC.WeaponParts[CurrentWSG.DLC.WeaponParts.Count - 1].Add(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Part" + (ProgressStrings + 1)));

                        CurrentWSG.DLC.WeaponAmmo.Add(0);
                        CurrentWSG.DLC.WeaponQuality.Add(0);
                        CurrentWSG.DLC.WeaponLevel.Add(0);
                        CurrentWSG.DLC.WeaponEquippedSlot.Add(0);
                        CurrentWSG.DLC.TotalWeapons++;
                    }
                    DoDLCWeaponTree();
                }

                else
                {
                    for (int Progress = 0; Progress < ImportWTL.stListSectionNames("Weapon").Count; Progress++)
                    {
                        List<String> wpnstrings = new List<string>();
                        List<int> wpnvalues = new List<int>();
                        try
                        {
                            for (int ProgressStrings = 0; ProgressStrings < 14; ProgressStrings++)
                            {
                                string part = ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Part" + (ProgressStrings + 1));
                                ThrowExceptionIfIntString(part);
                                wpnstrings.Add(part);
                            }

                            wpnvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "RemAmmo_Quantity"),0));
                            wpnvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Quality"),0));
                            wpnvalues.Add(0); // set equipped slot to 0
                            wpnvalues.Add(Int32FromString(ImportWTL.XmlReadValue(ImportWTL.stListSectionNames("Weapon")[Progress], "Level"),0));
                        }
                        catch
                        {
                            MessageBox.Show("Error reading XML file.  Skipping item.");
                            continue;
                        }

                        CurrentWSG.WeaponStrings.Add(wpnstrings);
                        CurrentWSG.WeaponValues.Add(wpnvalues);
                        CurrentWSG.NumberOfWeapons++;
                    }

                    DoWeaponTree();
                }
            }
        }
        private void ImportSkills_Click(object sender, EventArgs e)
        {
            OpenFileDialog tempImport = new OpenFileDialog();
            tempImport.DefaultExt = "*.skills";
            tempImport.Filter = "Skills Data(*.skills)|*.skills";

            tempImport.FileName = CurrentWSG.CharacterName + "'s Skills.skills";
            if (tempImport.ShowDialog() == DialogResult.OK)
            {

                //Ini.IniFile ImportSkills = new Ini.IniFile(tempImport.FileName);
                XmlFile ImportSkills = new XmlFile(tempImport.FileName);
                string[] TempSkillNames = new string[ImportSkills.stListSectionNames().Count];
                int[] TempSkillLevels = new int[ImportSkills.stListSectionNames().Count];
                int[] TempSkillExp = new int[ImportSkills.stListSectionNames().Count];
                int[] TempSkillInUse = new int[ImportSkills.stListSectionNames().Count];
                for (int Progress = 0; Progress < ImportSkills.stListSectionNames().Count; Progress++)
                {
                    TempSkillNames[Progress] = ImportSkills.stListSectionNames()[Progress];
                    TempSkillLevels[Progress] = Convert.ToInt32(ImportSkills.XmlReadValue(ImportSkills.stListSectionNames()[Progress], "Level"));
                    TempSkillExp[Progress] = Convert.ToInt32(ImportSkills.XmlReadValue(ImportSkills.stListSectionNames()[Progress], "Experience"));
                    TempSkillInUse[Progress] = Convert.ToInt32(ImportSkills.XmlReadValue(ImportSkills.stListSectionNames()[Progress], "InUse"));
                }
                CurrentWSG.SkillNames = TempSkillNames;
                CurrentWSG.LevelOfSkills = TempSkillLevels;
                CurrentWSG.ExpOfSkills = TempSkillExp;
                CurrentWSG.InUse = TempSkillInUse;
                CurrentWSG.NumberOfSkills = ImportSkills.stListSectionNames().Count;
                DoSkillTree();
            }
        }
        private void ImportQuests_Click(object sender, EventArgs e)
        {
            try
            {
                if (QuestTree.SelectedNode.Name == "PT2")
                {
                    OpenFileDialog tempImport = new OpenFileDialog();
                    tempImport.DefaultExt = "*.quests";
                    tempImport.Filter = "Quest Data(*.quests)|*.quests";

                    tempImport.FileName = CurrentWSG.CharacterName + "'s PT2 Quests.quests";
                    if (tempImport.ShowDialog() == DialogResult.OK)
                    {
                        //Ini.IniFile ImportQuests = new Ini.IniFile(tempImport.FileName);
                        XmlFile ImportQuests = new XmlFile(tempImport.FileName);
                        string[] TempQuestStrings = new string[ImportQuests.stListSectionNames().Count];
                        int[,] TempQuestValues = new int[ImportQuests.stListSectionNames().Count, 10];
                        string[,] TempQuestSubfolders = new string[ImportQuests.stListSectionNames().Count, 7];
                        for (int Progress = 0; Progress < ImportQuests.stListSectionNames().Count; Progress++)
                        {
                            TempQuestStrings[Progress] = ImportQuests.stListSectionNames()[Progress];
                            TempQuestValues[Progress, 0] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Progress"));
                            TempQuestValues[Progress, 1] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue1"));
                            TempQuestValues[Progress, 2] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue2"));
                            TempQuestValues[Progress, 3] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Objectives"));
                            for (int Folders = 0; Folders < TempQuestValues[Progress, 3]; Folders++)
                            {
                                TempQuestValues[Progress, Folders + 4] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderValue" + Folders));
                                TempQuestSubfolders[Progress, Folders] = ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderName" + Folders);
                            }
                        }
                        CurrentWSG.PT2Strings = TempQuestStrings;
                        CurrentWSG.PT2Values = TempQuestValues;
                        CurrentWSG.PT2Subfolders = TempQuestSubfolders;
                        CurrentWSG.TotalPT2Quests = ImportQuests.stListSectionNames().Count;
                        DoQuestTree();
                    }
                }
                else if (QuestTree.SelectedNode.Name == "PT1")
                {
                    OpenFileDialog tempImport = new OpenFileDialog();
                    tempImport.DefaultExt = "*.quests";
                    tempImport.Filter = "Quest Data(*.quests)|*.quests";

                    tempImport.FileName = CurrentWSG.CharacterName + "'s PT1 Quests.quests";
                    if (tempImport.ShowDialog() == DialogResult.OK)
                    {
                        XmlFile ImportQuests = new XmlFile(tempImport.FileName);
                        string[] TempQuestStrings = new string[ImportQuests.stListSectionNames().Count];
                        int[,] TempQuestValues = new int[ImportQuests.stListSectionNames().Count, 10];
                        string[,] TempQuestSubfolders = new string[ImportQuests.stListSectionNames().Count, 7];
                        for (int Progress = 0; Progress < ImportQuests.stListSectionNames().Count; Progress++)
                        {
                            TempQuestStrings[Progress] = ImportQuests.stListSectionNames()[Progress];
                            TempQuestValues[Progress, 0] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Progress"));
                            TempQuestValues[Progress, 1] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue1"));
                            TempQuestValues[Progress, 2] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "DLCValue2"));
                            TempQuestValues[Progress, 3] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "Objectives"));
                            for (int Folders = 0; Folders < TempQuestValues[Progress, 3]; Folders++)
                            {
                                TempQuestValues[Progress, Folders + 4] = Convert.ToInt32(ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderValue" + Folders));
                                TempQuestSubfolders[Progress, Folders] = ImportQuests.XmlReadValue(ImportQuests.stListSectionNames()[Progress], "FolderName" + Folders);
                            }
                        }
                        CurrentWSG.PT1Strings = TempQuestStrings;
                        CurrentWSG.PT1Values = TempQuestValues;
                        CurrentWSG.PT1Subfolders = TempQuestSubfolders;
                        CurrentWSG.TotalPT1Quests = ImportQuests.stListSectionNames().Count;
                        DoQuestTree();
                    }
                }
            }
            catch { MessageBox.Show("Select a playthrough to replace first."); }
        }
        private void ImportEchoes_Click(object sender, EventArgs e)
        {
            //try
            //{
            if (EchoTree.SelectedNode == null)
            {
                MessageBox.Show("Select a playthrough to import first.");
                return;
            }
            OpenFileDialog tempImport = new OpenFileDialog();
            if (EchoTree.SelectedNode.Name == "PT2" || EchoTree.SelectedNode.Text == "Playthrough 2 Echo Logs")
            {

                tempImport.DefaultExt = "*.echologs";
                tempImport.Filter = "Echo Logs(*.echologs)|*.echologs";

                tempImport.FileName = CurrentWSG.CharacterName + "'s PT2 Echo Logs.echologs";
                if (tempImport.ShowDialog() == DialogResult.OK)
                {
                    if (EchoTree.SelectedNode.Name == "PT2" || EchoTree.SelectedNode.Text == "Playthrough 2 Echo Logs")
                    {
                        //Ini.IniFile ImportLogs = new Ini.IniFile(tempImport.FileName);
                        XmlFile ImportLogs = new XmlFile(tempImport.FileName);
                        string[] TempEchoStrings = new string[ImportLogs.stListSectionNames().Count];
                        int[,] TempEchoValues = new int[ImportLogs.stListSectionNames().Count, 10];
                        for (int Progress = 0; Progress < ImportLogs.stListSectionNames().Count; Progress++)
                        {
                            TempEchoStrings[Progress] = ImportLogs.stListSectionNames()[Progress];
                            TempEchoValues[Progress, 0] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue1"));
                            TempEchoValues[Progress, 1] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue2"));

                        }
                        CurrentWSG.EchoStringsPT2 = TempEchoStrings;
                        CurrentWSG.EchoValuesPT2 = TempEchoValues;
                        CurrentWSG.NumberOfEchosPT2 = ImportLogs.stListSectionNames().Count;
                        DoEchoTree();
                    }
                }
            }
            else if (EchoTree.SelectedNode.Name == "PT1" || EchoTree.SelectedNode.Text == "Playthrough 1 Echo Logs")
            {
                tempImport.DefaultExt = "*.echologs";
                tempImport.Filter = "Echo Logs(*.echologs)|*.echologs";

                tempImport.FileName = CurrentWSG.CharacterName + "'s PT1 Echo Logs.echologs";

                if (tempImport.ShowDialog() == DialogResult.OK)
                {
                    //Ini.IniFile ImportLogs = new Ini.IniFile(tempImport.FileName);
                    XmlFile ImportLogs = new XmlFile(tempImport.FileName);
                    string[] TempEchoStrings = new string[ImportLogs.stListSectionNames().Count];
                    int[,] TempEchoValues = new int[ImportLogs.stListSectionNames().Count, 10];
                    for (int Progress = 0; Progress < ImportLogs.stListSectionNames().Count; Progress++)
                    {
                        TempEchoStrings[Progress] = ImportLogs.stListSectionNames()[Progress];
                        TempEchoValues[Progress, 0] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue1"));
                        TempEchoValues[Progress, 1] = Convert.ToInt32(ImportLogs.XmlReadValue(ImportLogs.stListSectionNames()[Progress], "DLCValue2"));

                    }
                    CurrentWSG.EchoStrings = TempEchoStrings;
                    CurrentWSG.EchoValues = TempEchoValues;
                    CurrentWSG.NumberOfEchos = ImportLogs.stListSectionNames().Count;
                    DoEchoTree();
                }

            }

            try
            {
            }
            catch { MessageBox.Show("Select a playthrough to import first."); }
        }
 public void DoLocationsList()
 {
     LocationsList.Items.Clear();
     CurrentLocation.Items.Clear();
     //Ini.IniFile Locations = new Ini.IniFile(AppDir + "\\Data\\Locations.ini");
     XmlFile Locations = new XmlFile(AppDir + "\\Data\\Locations.ini");
     foreach (string section in Locations.stListSectionNames())
     {
         string outpostname = Locations.XmlReadValue(section, "OutpostDisplayName");
         LocationsList.Items.Add(outpostname);
         CurrentLocation.Items.Add(outpostname);
     }
 }
        private void EchoList_Click(object sender, EventArgs e)
        {
            XmlFile Echoes = new XmlFile(AppDir + "\\Data\\Echos.ini");
            if (EchoTree.SelectedNode.Name == "PT1" || EchoTree.SelectedNode.Text == "Playthrough 1 Echo Logs")
            {

                if (CheckIfNull(CurrentWSG.EchoStrings) == true)
                {
                    CurrentWSG.EchoStrings = new string[1];
                    CurrentWSG.EchoStrings[0] = Echoes.stListSectionNames()[EchoList.SelectedIndex];
                    CurrentWSG.EchoValues = new int[1, 2];
                    CurrentWSG.NumberOfEchos = 1;
                }
                else
                {
                    CurrentWSG.NumberOfEchos = CurrentWSG.NumberOfEchos + 1;
                    ResizeArrayLarger(ref CurrentWSG.EchoStrings, CurrentWSG.NumberOfEchos);
                    ResizeArrayLarger(ref CurrentWSG.EchoValues, CurrentWSG.NumberOfEchos, 2);
                    CurrentWSG.EchoStrings[CurrentWSG.NumberOfEchos - 1] = Echoes.stListSectionNames()[EchoList.SelectedIndex];

                }
                DoEchoTree();
                EchoTree.Nodes[0].Expand();
                EchoTree.SelectedNode = EchoTree.Nodes[0];
            }
            else if (EchoTree.SelectedNode.Name == "PT2" || EchoTree.SelectedNode.Text == "Playthrough 2 Echo Logs")
            {

                if (CheckIfNull(CurrentWSG.EchoStringsPT2) == true)
                {
                    if (CurrentWSG.TotalPT2Quests > 1)
                    {
                        CurrentWSG.EchoStringsPT2 = new string[1];
                        CurrentWSG.EchoStringsPT2[0] = Echoes.stListSectionNames()[EchoList.SelectedIndex];
                        CurrentWSG.EchoValuesPT2 = new int[1, 2];
                        CurrentWSG.NumberOfEchosPT2 = 1;
                    }
                    else
                        MessageBox.Show("You must have more than just the default quest.");
                }
                else
                {
                    CurrentWSG.NumberOfEchosPT2 = CurrentWSG.NumberOfEchosPT2 + 1;
                    ResizeArrayLarger(ref CurrentWSG.EchoStringsPT2, CurrentWSG.NumberOfEchosPT2);
                    ResizeArrayLarger(ref CurrentWSG.EchoValuesPT2, CurrentWSG.NumberOfEchosPT2, 2);
                    CurrentWSG.EchoStringsPT2[CurrentWSG.NumberOfEchosPT2 - 1] = Echoes.stListSectionNames()[EchoList.SelectedIndex];

                }
                DoEchoTree();
                EchoTree.Nodes[1].Expand();
                EchoTree.SelectedNode = EchoTree.Nodes[1];
            }
            //try
            //{ }
            //catch { MessageBox.Show("Could not add new echo log"); }
        }
        public void DoEchoList()
        {
            //Ini.IniFile PartList = new Ini.IniFile(AppDir + "\\Data\\Echos.ini");
            XmlFile PartList = new XmlFile(AppDir + "\\Data\\Echos.ini");

            foreach (string section in PartList.stListSectionNames())
            {
                string name = PartList.XmlReadValue(section, "Subject");
                if (name != "")
                    EchoList.Items.Add(name);
                else
                    EchoList.Items.Add(section);
            }

            //for (int Progress = 0; Progress < PartList.stListSectionNames().Count; Progress++)
            //{
            //    string name = PartList.XmlReadValue(PartList.stListSectionNames()[Progress], "Subject");
            //    if (name != "")
            //        EchoList.Items.Add(name);
            //    else EchoList.Items.Add(PartList.stListSectionNames()[Progress]);
            //}
        }
 public void DoSkillList()
 {
     SkillList.Items.Clear();
     if ((string)Class.SelectedItem == "Soldier")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_skills2_Roland.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_skills2_Roland.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else if ((string)Class.SelectedItem == "Siren")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_Skills2_Lilith.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_Skills2_Lilith.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else if ((string)Class.SelectedItem == "Hunter")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_skills2_Mordecai.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_skills2_Mordecai.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else if ((string)Class.SelectedItem == "Berserker")
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_Skills2_Brick.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_Skills2_Brick.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
     else
     {
         //Ini.IniFile SkillINI = new Ini.IniFile(AppDir + "\\Data\\gd_skills_common.txt");
         XmlFile SkillXML = new XmlFile(AppDir + "\\Data\\gd_skills_common.txt");
         foreach (string section in SkillXML.stListSectionNames())
             SkillList.Items.Add((string)SkillXML.XmlReadValue(section, "SkillName"));
     }
 }
        public void DoQuestList()
        {
            XmlFile PartList = new XmlFile(AppDir + "\\Data\\Quests.ini");

            foreach (string section in PartList.stListSectionNames())
                QuestList.Items.Add(PartList.XmlReadValue(section, "MissionName"));

            //Ini.IniFile PartList = new Ini.IniFile(AppDir + "\\Data\\Quests.ini");
            //for (int Progress = 0; Progress < PartList.ListSectionNames().Length; Progress++)
            //    QuestList.Items.Add(PartList.IniReadValue(PartList.ListSectionNames()[Progress], "MissionName"));
        }
        public void DoPartsCategory(string Category, AdvTree Tree)
        {
            //Ini.IniFile PartList = new Ini.IniFile(AppDir + "\\Data\\" + Category + ".txt");
            XmlFile PartList = new XmlFile(AppDir + "\\Data\\" + Category + ".txt");

            Node TempNode = new Node();
            TempNode.Name = Category;
            TempNode.Text = Category;
            //TempNode.Style.ApplyStyle(elementStyle16);
            foreach (string section in PartList.stListSectionNames())
            {
                Node Part = new Node();
                Part.Name = section;
                Part.Text = section;
                TempNode.Nodes.Add(Part);

            }
            Tree.Nodes.Add(TempNode);
        }