Here, this code will allow dex (tmapi) & cex (ccapi) connection. This also includes the status strip at the bottom to change when connected or not, along with colors to It. Pretty sure you can figure out the brackets. xD
Originally posted by another user
public partial class Form1 : Form
{
private PS3API PS3 = new PS3API();
private Random rand = new Random();
public Form1()
{
InitializeComponent();
button3.Click += new System.EventHandler(this.button3_Click);
button3.Click -= new System.EventHandler(this.button3_Click);
}
private void button1_Click(object sender, EventArgs e)
{
if (PS3.ConnectTarget())
{
string Message = "You are now connected with this API : " + PS3.GetCurrentAPIName();
MessageBox.Show(Message, "Connected!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
toolStripStatusLabel2.Text = "Connected!";
toolStripStatusLabel2.ForeColor = Color.Green;
}
else
{
string Message = "Unable to connect!";
MessageBox.Show(Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
toolStripStatusLabel2.Text = "Unable to Connect!";
toolStripStatusLabel2.ForeColor = Color.Red;
}
}
private void button2_Click(object sender, EventArgs e)
{
if (PS3.AttachProcess())
{
MessageBox.Show("Game is successfully attached.", "Success.", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
toolStripStatusLabel2.Text = "Connected and Attached!";
toolStripStatusLabel2.ForeColor = Color.Green;
button2.Enabled = false;
groupBox2.Enabled = true;
}
else
{
MessageBox.Show("No game process found!", "Error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
toolStripStatusLabel2.Text = "No game process found!";
toolStripStatusLabel2.ForeColor = Color.Red;
groupBox2.Enabled = false;
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
PS3.ChangeAPI(SelectAPI.ControlConsole);
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
PS3.ChangeAPI(SelectAPI.TargetManager);
}
private void radiobutton1_Changed(object sender, EventArgs e)
{
PS3.ChangeAPI(SelectAPI.ControlConsole);
PS3.DisconnectTarget();
button2.Enabled = false;
button1.Text = "Connect";
if (toolStripStatusLabel2.Text != "Not Connected / Idle")
{
toolStripStatusLabel2.Text = "Target Changed to CCAPI!";
toolStripStatusLabel2.ForeColor = System.Drawing.Color.Lime;
}
groupBox2.Enabled = false;
}
private void radioButton2_Changed(object sender, EventArgs e)
{
PS3.ChangeAPI(SelectAPI.TargetManager);
PS3.DisconnectTarget();
button2.Enabled = false;
button1.Text = "Connect";
if (toolStripStatusLabel2.Text != "Not Connected / Idle")
{
toolStripStatusLabel2.Text = "Target Changed to TMAPI!";
toolStripStatusLabel2.ForeColor = System.Drawing.Color.Lime;
}
groupBox2.Enabled = false;
}
}