private void Read_data() { System.IO.FileStream saveFile; saveFile = new FileStream(savegamename.Text, FileMode.Open); if (saveFile.Length != 0x65600 && saveFile.Length != 0x76000 ){ savegamename.Text = ""; MessageBox.Show("Invalid file length", "Error"); return; } if (saveFile.Length == 0x65600){ game = 1; currgame.Text = "X/Y"; ReadWholeArray(saveFile, savebuffer_XY); //Now get link data savebuffer_XY.Skip(0x1FFFF).Take(0xA47).ToArray().CopyTo(linkbuffer, 0); pokemonlink = new PL6(linkbuffer); saveFile.Close(); }else if (saveFile.Length == 0x76000){ game = 2; currgame.Text = "OR/AS"; ReadWholeArray(saveFile, savebuffer_ORAS); savebuffer_ORAS.Skip(0x20FFF).Take(0xA47).ToArray().CopyTo(linkbuffer, 0); pokemonlink = new PL6(linkbuffer); saveFile.Close(); } }
void Load_pl6Click(object sender, EventArgs e) { OpenFileDialog openFD = new OpenFileDialog(); //openFD.InitialDirectory = "c:\\"; openFD.Filter = "Pokémon Link Data|*.bin|All Files (*.*)|*.*"; if (openFD.ShowDialog() == DialogResult.OK) { #region filename linkfile = openFD.FileName; #endregion System.IO.FileStream saveFile; saveFile = new FileStream(linkfile, FileMode.Open); if (saveFile.Length != 0xA47){ //linkfile = ""; MessageBox.Show("Invalid file length", "Error"); return; } pl6_path.Text = linkfile; byte[] temp = new byte[0xA47]; ReadWholeArray(saveFile, temp); pokemonlink = new PL6(temp); //Load pkmlink to editor linkedit_load(); save_pl6.Enabled = true; } }