Example #1
0
        private void btnImportNamePlate_Click(object sender, EventArgs e)
        {
            if (openNamePlateDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //Open the file, load into the image place if it works, update the kart
                Image img = Bitmap.FromFile(openNamePlateDialog.FileName);
                if (img.Width != 64 || img.Height != 12)
                {
                    MessageBox.Show("Image must be 64x12!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (img != null)
                {
                    //Copy the old name plate to make the new one
                    byte[]      imgData = Cereal64.Microcodes.F3DEX.DataElements.TextureConversion.RGBA16ToBinary((Bitmap)img);
                    TKMK00Block tkmk    = new TKMK00Block(-1, Pitstop64.Services.TKMK00.Encode(imgData, img.Width, img.Height, 0), 0);

                    MK64Image image = new MK64Image(tkmk, Path.GetFileNameWithoutExtension(openNamePlateDialog.FileName));

                    Kart.SetNamePlate(image);

                    pbNamePlate.Image = tkmk.Image;
                }
            }
        }