コード例 #1
0
        private void CloneFromSaveEchoes_Click(object sender, EventArgs e)
        {
            int index = GetSelectedEchoList();

            if (index == -1)
            {
                MessageBox.Show("Select a single echo list to import to first.");
                return;
            }

            Util.WTOpenFileDialog tempOpen = new Util.WTOpenFileDialog("sav", "");

            if (tempOpen.ShowDialog() == DialogResult.OK)
            {
                WillowSaveGame OtherSave = new WillowSaveGame();

                try
                {
                    OtherSave.LoadWsg(tempOpen.FileName());
                }
                catch { MessageBox.Show("Couldn't open the other save file."); return; }

                if (OtherSave.NumberOfEchoLists - 1 < index)
                {
                    MessageBox.Show("The echo list does not exist in the other savegame file.");
                    return;
                }

                // Replace the old entries in the echo table with the new ones
                CurrentWSG.EchoLists[index] = OtherSave.EchoLists[index];

                WillowSaveGame.EchoTable et = CurrentWSG.EchoLists[index];

                EchoTree.BeginUpdate();
                TreeNodeAdv parent = EchoTree.Root.Children[index];

                // Remove the old entries from the tree view
                TreeNodeAdv[] children = parent.Children.ToArray();
                foreach (TreeNodeAdv child in children)
                {
                    child.Remove();
                }

                // Add the new entries to the tree view
                foreach (WillowSaveGame.EchoEntry ee in et.Echoes)
                {
                    string name = ee.Name;

                    ColoredTextNode node = new ColoredTextNode();
                    node.Tag  = name;
                    node.Text = EchoesXml.XmlReadValue(name, "Subject");
                    if (node.Text == "")
                    {
                        node.Text = "(" + name + ")";
                    }
                    parent.AddNode(node);
                }
                EchoTree.EndUpdate();
            }
        }
コード例 #2
0
        private void RemoveListEchoes_Click(object sender, EventArgs e)
        {
            TreeNodeAdv[] selection = EchoTree.SelectedNodes.ToArray();

            foreach (TreeNodeAdv nodeAdv in selection)
            {
                if (nodeAdv.Parent == EchoTree.Root)
                {
                    CurrentWSG.NumberOfEchoLists--;
                    CurrentWSG.EchoLists.RemoveAt(nodeAdv.Index);
                    EchoTree.Root.Children[nodeAdv.Index].Remove();
                }
            }

            // The indexes will be messed up if a list that is not the last one is
            // removed, so update the tree text, tree indexes, and echo list indices
            int count = CurrentWSG.NumberOfEchoLists;

            for (int index = 0; index < count; index++)
            {
                TreeNodeAdv nodeAdv = EchoTree.Root.Children[index];

                // Adjust the category node's text and tag to reflect its new position
                ColoredTextNode parent = nodeAdv.Data();
                parent.Text = "Playthrough " + (index + 1) + " Echo Logs";
                parent.Tag  = index.ToString();

                // Adjust the echo list index to reflect its new position
                CurrentWSG.EchoLists[index].Index = index;
            }
            EchoTree.EndUpdate();
        }
コード例 #3
0
        private void AddListEchoes_Click(object sender, EventArgs e)
        {
            int index = CurrentWSG.NumberOfEchoLists;

            // Create an empty echo table
            WillowSaveGame.EchoTable et = new WillowSaveGame.EchoTable();
            et.Index       = CurrentWSG.NumberOfEchoLists;
            et.Echoes      = new List <WillowSaveGame.EchoEntry>();
            et.TotalEchoes = 0;

            // Add the new table to the list
            CurrentWSG.EchoLists.Add(et);
            CurrentWSG.NumberOfEchoLists++;

            EchoTree.BeginUpdate();

            //Add the new table to the tree view
            ColoredTextNode categoryNode = new ColoredTextNode();

            categoryNode.Tag  = index.ToString();
            categoryNode.Text = "Playthrough " + (CurrentWSG.EchoLists[index].Index + 1) + " Echo Logs";
            (EchoTree.Model as TreeModel).Nodes.Add(categoryNode);

            EchoTree.EndUpdate();
        }
コード例 #4
0
        public void MergeAllFromXmlEchoes(string filename, int index)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);

            if (doc.SelectSingleNode("WT/Echoes") == null)
            {
                throw new ApplicationException("NoEchoes");
            }

            XmlNodeList echonodes = doc.SelectNodes("WT/Echoes/Echo");

            if (echonodes == null)
            {
                return;
            }

            WillowSaveGame.EchoTable et = CurrentWSG.EchoLists[index];

            EchoTree.BeginUpdate();

            // Copy only the echos that are not duplicates from the XML file
            foreach (XmlNode node in echonodes)
            {
                string name = node.GetElement("Name", "");

                // Make sure the echo is not already in the list
                EchoSearchKey = name;
                if (et.Echoes.FindIndex(EchoSearchByName) != -1)
                {
                    continue;
                }

                // Create a new echo entry an populate it from the node
                WillowSaveGame.EchoEntry ee = new WillowSaveGame.EchoEntry();
                ee.Name      = name;
                ee.DlcValue1 = node.GetElementAsInt("DLCValue1", 0);
                ee.DlcValue2 = node.GetElementAsInt("DLCValue2", 0);

                // Add the echo entry to the echo list
                et.Echoes.Add(ee);
                et.TotalEchoes++;

                // Add the echo to the tree view
                ColoredTextNode treeNode = new ColoredTextNode();
                treeNode.Tag  = name;
                treeNode.Text = EchoesXml.XmlReadValue(name, "Subject");
                if (treeNode.Text == "")
                {
                    treeNode.Text = "(" + name + ")";
                }
                EchoTree.Root.Children[index].AddNode(treeNode);
            }
            EchoTree.EndUpdate();
        }
コード例 #5
0
        private void EchoList_Click(object sender, EventArgs e)
        {
            newToolStripMenuItem1.HideDropDown();

            if (EchoList.SelectedIndex == -1)
            {
                return;
            }

            int index = GetSelectedEchoList();

            if (index == -1)
            {
                MessageBox.Show("Select an echo list first.");
                return;
            }

            string name = EchoesXml.stListSectionNames()[EchoList.SelectedIndex];

            // Create a new echo entry and populate it
            WillowSaveGame.EchoEntry ee = new WillowSaveGame.EchoEntry();
            ee.Name = name;
            // TODO: These values shouldn't always be zero, but the data doesn't
            // exist in the data files yet.  When the proper data is in the data
            // file then it needs to be looked up here.
            ee.DlcValue1 = 0;
            ee.DlcValue2 = 0;

            // Add the new echo to the echo list
            WillowSaveGame.EchoTable et = CurrentWSG.EchoLists[index];
            et.Echoes.Add(ee);
            et.TotalEchoes++;

            // Add the new echo to the echo tree view
            ColoredTextNode treeNode = new ColoredTextNode();

            treeNode.Tag  = name;
            treeNode.Text = EchoesXml.XmlReadValue(name, "Subject");
            if (treeNode.Text == "")
            {
                treeNode.Text = "(" + treeNode.Tag as string + ")";
            }
            TreeNodeAdv parent = EchoTree.Root.Children[index];

            parent.AddNode(treeNode);

            // Select the newly added node so the user will know it was added
            EchoTree.SelectedNode = parent.Children[parent.Children.Count - 1];
            EchoTree.EnsureVisible(EchoTree.SelectedNode);
        }
コード例 #6
0
        public void LoadEchoes(string filename, int index)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);

            if (doc.SelectSingleNode("WT/Echoes") == null)
            {
                throw new ApplicationException("NoEchoes");
            }

            XmlNodeList echonodes = doc.SelectNodes("WT/Echoes/Echo");

            int count = echonodes.Count;

            WillowSaveGame.EchoTable et = CurrentWSG.EchoLists[index];
            et.Echoes.Clear();
            et.TotalEchoes = 0;

            EchoTree.BeginUpdate();

            for (int i = 0; i < count; i++)
            {
                // Create a new echo entry and populate it from the xml node
                WillowSaveGame.EchoEntry ee = new WillowSaveGame.EchoEntry();
                XmlNode node = echonodes[i];
                string  name = node.GetElement("Name", "");
                ee.Name      = name;
                ee.DlcValue1 = node.GetElementAsInt("DLCValue1", 0);
                ee.DlcValue2 = node.GetElementAsInt("DLCValue2", 0);

                // Add the echo to the list
                et.Echoes.Add(ee);
                et.TotalEchoes++;

                // Add the echo to the tree view
                ColoredTextNode treeNode = new ColoredTextNode();
                treeNode.Tag  = name;
                treeNode.Text = EchoesXml.XmlReadValue(name, "Subject");
                if (treeNode.Text == "")
                {
                    treeNode.Text = "(" + name + ")";
                }
                EchoTree.Root.Children[index].AddNode(treeNode);
            }

            EchoTree.EndUpdate();
        }
コード例 #7
0
        public void MergeFromSaveEchoes(string filename, int index)
        {
            WillowSaveGame OtherSave = new WillowSaveGame();

            OtherSave.LoadWsg(filename);

            if (OtherSave.NumberOfEchoLists - 1 < index)
            {
                return;
            }

            WillowSaveGame.EchoTable etOther = OtherSave.EchoLists[index];
            WillowSaveGame.EchoTable et      = CurrentWSG.EchoLists[index];

            EchoTree.BeginUpdate();

            // Copy only the locations that are not duplicates from the other save
            foreach (WillowSaveGame.EchoEntry ee in CurrentWSG.EchoLists[index].Echoes)
            {
                string name = ee.Name;

                // Make sure the echo is not already in the list
                EchoSearchKey = name;
                if (et.Echoes.FindIndex(EchoSearchByName) != -1)
                {
                    continue;
                }

                // Add the echo entry to the echo list
                et.Echoes.Add(ee);
                et.TotalEchoes++;

                // Add the echo to the tree view
                ColoredTextNode treeNode = new ColoredTextNode();
                treeNode.Tag  = name;
                treeNode.Text = EchoesXml.XmlReadValue(name, "Subject");
                if (treeNode.Text == "")
                {
                    treeNode.Text = "(" + name + ")";
                }
                EchoTree.Root.Children[index].AddNode(treeNode);
            }
            EchoTree.EndUpdate();
        }
コード例 #8
0
        public void DoEchoTree()
        {
            EchoTree.BeginUpdate();
            TreeModel model = new TreeModel();

            EchoTree.Model = model;

            for (int i = 0; i < CurrentWSG.NumberOfEchoLists; i++)
            {
                // Category nodes
                //      Text = human readable category heading
                //      Tag = echo list index stored as a string (0 based)
                ColoredTextNode parent = new ColoredTextNode();
                parent.Tag  = i.ToString();
                parent.Text = "Playthrough " + (CurrentWSG.EchoLists[i].Index + 1) + " Echo Logs";
                model.Nodes.Add(parent);

                for (int build = 0; build < CurrentWSG.EchoLists[i].TotalEchoes; build++)
                {
                    string name = CurrentWSG.EchoLists[i].Echoes[build].Name;

                    // Echo nodes
                    //      Text = human readable echo name
                    //      Tag = internal echo name
                    ColoredTextNode node = new ColoredTextNode();
                    node.Tag  = name;
                    node.Text = EchoesXml.XmlReadValue(name, "Subject");
                    if (node.Text == "")
                    {
                        node.Text = "(" + name + ")";
                    }
                    parent.Nodes.Add(node);
                }
            }
            EchoTree.EndUpdate();
        }