Пример #1
0
 private void B_AllKeys_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < CLB_KeySystem.Items.Count; i++)
     {
         CLB_KeySystem.SetItemChecked(i, true);
     }
 }
Пример #2
0
        private void SaveMain()
        {
            uint valFly = BitConverter.ToUInt32(SAV.Data, ofsFly);

            for (int i = 0; i < CLB_FlyDest.Items.Count; i++)
            {
                if (FlyDestC[i] < 32)
                {
                    if (CLB_FlyDest.GetItemChecked(i))
                    {
                        valFly |= (uint)1 << FlyDestC[i];
                    }
                    else
                    {
                        valFly &= ~((uint)1 << FlyDestC[i]);
                    }
                }
                else
                {
                    var ofs = ofsFly + (FlyDestC[i] >> 3);
                    SAV.Data[ofs] = (byte)((SAV.Data[ofs] & ~(1 << (FlyDestC[i] & 7))) | ((CLB_FlyDest.GetItemChecked(i) ? 1 : 0) << (FlyDestC[i] & 7)));
                }
            }
            BitConverter.GetBytes(valFly).CopyTo(SAV.Data, ofsFly);

            if (SAV is SAV5BW)
            {
                // Roamer
                for (int i = 0; i < cbr.Length; i++)
                {
                    int c = SAV.Data[ofsRoamer + 0x2E + i];
                    var d = (int)cbr[i].SelectedValue;

                    if (c == d)
                    {
                        continue;
                    }
                    SAV.Data[ofsRoamer + 0x2E + i] = (byte)d;
                    if (c != 1)
                    {
                        continue;
                    }
                    new byte[14].CopyTo(SAV.Data, ofsRoamer + 4 + (i * 0x14));
                    SAV.Data[ofsRoamer + 0x2C + i] = 0;
                }

                // LibertyPass
                if (CHK_LibertyPass.Checked ^ bLibPass)
                {
                    BitConverter.GetBytes(bLibPass ? 0 : valLibPass).CopyTo(SAV.Data, ofsLibPass);
                }
            }
            else if (SAV is SAV5B2W2)
            {
                // KeySystem
                for (int i = 0; i < CLB_KeySystem.Items.Count; i++)
                {
                    if (CLB_KeySystem.GetItemChecked(i) ^ bKS[i])
                    {
                        BitConverter.GetBytes(bKS[i] ? 0 : valKS[i]).CopyTo(SAV.Data, ofsKS + (i << 2));
                    }
                }
            }
        }