private void UpdateSounds()
        {
            var s = Program.AnimationXML.Sounds;

            listView4.Items.Clear();
            if (s == null || s.Sound == null)
            {
                return;
            }
            soundsList.Clear();
            listView4.SmallImageList = XmlTools.AnimationIcons;
            int tot = 0;

            foreach (var n in s.Sound)
            {
                soundsList.Add(n.Id);
                var lv = listView4.Items.Add(" Sound #" + n.Id + " - " + XmlTools.GetXmlAnimationNode(n.Id).Name);
                lv.ImageIndex = n.Id;
                tot          += n.Probability;
            }
            if (tot == 0)
            {
                tot = 1;
            }
            int lvindex = 0;

            foreach (var n in s.Sound)
            {
                listView4.Items[lvindex++].Text += " (" + ((int)(n.Probability * 1000 / tot) / 10).ToString() + "%)";
            }
        }
        private void UpdateChilds()
        {
            var c = Program.AnimationXML.Childs;

            listView3.Items.Clear();
            if (c == null || c.Child == null)
            {
                return;
            }
            listView3.SmallImageList = XmlTools.AnimationIcons;
            childsList.Clear();
            foreach (var n in c.Child)
            {
                childsList.Add(n.Id);
                var lv = listView3.Items.Add(" Child #" + n.Id + " - " + XmlTools.GetXmlAnimationNode(n.Id).Name);
                lv.ImageIndex = XmlTools.GetXmlAnimationNode(n.Next).Sequence.Frame[0];
            }
        }
        private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var cms = contextMenuStrip1;
            var lv  = cms.SourceControl as ListView;

            if (lv.SelectedIndices.Count == 0)
            {
                return;
            }
            if (lv == listView1) // spawn
            {
                if (lv.Items.Count <= 1)
                {
                    Program.AddLog("You need at least 1 spawn for your animation!", "Remove Spawn", Program.LOG_TYPE.ERROR, lv);
                }
                else
                {
                    treeView1.SelectedNode = treeView1.Nodes[0].Nodes[2];
                    var node = XmlTools.GetXmlSpawnNode(spawnsList[lv.SelectedIndices[0]]);
                    XmlTools.UpdateXmlSpawnNode(node, null);
                }
            }
            else if (lv == listView2) // animations
            {
                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[3];
                var node = XmlTools.GetXmlAnimationNode(animationsList[lv.SelectedIndices[0]]);
                XmlTools.UpdateXmlAnimationNode(node, null);
            }
            else if (lv == listView3) // childs
            {
                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[4];
                var node = XmlTools.GetXmlChildNode(childsList[lv.SelectedIndices[0]]);
                XmlTools.UpdateXmlChildNode(node, null);
            }
            else if (lv == listView4) // sounds
            {
                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[5];
                var node = XmlTools.GetXmlSoundNode(soundsList[lv.SelectedIndices[0]]);
                XmlTools.UpdateXmlSoundNode(node, null);
            }
            UpdateData();
        }
        private void insertNodeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var cms = contextMenuStrip1;
            var lv  = cms.SourceControl as ListView;

            if (lv == listView1) // spawn
            {
                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[2];
                var node = new XmlData.SpawnNode();
                for (var j = 1; j <= listView1.Items.Count + 2; j++)
                {
                    if (XmlTools.GetXmlSpawnNode(j) == null)
                    {
                        node.Id          = j;
                        node.Next        = new XmlData.NextNode();
                        node.Probability = 10;
                        node.X           = "";
                        node.Y           = "";
                        XmlTools.UpdateXmlSpawnNode(null, node);
                        MainWindow.MainWin.UpdateData();
                        break;
                    }
                }
            }
            else if (lv == listView2) // animations
            {
                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[3];
                var node = new XmlData.AnimationNode();
                for (var j = 1; j <= listView2.Items.Count + 2; j++)
                {
                    if (XmlTools.GetXmlAnimationNode(j) == null)
                    {
                        node.Id   = j;
                        node.Name = "New";
                        XmlTools.UpdateXmlAnimationNode(null, node);
                        MainWindow.MainWin.UpdateData();
                        break;
                    }
                }
            }
            else if (lv == listView3) // childs
            {
                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[4];
                var node = new XmlData.ChildNode();
                for (var j = 1; j <= listView3.Items.Count + 2; j++)
                {
                    if (XmlTools.GetXmlChildNode(j) == null)
                    {
                        node.Id   = j;
                        node.Next = j;
                        XmlTools.UpdateXmlChildNode(null, node);
                        MainWindow.MainWin.UpdateData();
                        break;
                    }
                }
            }
            else if (lv == listView4) // sounds
            {
                treeView1.SelectedNode = treeView1.Nodes[0].Nodes[5];
                var node = new XmlData.SoundNode();
                for (var j = 1; j <= listView4.Items.Count + 2; j++)
                {
                    if (XmlTools.GetXmlSoundNode(j) == null)
                    {
                        node.Id = j;
                        XmlTools.UpdateXmlSoundNode(null, node);
                        MainWindow.MainWin.UpdateData();
                        break;
                    }
                }
            }
        }