[C#] update Textbox or labelbox?

07/21/2011 01:21 Haxor#1
Hello all
im trying to create a server stats program (windows forms)
I used pushedx example and im now trying to make it work on forms
i almost end end but i have one problem that i cant refresh textbox or label
and i get much errors..
And my stats update every 2 sec
So my project crash
I try to make it with diffrent ways from google , but i always get error
any help would be appreciated
07/21/2011 11:09 ÑõÑ_Ŝŧóp#2
[Only registered and activated users can see links. Click Here To Register...]

google ftw ;)
07/21/2011 11:16 Shane¸#3
fuuu signature stealers xD
by the way. did you try with timers?
it won't cause crashes cause of infinite loops
07/21/2011 11:36 vorosmihaly#4
Quote:
Originally Posted by ~ Shane View Post
fuuu signature stealers xD
by the way. did you try with timers?
it won't cause crashes cause of infinite loops
infinite loop FTW :D
but only on a new thread xD
this way:

Thread loop = new Thread(UpdateThread);
loop.Start();

public void UpdateThread()
{
while(true)
{
//update shits here

Thread.Sleep(1);
}

}

and it rocks then. :D

oh and by the way,for the updating I'd do it this way:
create a new function in Form1.cs (or whatever it's called)
like
public void UpdateTxtBox(string msg)
{
lock(this)
{
txtBox1.Text = "blablabla";
}

}

then in program.cs,I'd create a new from,
Form1 MainForm;
in Main function:
MainForm = new Form1();
Application.Run(MainForm);

then you can update textbox1.text using this:
MainForm.UpdateTxtBox("your text here");


I hope that helped :P
07/21/2011 11:57 ÑõÑ_Ŝŧóp#5
here is a lil example used Invoke
07/25/2011 02:03 sarkoplata#6
just use Control.CheckForIllegalThreadCalls = False ;
And you'll be okay ;)
07/25/2011 09:10 ZeraPain#7
Quote:
Originally Posted by sarkoplata View Post
just use Control.CheckForIllegalThreadCalls = False ;
And you'll be okay ;)
no comment :facepalm:
07/25/2011 12:38 Haxor#8
I just get it by more simple way
But now i have problem to get the stats packet in grindroad
in esro its working 100%
but grindroad have 4 servers in same ip and when i put it on my program it crash
also it have diffrent opcode and i cant analyze\parse it

this is the packet
Quote:
<<< [S -> C][A107]
02 ................
00 ................
0D 00 ................
67 73 72 6F 2E 7A 61 70 74 2E 6F 72 67 gsro.zapt.org...
BD 32 .2..............
01 ................
0D 00 ................
67 73 72 6F 2E 7A 61 70 74 2E 6F 72 67 gsro.zapt.org...
BD 32 .2..............
well i cant anything from it
i wonder if you can help me with this
07/25/2011 16:03 kevin_owner#9
If you look at that packet it seems logic to me that the first byte is the amount of servers or whatever those are. then a byte for the id and then a string.

Code:
<<< [S -> C][A107]
[BYTE](Amount of servers) 02 ................
[BYTE](Id of the server)     00 ................
[WORD](Length of the serverName) 0D 00 ................
[STRING](Server Name Size is previous value)67 73 72 6F 2E 7A 61 70 74 2E 6F 72 67 gsro.zapt.org...
BD 32 .2..............
[BYTE](Again Id)01 ................
[WORD](Length of ServerName)0D 00 ................
[STRING](Server Name)67 73 72 6F 2E 7A 61 70 74 2E 6F 72 67 gsro.zapt.org...
BD 32 .2..............
But if grindroad is using isro or any other version isn't the opcode the same as usual. so for the stats 0x303D. At least if you mean that stat packet with the HP, MP, phy atk and defence stuff.
07/25/2011 16:19 Haxor#10
Quote:
Originally Posted by kevin_owner View Post
If you look at that packet it seems logic to me that the first byte is the amount of servers or whatever those are. then a byte for the id and then a string.

Code:
<<< [S -> C][A107]
[BYTE](Amount of servers) 02 ................
[BYTE](Id of the server)     00 ................
[WORD](Length of the serverName) 0D 00 ................
[STRING](Server Name Size is previous value)67 73 72 6F 2E 7A 61 70 74 2E 6F 72 67 gsro.zapt.org...
BD 32 .2..............
[BYTE](Again Id)01 ................
[WORD](Length of ServerName)0D 00 ................
[STRING](Server Name)67 73 72 6F 2E 7A 61 70 74 2E 6F 72 67 gsro.zapt.org...
BD 32 .2..............
But if grindroad is using isro or any other version isn't the opcode the same as usual. so for the stats 0x303D. At least if you mean that stat packet with the HP, MP, phy atk and defence stuff.
i mean stats packet about currentonline maxplayers and serverstats(check-open)
i can get in esro but in this i cant because its 4 servers in ip and i cant find the opcode that have them and how to recive them
07/25/2011 16:37 sarkoplata#11
Quote:
Originally Posted by ZeraPain View Post
no comment :facepalm:
Why i wonder?
07/25/2011 17:06 kevin_owner#12
@saif1999

I can't sniff grindroad atm but can't you use a packet logger and see which packet contains the servers?
07/25/2011 17:11 Haxor#13
Quote:
Originally Posted by kevin_owner View Post
@saif1999

I can't sniff grindroad atm but can't you use a packet logger and see which packet contains the servers?
well now i read it correct
i got it but the problem now that the program read the 4 servers
i get that
Quote:
iridium ang = id 5
iridium dem = id 6
plutonium(ang) = id 1
plutonium(dem) = id 2
but now the problem now that i want it to connect to 1 server from 4
trying right now -.-
07/25/2011 17:32 kevin_owner#14
yeah well in the login packet there is the server id so you just send the server id of the server you want to login to and the username and password and it should be fine. So then you'll receive the server ip and port.
07/25/2011 17:54 Haxor#15
Quote:
Originally Posted by kevin_owner View Post
yeah well in the login packet there is the server id so you just send the server id of the server you want to login to and the username and password and it should be fine. So then you'll receive the server ip and port.
ok now i recived the server name , server stats
but the server current players and max still 0..