You are viewing our Forum Archives. To view or take place in current topics click here.
#11. Posted:
IDA
  • Powerhouse
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
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
#12. Posted:
XeXStozza
  • Powerhouse
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)

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
#13. Posted:
IDA
  • Powerhouse
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
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);
            }
#14. Posted:
XboxInferno
  • Junior Member
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.
#15. Posted:
IDA
  • Powerhouse
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
XboxInferno wrote
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.


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
#16. Posted:
Wilez
  • TTG Addict
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.
#17. Posted:
XboxInferno
  • Junior Member
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.
#18. Posted:
TheGamersBoards
  • New Member
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 ;)
#19. Posted:
XboxInferno
  • Junior Member
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!
#20. Posted:
XboxInferno
  • Junior Member
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
Status: Offline
Joined: Mar 17, 201410Year Member
Posts: 95
Reputation Power: 3
XeX-Space wrote When i try to build it says "Could not copy the file "obj/Debug/Test1.exe" because it was not found.

Any help? Thanks


Make sure you click the right 'build' button.

You'll have to click this one:
[ Register or Signin to view external links. ]
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.