Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ClientInfo
- {
- public int posX, posY, score;
- ClientInfo( int x, int y )
- {
- posX = x;
- posY = y;
- score = 0;
- }
- }
- Dictionary<string, ClientInfo> clients = new Dictionary<string, ClientInfo>();
- // 01234567890 012345678 012345678 0123456789
- String str = "portID:XXXX,PosX=XXXX,PosY=XXXX,Score=XXXX";
- void ParseClientInfo( string msg )
- {
- char[] delimited = new char[] { ',' };
- string[] parsed = str.Split( delimited );
- int portID = Convert.ToInt32( parsed[0].Substring( 7 ) );
- int pX = Convert.ToInt32( parsed[1].Substring( 5 ) );
- int pY = Convert.ToInt32( parsed[2].Substring( 5 ) );
- int score = Convert.ToInt32( parsed[3].Substring( 6 ) );
- clients[ portID.ToString() ].posX = pX;
- clients[ portID.ToString() ].posY = pY;
- clients[ portID.ToString() ].score = score;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement