private Bitmap DecodeTexture(string fname) { if (!DecodedTextures.ContainsKey(fname)) { DecodedTextures.Add(fname, TextureDecoder.ConvertRTPACKFile(halfpath + @"\game\" + fname)); } return(DecodedTextures[fname]); }
private async void button1_Click(object sender, EventArgs e) { var selectedItem = await OpenItemSelector(); if (selectedItem == null) { blockIDbutton.Text = "any"; return; } var sourceImage = TextureDecoder.ConvertRTPACKFile(gamepath + @"\game\" + selectedItem.Texture); blockIDbutton.Image = sourceImage.Clone( new Rectangle(selectedItem.TextureRealX * 32, selectedItem.TextureRealY * 32, 32, 32), sourceImage.PixelFormat); settings.User.BlockID = (short)selectedItem.ItemID; blockIDbutton.Text = ""; }