PKHeX.SAV_SecretBase.B_SAV2FAV C# (CSharp) Method

B_SAV2FAV() private method

private B_SAV2FAV ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void B_SAV2FAV(object sender, EventArgs e)
        {
            loading = true;
            int index = LB_Favorite.SelectedIndex;
            if (index < 0) return;
            int offset = fav_offset + 0x5400 + 0x25A;

            // Base Offset Changing
            if (index == 0) offset = fav_offset + 0x5400 + 0x326;
            else offset += 0x3E0 * index;

            string TrainerName = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + offset + 0x218, 0x1A));
            TB_FOT.Text = TrainerName;

            TB_FT1.Text = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + offset + 0x232 + 0x22 * 0, 0x22));
            TB_FT2.Text = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + offset + 0x232 + 0x22 * 1, 0x22));

            string saying1 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + offset + 0x276 + 0x22 * 0, 0x22));
            string saying2 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + offset + 0x276 + 0x22 * 1, 0x22));
            string saying3 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + offset + 0x276 + 0x22 * 2, 0x22));
            string saying4 = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + offset + 0x276 + 0x22 * 3, 0x22));

            int baseloc = BitConverter.ToInt16(sav, sv + offset);
            NUD_FBaseLocation.Value = baseloc;

            TB_FSay1.Text = saying1; TB_FSay2.Text = saying2; TB_FSay3.Text = saying3; TB_FSay4.Text = saying4;

            // Gather data for Object Array
            objdata = new byte[25, 12];
            for (int i = 0; i < 25; i++)
                for (int z = 0; z < 12; z++)
                    objdata[i, z] = sav[sv + offset + 2 + 12 * i + z];
            NUD_FObject.Value = 1; // Trigger Update
            changeObjectIndex(null, null);

            GB_PKM.Enabled = (index > 0);

            // Trainer Pokemon
            pkmdata = new byte[3, 0x34];
            if (index > 0) 
                for (int i = 0; i < 3; i++)
                    for (int z = 0; z < 0x34; z++)
                        pkmdata[i, z] = sav[sv + offset + 0x32E + 0x34 * i + z];

            NUD_FPKM.Value = 1;
            changeFavPKM(null, null); // Trigger Update

            loading = false;
        }
        private byte[,] objdata;