You are viewing our Forum Archives. To view or take place in current topics click here.
#11. Posted:
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
No your wrong, that code is called weather it's connected or not :/
No WTF
why have a try and a if statement ?
Last edited by IDA ; edited 1 time in total
No WTF
why have a try and a if statement ?
Last edited by IDA ; edited 1 time in total
- 0useful
- 0not useful
#12. Posted:
Status: Offline
Joined: Jun 08, 201212Year Member
Posts: 407
Reputation Power: 18
Status: Offline
Joined: Jun 08, 201212Year Member
Posts: 407
Reputation Power: 18
May i ask why your using the catch system like that?
The way i personally do it (People may do it different but this way works for me)
I use the try and if statements because the if deals with stuff when it connects whereas catch deals with the exception(if there is one).
Also i just wrote that out so if there are mistakes i apologize
Last edited by XeXStozza ; edited 4 times in total
The way i personally do it (People may do it different but this way works for me)
string connected = "XRPC Tool Connected!";
try
{
Jtag.Connect();
}
catch
{
MessageBox.Show("Failed to connect");
}
if(Jtag.activeConnection)
{
MessageBox.Show("Connected");
Jtag.Notify(XRPC.xNotiy.FLASHING_HAPPY_FACE, connected);
}
I use the try and if statements because the if deals with stuff when it connects whereas catch deals with the exception(if there is one).
Also i just wrote that out so if there are mistakes i apologize
Last edited by XeXStozza ; edited 4 times in total
- 0useful
- 0not useful
#13. Posted:
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
either have ....
OR
Jtag.Connect();
if(Jtag.activeConnection)
{
MessageBox.Show("connected")
}
else
{
MessageBox.Show("not connected")
}
OR
try
{
XP.Connect();
}
catch (Exception ex)
{
MessageBox.Show("Error Occurd at : " + ex.Source);
}
- 0useful
- 1not useful
#14. Posted:
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
IDA wrote either have ....
Jtag.Connect();
if(Jtag.activeConnection == true)
{
MessageBox.Show("connected")
}
else
{
MessageBox.Show("not connected")
}
OR
try
{
XP.Connect();
}
catch (Exception ex)
{
MessageBox.Show("Error Occurd at : " + ex.Source);
}
Thanks for the heads-up. Didn't see that I did it both.
Updated.
- 0useful
- 0not useful
#15. Posted:
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
XboxInferno wroteIDA wrote either have ....
Jtag.Connect();
if(Jtag.activeConnection == true)
{
MessageBox.Show("connected")
}
else
{
MessageBox.Show("not connected")
}
OR
try
{
XP.Connect();
}
catch (Exception ex)
{
MessageBox.Show("Error Occurd at : " + ex.Source);
}
Thanks for the heads-up. Didn't see that I did it both.
Updated.
thats okay ;)
i wasnt hating just trying to help
your way could(i think, probably error when it cant connect) work but a tad confusing for a n00b starting out
- 1useful
- 0not useful
#16. Posted:
Status: Offline
Joined: Apr 29, 201113Year Member
Posts: 2,192
Reputation Power: 99
Status: Offline
Joined: Apr 29, 201113Year Member
Posts: 2,192
Reputation Power: 99
IDA wrote either have ....
Jtag.Connect();
if(Jtag.activeConnection)
{
MessageBox.Show("connected")
}
else
{
MessageBox.Show("not connected")
}
OR
try
{
XP.Connect();
}
catch (Exception ex)
{
MessageBox.Show("Error Occurd at : " + ex.Source);
}
You put the try around the 'connect' to handle any exceptions that may occur.
the if statement simply checks if the connection is active.
So @OP your fine to use both the try/catch and the if and else.
- 0useful
- 0not useful
#17. Posted:
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
Wilez wrote
You put the try around the 'connect' to handle any exceptions that may occur.
the if statement simply checks if the connection is active.
So @OP your fine to use both the try/catch and the if and else.
Thanks, I'll just use the 'if' 'else' statement for this tutorial. It's a lot easier for people to understand.
- 0useful
- 0not useful
#18. Posted:
Status: Offline
Joined: Mar 07, 201410Year Member
Posts: 48
Reputation Power: 2
Status: Offline
Joined: Mar 07, 201410Year Member
Posts: 48
Reputation Power: 2
nice one bro! should be stickied!
I already code XRPCs, but dayum, that connect code is sexy, I might have to steal that ;)
I already code XRPCs, but dayum, that connect code is sexy, I might have to steal that ;)
- 0useful
- 0not useful
#19. Posted:
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
TheGamersBoards wrote nice one bro! should be stickied!
I already code XRPCs, but dayum, that connect code is sexy, I might have to steal that ;)
Haha, thanks for the feedback
Every code posted is there to be used, so use it if you want!
- 0useful
- 0not useful
#20. Posted:
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
You are viewing our Forum Archives. To view or take place in current topics click here.