Skip to content

Commit a474749

Browse files
Merge pull request #18 from startersclan/docs/functions-add-function-documentation
Docs (functions): Add function documentation
2 parents dbebe1e + b84384a commit a474749

3 files changed

Lines changed: 102 additions & 4 deletions

File tree

src/PSSourceQuery/public/GoldSourceRcon.ps1

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
1-
# Gold Source rcon documentation from: https://forums.alliedmods.net/showpost.php?p=1718732&postcount=3
1+
<#
2+
.SYNOPSIS
3+
Performs a Goldsource Rcon.
4+
5+
.DESCRIPTION
6+
Performs a Goldsource Rcon.
7+
8+
.PARAMETER Address
9+
DNS or IP address.
10+
11+
.PARAMETER Port
12+
Port.
13+
14+
.PARAMETER Password
15+
Rcon password.
16+
17+
.PARAMETER Command
18+
Rcon command.
19+
20+
.EXAMPLE
21+
GoldsourceRcon -Address $address -Port $port -Password $rcon_password -Command 'status'
22+
23+
.NOTES
24+
Goldsource: https://developer.valvesoftware.com/wiki/Goldsource
25+
Goldsource Rcon: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol
26+
Goldsource Rcon python code: https://forums.alliedmods.net/showpost.php?p=1718732&postcount=3
27+
#>
228
function GoldSourceRcon {
329
[CmdletBinding()]
430
param(

src/PSSourceQuery/public/SourceQuery.ps1

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,54 @@ class SourceQueryBuffer {
9191
}
9292
}
9393

94+
<#
95+
.SYNOPSIS
96+
Performs a Source Query.
97+
98+
.DESCRIPTION
99+
Performs a Source Query.
100+
101+
.PARAMETER Address
102+
DNS or IP address.
103+
104+
.PARAMETER Port
105+
Port.
106+
107+
.PARAMETER Engine
108+
Source engine. May be one of the following: 'GoldSource', 'Source'.
109+
110+
.PARAMETER Type
111+
Query type. Mya be one of the following: 'info', 'players', 'rules', 'ping'.
112+
113+
.EXAMPLE
114+
# Source Engine
115+
# A2S_INFO query. Returns a hashtable of server metadata
116+
SourceQuery -Address $address -Port $port -Engine 'Source' -Type 'info'
117+
# A2S_PLAYER query. Returns a hashtable of players
118+
SourceQuery -Address $address -Port $port -Engine 'Source' -Type 'players'
119+
# A2S_RULES query, Returns a hashtable of server cvars
120+
SourceQuery -Address $address -Port $port -Engine 'Source' -Type 'rules'
121+
# A2A_PING query. Returns a hashtable of whether the ping was successful
122+
SourceQuery -Address $address -Port $port -Engine 'Source' -Type 'ping'
123+
124+
.EXAMPLE
125+
# GoldSource Engine
126+
# A2S_INFO query - Returns a hashtable of server metadata
127+
SourceQuery -Address $address -Port $port -Engine 'GoldSource' -Type 'info'
128+
# A2S_PLAYER query. Returns a hashtable of players
129+
SourceQuery -Address $address -Port $port -Engine 'GoldSource' -Type 'players'
130+
# A2S_RULES query, Returns a hashtable of server cvars
131+
SourceQuery -Address $address -Port $port -Engine 'GoldSource' -Type 'rules'
132+
# A2A_PING query. Returns a hashtable of whether the ping was successful
133+
SourceQuery -Address $address -Port $port -Engine 'GoldSource' -Type 'ping'
134+
135+
.NOTES
136+
Queries: https://developer.valvesoftware.com/wiki/Server_queries
137+
Goldsource: https://developer.valvesoftware.com/wiki/Goldsource
138+
Source: https://developer.valvesoftware.com/wiki/Source
139+
140+
A2A_PING is no longer supported on Counter Strike: Source and Team Fortress 2 servers, and is considered a deprecated feature. See: https://developer.valvesoftware.com/wiki/Server_Queries#A2A_PING
141+
#>
94142
function SourceQuery {
95143
[CmdletBinding()]
96144
param(
@@ -384,8 +432,7 @@ function SourceQuery {
384432
}
385433
return $Rules
386434
}elseif ($requestBody -eq $A2A_PING) {
387-
# A2A_PING is no longer supported on Counter Strike: Source and Team Fortress 2 servers, and is considered a deprecated feature.
388-
# See: https://developer.valvesoftware.com/wiki/Server_Queries#A2A_PING
435+
# A2A_PING is no longer supported on Counter Strike: Source and Team Fortress 2 servers, and is considered a deprecated feature. See: https://developer.valvesoftware.com/wiki/Server_Queries#A2A_PING
389436

390437
# A2A_PING request
391438
$pack = @(255,255,255,255) + $requestBody

src/PSSourceQuery/public/SourceRcon.ps1

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
# Source Rcon: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol
1+
<#
2+
.SYNOPSIS
3+
Performs a Source Rcon.
4+
5+
.DESCRIPTION
6+
Performs a Source Rcon.
7+
8+
.PARAMETER Address
9+
DNS or IP address.
10+
11+
.PARAMETER Port
12+
Port.
13+
14+
.PARAMETER Password
15+
Rcon password.
16+
17+
.PARAMETER Command
18+
Rcon command.
19+
20+
.EXAMPLE
21+
SourceRcon -Address $address -Port $port -Password $rcon_password -Command 'status'
22+
23+
.NOTES
24+
Source: https://developer.valvesoftware.com/wiki/Source
25+
Source Rcon: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol
26+
#>
227
function SourceRcon {
328
[CmdletBinding()]
429
param(

0 commit comments

Comments
 (0)