private void B_ImportCGB_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog { Filter = CGearBackground.Filter + "|PokeStock C-Gear Skin|*.psk" }; if (ofd.ShowDialog() != DialogResult.OK) { return; } var len = new FileInfo(ofd.FileName).Length; if (len != CGearBackground.SIZE_CGB) { WinFormsUtil.Error($"Incorrect size, got {len} bytes, expected {CGearBackground.SIZE_CGB} bytes."); return; } byte[] data = File.ReadAllBytes(ofd.FileName); if (!CGearBackground.getIsCGB(data)) { bool B2W2 = data[0x2000] != 0x00; data = CGearBackground.PSKtoCGB(data, B2W2); } bg = new CGearBackground(data); PB_Background.Image = bg.GetImage(); }
public SAV_CGearSkin() { InitializeComponent(); SAV = (SAV5)Main.SAV.Clone(); bool cgearPresent = SAV.Data[SAV.CGearInfoOffset + 0x26] == 1; bg = new CGearBackground(cgearPresent ? CGearBackground.PSKtoCGB(SAV.Data.Skip(SAV.CGearDataOffset).Take(CGearBackground.SIZE_CGB).ToArray(), SAV.B2W2) : new byte[CGearBackground.SIZE_CGB]); PB_Background.Image = bg.GetImage(); }
public SAV_CGearSkin() { InitializeComponent(); SAV = (SAV5)Main.SAV.Clone(); bool cgearPresent = SAV.Data[SAV.CGearInfoOffset + 0x26] == 1; bg = new CGearBackground(cgearPresent ? CGearBackground.PSKtoCGB(SAV.Data.Skip(SAV.CGearDataOffset).Take(CGearBackground.SIZE_CGB).ToArray(), SAV.B2W2) : new byte[CGearBackground.SIZE_CGB]); PB_Background.Image = bg.GetImage(); WinFormsUtil.Alert("Editor is incomplete.", "No guarantee of functionality."); }