Beispiel #1
0
        private void B_Connect_Click(object sender, EventArgs e)
        {
            try
            {
                // Enable controls
                B_Connect.Enabled = TB_IP.Enabled = TB_Port.Enabled = false;
                groupBox1.Enabled = groupBox2.Enabled = groupBox3.Enabled = true;
                var ConnectionEstablished = false;
                var validversions         = RamOffsets.GetValidVersions(SAV.SAV);
                var currver = validversions[0];
                foreach (var version in validversions)
                {
                    Remote.Bot = new PokeSysBotMini(version, CurrentInjectionType)
                    {
                        com = { IP = TB_IP.Text, Port = int.Parse(TB_Port.Text) }
                    };
                    Remote.Bot.com.Connect();

                    var data = Remote.Bot.ReadSlot(1, 1);
                    var pkm  = PKMConverter.GetPKMfromBytes(data);
                    if (pkm?.ChecksumValid == true)
                    {
                        ConnectionEstablished = true;
                        currver = version;
                        break;
                    }

                    if (Remote.Bot.Connected)
                    {
                        Remote.Bot.com.Disconnect();
                    }
                }

                if (!ConnectionEstablished)
                {
                    Remote.Bot = new PokeSysBotMini(currver, CurrentInjectionType)
                    {
                        com = { IP = TB_IP.Text, Port = int.Parse(TB_Port.Text) }
                    };
                    Remote.Bot.com.Connect();
                }

                // Load current box
                Remote.ReadBox(SAV.CurrentBox);

                // Set Trainer Data
                SetTrainerData(SAV.SAV, currver);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            // Console might be disconnected...
            catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                WinFormsUtil.Error(ex.Message);
            }
        }
Beispiel #2
0
        private void B_Connect_Click(object sender, EventArgs e)
        {
            try
            {
                // Enable controls
                B_Connect.Enabled = TB_IP.Enabled = TB_Port.Enabled = false;
                groupBox1.Enabled = groupBox2.Enabled = groupBox3.Enabled = true;
                var ConnectionEstablished = false;
                var currver       = LiveHeXVersion.SWSH_Rigel1;
                var validversions = RamOffsets.GetValidVersions(SAV.SAV);
                foreach (LiveHeXVersion ver in validversions)
                {
                    Remote.Bot      = new PokeSysBotMini(ver);
                    Remote.Bot.IP   = TB_IP.Text;
                    Remote.Bot.Port = int.Parse(TB_Port.Text);
                    Remote.Bot.Connect();

                    var data = Remote.Bot.ReadSlot(1, 1);
                    var pkm  = PKMConverter.GetPKMfromBytes(data);
                    if (pkm != null && pkm.ChecksumValid && pkm.Species > -1)
                    {
                        ConnectionEstablished = true;
                        currver = ver;
                        break;
                    }

                    if (Remote.Bot.Connected)
                    {
                        Remote.Bot.Disconnect();
                    }
                }

                if (!ConnectionEstablished)
                {
                    Remote.Bot      = new PokeSysBotMini(currver);
                    Remote.Bot.IP   = TB_IP.Text;
                    Remote.Bot.Port = int.Parse(TB_Port.Text);
                    Remote.Bot.Connect();
                }
                // Load current box
                Remote.ReadBox(SAV.CurrentBox);

                // Set Trainer Data
                SetTrainerData(SAV.SAV, currver);
            }
            catch (Exception ex)
            {
                WinFormsUtil.Error(ex.Message);
            }
        }
Beispiel #3
0
        private void B_Connect_Click(object sender, EventArgs e)
        {
            try
            {
                Remote.Bot.IP   = TB_IP.Text;
                Remote.Bot.Port = int.Parse(TB_Port.Text);
                Remote.Bot.Connect();

                // Set Trainer Data
                SetTrainerData(SAV.SAV);

                // Enable controls
                B_Connect.Enabled = TB_IP.Enabled = TB_Port.Enabled = false;
                groupBox1.Enabled = groupBox2.Enabled = groupBox3.Enabled = true;

                // Load current box
                Remote.ReadBox(SAV.CurrentBox);
            }
            catch (Exception ex)
            {
                WinFormsUtil.Error(ex.Message);
            }
        }