private void lstIKTargets_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstIKTargets.SelectedItems.Count > 0)
            {
                this.clickedTab = 3;

                MadScience.Wrappers.RSLTEntry entry = this.rsltFile.rslt.IKTargets[lstIKTargets.SelectedIndices[0]];
                txtBoneName.Text = entry.boneName.ToString("X8");
                txtSlotName.Text = entry.slotName.ToString("X8");
                txtFlags.Text    = "";
                txtFlags.Enabled = false;
                showMatrix(entry.matrix);

                btnCommit.Enabled = true;
            }
        }
        private void btnIKTargetAdd_Click(object sender, EventArgs e)
        {
            MadScience.Wrappers.RSLTEntry iktarget = new MadScience.Wrappers.RSLTEntry();
            ListViewItem item = new ListViewItem();

            item.Text = (lstIKTargets.Items.Count + 1).ToString();
            item.SubItems.Add(iktarget.slotName.ToString("X8"));

            // Setup default matrix
            iktarget.matrix.rc11 = 1f;
            iktarget.matrix.rc22 = 1f;
            iktarget.matrix.rc33 = 1f;

            // Add to list
            this.rsltFile.rslt.IKTargets.Add(iktarget);

            lstIKTargets.Items.Add(item);
        }
        private void btnContainerAdd_Click(object sender, EventArgs e)
        {
            MadScience.Wrappers.RSLTEntry container = new MadScience.Wrappers.RSLTEntry();
            ListViewItem item = new ListViewItem();

            item.Text = (lstContainers.Items.Count + 1).ToString();
            item.SubItems.Add(container.slotName.ToString("X8"));

            // Setup default matrix
            container.matrix.rc11 = 1f;
            container.matrix.rc22 = 1f;
            container.matrix.rc33 = 1f;

            // Add to list
            this.rsltFile.rslt.Containers.Add(container);

            lstContainers.Items.Add(item);
        }
        private void btnRouteAdd_Click(object sender, EventArgs e)
        {
            MadScience.Wrappers.RSLTEntry route = new MadScience.Wrappers.RSLTEntry();
            ListViewItem item = new ListViewItem();

            item.Text = (lstRoutes.Items.Count + 1).ToString();
            item.SubItems.Add(route.slotName.ToString("X8"));

            // Setup default matrix
            route.matrix.rc11 = 1f;
            route.matrix.rc22 = 1f;
            route.matrix.rc33 = 1f;

            // Add to list
            this.rsltFile.rslt.Routes.Add(route);

            lstRoutes.Items.Add(item);
        }
        private void btnCommit_Click(object sender, EventArgs e)
        {
            // Make entry
            MadScience.Wrappers.RSLTEntry entry = new MadScience.Wrappers.RSLTEntry();

            entry.slotName = MadScience.StringHelpers.ParseHex32("0x" + txtSlotName.Text);
            entry.boneName = MadScience.StringHelpers.ParseHex32("0x" + txtBoneName.Text);

            if (!String.IsNullOrEmpty(txtFlags.Text))
            {
                entry.flags = Convert.ToUInt32(txtFlags.Text);
            }

            entry.matrix.rc11 = Convert.ToSingle(txtMatrix11.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc12 = Convert.ToSingle(txtMatrix12.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc13 = Convert.ToSingle(txtMatrix13.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc14 = Convert.ToSingle(txtMatrix14.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc21 = Convert.ToSingle(txtMatrix21.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc22 = Convert.ToSingle(txtMatrix22.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc23 = Convert.ToSingle(txtMatrix23.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc24 = Convert.ToSingle(txtMatrix24.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc31 = Convert.ToSingle(txtMatrix31.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc32 = Convert.ToSingle(txtMatrix32.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc33 = Convert.ToSingle(txtMatrix33.Text, CultureInfo.InvariantCulture);
            entry.matrix.rc34 = Convert.ToSingle(txtMatrix34.Text, CultureInfo.InvariantCulture);

            switch (this.clickedTab)
            {
            case 0:
                if (lstRoutes.SelectedItems.Count > 0)
                {
                    this.rsltFile.rslt.Routes[lstRoutes.SelectedIndices[0]] = entry;
                    lstRoutes.SelectedItems[0].SubItems[1].Text             = txtSlotName.Text;
                }
                break;

            case 1:
                if (lstContainers.SelectedItems.Count > 0)
                {
                    this.rsltFile.rslt.Containers[lstContainers.SelectedIndices[0]] = entry;
                    lstContainers.SelectedItems[0].SubItems[1].Text = txtSlotName.Text;
                }
                break;

            case 2:
                if (lstEffects.SelectedItems.Count > 0)
                {
                    this.rsltFile.rslt.Effects[lstEffects.SelectedIndices[0]] = entry;
                    lstEffects.SelectedItems[0].SubItems[1].Text = txtSlotName.Text;
                }
                break;

            case 3:
                if (lstIKTargets.SelectedItems.Count > 0)
                {
                    this.rsltFile.rslt.IKTargets[lstIKTargets.SelectedIndices[0]] = entry;
                    lstIKTargets.SelectedItems[0].SubItems[1].Text = txtSlotName.Text;
                }
                break;
            }
        }