You need to evaluate a bitwise AND of the EDF value and the various values 
defined in the A2S_INFO specification.  I haven't done this in PowerShell, but 
a quick Google search for bitwise operations makes me think that you need to 
use -band (bitwise AND) instead of -and, like so:

if($EDF -band 0x80)
{
    # Server's game port is included
}

if($EDF -band 0x10)
 {
     # Server's SteamID is included
 }

if($EDF -band 0x40)
 {
     # Spectator port and server name are included
 }

if($EDF -band 0x20)
 {
     # Game tag data is included
 }

Again, I haven't actually tried this, but I think the -band may be what you're 
looking for.

    - Dave

----- Original Message -----
From: edman747 <edman...@gmail.com>
Date: Thursday, October 28, 2010 7:32 pm
Subject: Re: [hlds_linux] server info query.
To: Half-Life dedicated Linux server mailing list 
<hlds_linux@list.valvesoftware.com>

> I almost got it.
> There are no built in operators for bit shifting (<<,>>) 
> in powershell v2.
> So it does not add two bytes well. as shown in the gameport and 
> steamIDoutput:
> 
>                           $EDF =             $ReceiveBuffer[$i]
>                           if($EDF -and 0x80) # servers game port number is
> included.
>                              {
>                                 $i++
>                                 [int16[]]$gameport = $receivebuffer[$i] +
> $receivebuffer[$i++]
>                                 if($EDF -and 0x10) # The server's SteamID
>                                    {
>                                       [int64[]]$SteamID = $receivebuffer[$i]
> + $receivebuffer[$i++] + $receivebuffer[$i++] + 
> $receivebuffer[$i++] +
> $receivebuffer[$i++] + $receivebuffer[$i++] + 
> $receivebuffer[$i++] +
> $receivebuffer[$i++]
>                                       if($EDF -and 0x01) # The steam
> application 
> ID<http://developer.valvesoftware.com/wiki/Steam_Application_IDs>again                                        
>  {
>                                          $i++;$i++
>                                          [int16[]]$AppID2 =
> $receivebuffer[$i]
>                                          }
>                                    }
>                              }
> 
> output:
>                     Type: I
>         Protocol Version: 48
>              Server Name: SC Test Server -DAL- [2815]
>                      Map: datacore
>           Game 
> Directory: SvenCoop4
>         Game Description: 
> Sven Co-op 4.6 or later
>                    AppID: 70, 77
>        Number of players: 0
>          Maximum 
> players: 24
>           Number of 
> bots: 0
>                Dedicated: d
>                       OS: w
>                 Password: 1
>                   Secure: 1
>             Game Version: 1.1.2.1
>                      EDF: 145
>                 gameport: 270
>                  SteamID: 769
>                   AppID2: 70
> 
> 
> > Thanks,
> >
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list 
> archives, please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlds_linux
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to