private void removeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //remove Z-soul
            if (Items.Length > 211)
            {
                itemList.SelectedIndex = 0;
                idbItem[] Reduce = new idbItem[Items.Length - 1];
                Array.Copy(Items, Reduce, Items.Length - 1);

                Items = Reduce;

                itemList.Items.Clear();
                for (int i = 0; i < Items.Length; i++)
                {
                    if (NamesLoaded)
                    {
                        itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)) + "-" + Names.data[Items[i].msgIndexName].Lines[0]);
                    }
                    else
                    {
                        itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)));
                    }
                }
            }
        }
        public void ConstructFromUnknown(ref idbItem[] items)
        {
            List<int> IDs = new List<int>();
            for (int i = 0; i < items.Length; i++)
            {
                if (!IDs.Contains(BitConverter.ToInt32(items[i].Data, 164)))
                    IDs.Add(BitConverter.ToInt32(items[i].Data, 164));

                if (!IDs.Contains(BitConverter.ToInt32(items[i].Data, 388)))
                    IDs.Add(BitConverter.ToInt32(items[i].Data, 388));
            }

            IDs.Sort();

            activations = new Activation[IDs.Count];
            for (int i = 0; i < IDs.Count; i++)
            {
                activations[i].ID = IDs[i];
                activations[i].Description = "Undetermined";
            }
        }
        private void removeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //remove Z-soul
            if (Items.Length > 211)
            {
                itemList.SelectedIndex = 0;
                idbItem[] Reduce = new idbItem[Items.Length - 1];
                Array.Copy(Items, Reduce, Items.Length - 1);

                Items = Reduce;

                itemList.Items.Clear();
                for (int i = 0; i < Items.Length; i++)
                {
                    if (NamesLoaded)
                        itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)) + "-" + Names.data[Items[i].msgIndexName].Lines[0]);
                    else
                        itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)));
                }

            }
        }
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //add/import Z -soul
            //load zss file
            OpenFileDialog browseFile = new OpenFileDialog();
            browseFile.Filter = "Z Soul Share File (*.zss)|*.zss";
            browseFile.Title = "Select the Z-Soul you want to use as a template for the new Z-soul";
            if (browseFile.ShowDialog() == DialogResult.Cancel)
                return;

            byte[] zssfile = File.ReadAllBytes(browseFile.FileName);
            int nameCount = BitConverter.ToInt32(zssfile, 4);
            int DescCount = BitConverter.ToInt32(zssfile, 8);

            //expand the item array

            idbItem[] Expand = new idbItem[Items.Length + 1];
            Array.Copy(Items, Expand, Items.Length);
            Expand[Expand.Length - 1].Data = new byte[640];
            Items = Expand;
            short ID = BitConverter.ToInt16(Items[Items.Length - 2].Data, 0);
            ID++;
            Array.Copy(BitConverter.GetBytes(ID),Items[Items.Length - 1].Data,2);

            //apply Zss data to added z-soul
            Array.Copy(zssfile, 12 + (nameCount * 2) + (DescCount * 2), Items[Items.Length - 1].Data, 2, 638);

            //expand Names msg
            byte[] pass;
            if (NamesLoaded)
            {
                msgData[] Expand2 = new msgData[Names.data.Length + 1];
                Array.Copy(Names.data, Expand2, Names.data.Length);
                Expand2[Expand2.Length - 1].NameID = "talisman_" + Names.data.Length.ToString("000");
                Expand2[Expand2.Length - 1].ID = Names.data.Length;
                if (nameCount > 0)
                {
                    pass = new byte[nameCount * 2];
                    Array.Copy(zssfile, 12, pass, 0, nameCount * 2);
                    Expand2[Expand2.Length - 1].Lines = new string[] { BytetoString(pass) };
                }
                else
                    Expand2[Expand2.Length - 1].Lines = new string[] { "New Name Entry" };

                Array.Copy(BitConverter.GetBytes((short)Expand2[Expand2.Length - 1].ID), 0, Items[Items.Length - 1].Data, 4, 2);
                Names.data = Expand2;
                Items[Items.Length - 1].msgIndexName = FindmsgIndex(ref Names, Names.data[Names.data.Length - 1].ID);

            }

            //expand description msg
            if (DescsLoaded)
            {

                msgData[] Expand3 = new msgData[Descs.data.Length + 1];
                Array.Copy(Descs.data, Expand3, Descs.data.Length);
                Expand3[Expand3.Length - 1].NameID = "talisman_eff_" + Descs.data.Length.ToString("000");
                Expand3[Expand3.Length - 1].ID = Descs.data.Length;
                if (DescCount > 0)
                {
                    pass = new byte[DescCount * 2];
                    Array.Copy(zssfile, 12 + (nameCount * 2), pass, 0, DescCount * 2);
                    Expand3[Expand3.Length - 1].Lines = new string[] { BytetoString(pass) };
                }
                else
                    Expand3[Expand3.Length - 1].Lines = new string[] { "New Description Entry" };

                Array.Copy(BitConverter.GetBytes((short)Expand3[Expand3.Length - 1].ID), 0, Items[Items.Length - 1].Data, 6, 2);
                Descs.data = Expand3;
                Items[Items.Length - 1].msgIndexDesc = FindmsgIndex(ref Descs, Descs.data[Descs.data.Length - 1].ID);

            }

            //loadzss(browseFile.FileName, Items.Length - 1);
            //itemList.SelectedIndex = itemList.Items.Count - 1;
            itemList.Items.Clear();
            for (int i = 0; i < Items.Length; i++)
            {
                if (NamesLoaded)
                    itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)) + "-" + Names.data[Items[i].msgIndexName].Lines[0]);
                else
                    itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)));
            }
        }
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //add/import Z -soul
            //load zss file
            OpenFileDialog browseFile = new OpenFileDialog();

            browseFile.Filter = "Z Soul Share File (*.zss)|*.zss";
            browseFile.Title  = "Select the Z-Soul you want to use as a template for the new Z-soul";
            if (browseFile.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            byte[] zssfile   = File.ReadAllBytes(browseFile.FileName);
            int    nameCount = BitConverter.ToInt32(zssfile, 4);
            int    DescCount = BitConverter.ToInt32(zssfile, 8);

            //expand the item array

            idbItem[] Expand = new idbItem[Items.Length + 1];
            Array.Copy(Items, Expand, Items.Length);
            Expand[Expand.Length - 1].Data = new byte[640];
            Items = Expand;
            short ID = BitConverter.ToInt16(Items[Items.Length - 2].Data, 0);

            ID++;
            Array.Copy(BitConverter.GetBytes(ID), Items[Items.Length - 1].Data, 2);

            //apply Zss data to added z-soul
            Array.Copy(zssfile, 12 + (nameCount * 2) + (DescCount * 2), Items[Items.Length - 1].Data, 2, 638);

            //expand Names msg
            byte[] pass;
            if (NamesLoaded)
            {
                msgData[] Expand2 = new msgData[Names.data.Length + 1];
                Array.Copy(Names.data, Expand2, Names.data.Length);
                Expand2[Expand2.Length - 1].NameID = "talisman_" + Names.data.Length.ToString("000");
                Expand2[Expand2.Length - 1].ID     = Names.data.Length;
                if (nameCount > 0)
                {
                    pass = new byte[nameCount * 2];
                    Array.Copy(zssfile, 12, pass, 0, nameCount * 2);
                    Expand2[Expand2.Length - 1].Lines = new string[] { BytetoString(pass) };
                }
                else
                {
                    Expand2[Expand2.Length - 1].Lines = new string[] { "New Name Entry" }
                };

                Array.Copy(BitConverter.GetBytes((short)Expand2[Expand2.Length - 1].ID), 0, Items[Items.Length - 1].Data, 4, 2);
                Names.data = Expand2;
                Items[Items.Length - 1].msgIndexName = FindmsgIndex(ref Names, Names.data[Names.data.Length - 1].ID);
            }

            //expand description msg
            if (DescsLoaded)
            {
                msgData[] Expand3 = new msgData[Descs.data.Length + 1];
                Array.Copy(Descs.data, Expand3, Descs.data.Length);
                Expand3[Expand3.Length - 1].NameID = "talisman_eff_" + Descs.data.Length.ToString("000");
                Expand3[Expand3.Length - 1].ID     = Descs.data.Length;
                if (DescCount > 0)
                {
                    pass = new byte[DescCount * 2];
                    Array.Copy(zssfile, 12 + (nameCount * 2), pass, 0, DescCount * 2);
                    Expand3[Expand3.Length - 1].Lines = new string[] { BytetoString(pass) };
                }
                else
                {
                    Expand3[Expand3.Length - 1].Lines = new string[] { "New Description Entry" }
                };

                Array.Copy(BitConverter.GetBytes((short)Expand3[Expand3.Length - 1].ID), 0, Items[Items.Length - 1].Data, 6, 2);
                Descs.data = Expand3;
                Items[Items.Length - 1].msgIndexDesc = FindmsgIndex(ref Descs, Descs.data[Descs.data.Length - 1].ID);
            }

            //loadzss(browseFile.FileName, Items.Length - 1);
            //itemList.SelectedIndex = itemList.Items.Count - 1;
            itemList.Items.Clear();
            for (int i = 0; i < Items.Length; i++)
            {
                if (NamesLoaded)
                {
                    itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)) + "-" + Names.data[Items[i].msgIndexName].Lines[0]);
                }
                else
                {
                    itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)));
                }
            }
        }