();
- bool foundStart = false;
- int mode = 0;
-
- string hash = null, name = null, players = null;
- string maxPlayers = null, uptime = null;
-
- foreach( string line in response ) {
- if( line.StartsWith( " 16 checks that the line actually has a value.
- // this check is necessary, as the page does have lines with just " "
- if( line.Length > 16 && line.StartsWith( " | ", ordinal ) ) {
- const int valStart = 16;
- int valEnd = line.IndexOf( '<', valStart );
- string value = line.Substring( valStart, valEnd - valStart );
-
- if( mode == 0 ) {
- players = value;
- } else if( mode == 1 ) {
- maxPlayers = value;
- } else if( mode == 2 ) {
- uptime = value;
- servers.Add( new ServerListEntry( hash, name, players, maxPlayers, uptime ) );
- }
- mode++;
- }
- }
- Log( "servers matching took " + sw.ElapsedMilliseconds );
- sw.Stop();
- return servers;
- }
- }
-}
\ No newline at end of file
|