예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ItemField Field;
            int ItemIndex;

            if (listBoxItems.Items.Count > 0)
            {
                Field = (ItemField)listBoxItems.Items[listBoxItems.Items.Count - 1];
                ItemIndex = Field.ItemCode + 1;
            }
            else
            {
                ItemIndex = listBoxCategory.SelectedIndex * 512;
            }

            MuDef.MUFile_ItemGlow Item = new MuDef.MUFile_ItemGlow();

            Item.ItemCode = (ushort)ItemIndex;
            Item.R = 0;
            Item.G = 0;
            Item.B = 0;

            //swap items info
            object[] NewItems = new object[m_Items.Length + 1];
            m_Items.CopyTo(NewItems, 0);
            NewItems[m_Items.Length] = Item;
            m_Items = NewItems;

            updateItemList();
            listBoxItems.SelectedIndex = listBoxItems.Items.Count - 1; //jump to new item
        }
예제 #2
0
        public override void SaveAsBmd(string OutputPath, object[] items)
        {
            try
            {
                FileStream OutputStream = File.Open(OutputPath, FileMode.Create, FileAccess.Write);
                int nSizeOfItem = Marshal.SizeOf(typeof(MuDef.MUFile_ItemGlow));
                MuDef.MUFile_ItemGlow CurrentItem = new MuDef.MUFile_ItemGlow();
                object[] cur_group;
                byte[] FileBuffer = new byte[nSizeOfItem * items.Length];

                for (int n = 0; n < items.Length; n++)
                {
                    if (items[n] == null)
                    {
                        continue;
                    }
                    CurrentItem = ((MuDef.MUFile_ItemGlow)(items[n]));
                    byte[] buf = StructureToByteArray(items[n]);
                    XorFilter(ref buf, Marshal.SizeOf(typeof(MuDef.MUFile_ItemGlow)));
                    buf.CopyTo(FileBuffer, n * nSizeOfItem);
                }

                OutputStream.Write(BitConverter.GetBytes(items.Length), 0, 4);
                OutputStream.Write(FileBuffer, 0, items.Length * nSizeOfItem);
               
                OutputStream.Flush();
                OutputStream.Close();
            }
            catch { MessageBox.Show("Failed to save file"); }
        }