-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSteamGames.ps1
51 lines (44 loc) · 1.35 KB
/
SteamGames.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This works for now, but it's pretty inefficient, and horrible to follow
$arrUsers = @(
"guruant",
"the_gruffalo" # This is now correct
# Brian's profile is private. Probably to stop
# Malc's profile is strange - maybe not set up a profile?
)
$allGames = @()
$allUsers = @()
$objGames = @()
$arrMatches = @()
forEach ($strUser in $arrUsers){
$objUser = New-Object PSObject
$objUser | Add-Member -Name "Name" -MemberType NoteProperty -Value $strUser
$usersGames = @()
([xml](Invoke-WebRequest ("http://steamcommunity.com/id/" + $strUser + "/games/?xml=1")).content).gamesList.games.game.name."#cdata-section" | ForEach-Object {
$usersGames += $_
}
$usersGames | Sort-Object
$objUser | Add-Member -Name "Games" -MemberType NoteProperty -Value $usersGames
$allGames += $usersGames
$allUsers += $objUser
}
$allGames = $allGames | Get-Unique -AsString
forEach ($game in $allGames){
$objGame = New-Object PSObject
$objGame | Add-Member -Name "Name" -MemberType NoteProperty -Value $game
forEach ($objUser in $allUsers){
$objGame | Add-Member -Name $objUser.Name -MemberType NoteProperty -Value ($objUser.Games -Contains $game)
}
$objGames += $objGame
}
ForEach ($objGame in $objGames){
$match = $true
$arrUsers | ForEach-Object {
if ($objGame.$_ -eq $false){
$match = $false
}
}
if ($match -eq $true){
$arrMatches += $objGame
}
}
$arrMatches