├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── SteamAppInfo.sln └── SteamAppInfoParser ├── App.cs ├── AppInfo.cs ├── EUniverse.cs ├── Package.cs ├── PackageInfo.cs ├── Program.cs └── SteamAppInfoParser.csproj /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.cs diff=csharp 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | 24 | # Visual Studio 2015 cache/options directory 25 | .vs/ 26 | # Uncomment if you have tasks that create the project's static files in wwwroot 27 | #wwwroot/ 28 | 29 | # MSTest test Results 30 | [Tt]est[Rr]esult*/ 31 | [Bb]uild[Ll]og.* 32 | 33 | # NUNIT 34 | *.VisualState.xml 35 | TestResult.xml 36 | 37 | # Build Results of an ATL Project 38 | [Dd]ebugPS/ 39 | [Rr]eleasePS/ 40 | dlldata.c 41 | 42 | # DNX 43 | project.lock.json 44 | artifacts/ 45 | 46 | *_i.c 47 | *_p.c 48 | *_i.h 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.tmp_proj 63 | *.log 64 | *.vspscc 65 | *.vssscc 66 | .builds 67 | *.pidb 68 | *.svclog 69 | *.scc 70 | 71 | # Chutzpah Test files 72 | _Chutzpah* 73 | 74 | # Visual C++ cache files 75 | ipch/ 76 | *.aps 77 | *.ncb 78 | *.opendb 79 | *.opensdf 80 | *.sdf 81 | *.cachefile 82 | 83 | # Visual Studio profiler 84 | *.psess 85 | *.vsp 86 | *.vspx 87 | *.sap 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Guidance Automation Toolkit 93 | *.gpState 94 | 95 | # ReSharper is a .NET coding add-in 96 | _ReSharper*/ 97 | *.[Rr]e[Ss]harper 98 | *.DotSettings.user 99 | 100 | # JustCode is a .NET coding add-in 101 | .JustCode 102 | 103 | # TeamCity is a build add-in 104 | _TeamCity* 105 | 106 | # DotCover is a Code Coverage Tool 107 | *.dotCover 108 | 109 | # NCrunch 110 | _NCrunch_* 111 | .*crunch*.local.xml 112 | nCrunchTemp_* 113 | 114 | # MightyMoose 115 | *.mm.* 116 | AutoTest.Net/ 117 | 118 | # Web workbench (sass) 119 | .sass-cache/ 120 | 121 | # Installshield output folder 122 | [Ee]xpress/ 123 | 124 | # DocProject is a documentation generator add-in 125 | DocProject/buildhelp/ 126 | DocProject/Help/*.HxT 127 | DocProject/Help/*.HxC 128 | DocProject/Help/*.hhc 129 | DocProject/Help/*.hhk 130 | DocProject/Help/*.hhp 131 | DocProject/Help/Html2 132 | DocProject/Help/html 133 | 134 | # Click-Once directory 135 | publish/ 136 | 137 | # Publish Web Output 138 | *.[Pp]ublish.xml 139 | *.azurePubxml 140 | # TODO: Comment the next line if you want to checkin your web deploy settings 141 | # but database connection strings (with potential passwords) will be unencrypted 142 | *.pubxml 143 | *.publishproj 144 | 145 | # NuGet Packages 146 | *.nupkg 147 | # The packages folder can be ignored because of Package Restore 148 | **/packages/* 149 | # except build/, which is used as an MSBuild target. 150 | !**/packages/build/ 151 | # Uncomment if necessary however generally it will be regenerated when needed 152 | #!**/packages/repositories.config 153 | # NuGet v3's project.json files produces more ignoreable files 154 | *.nuget.props 155 | *.nuget.targets 156 | 157 | # Microsoft Azure Build Output 158 | csx/ 159 | *.build.csdef 160 | 161 | # Microsoft Azure Emulator 162 | ecf/ 163 | rcf/ 164 | 165 | # Microsoft Azure ApplicationInsights config file 166 | ApplicationInsights.config 167 | 168 | # Windows Store app package directory 169 | AppPackages/ 170 | BundleArtifacts/ 171 | 172 | # Visual Studio cache files 173 | # files ending in .cache can be ignored 174 | *.[Cc]ache 175 | # but keep track of directories ending in .cache 176 | !*.[Cc]ache/ 177 | 178 | # Others 179 | ClientBin/ 180 | ~$* 181 | *~ 182 | *.dbmdl 183 | *.dbproj.schemaview 184 | *.pfx 185 | *.publishsettings 186 | node_modules/ 187 | orleans.codegen.cs 188 | 189 | # RIA/Silverlight projects 190 | Generated_Code/ 191 | 192 | # Backup & report files from converting an old project file 193 | # to a newer Visual Studio version. Backup files are not needed, 194 | # because we have git ;-) 195 | _UpgradeReport_Files/ 196 | Backup*/ 197 | UpgradeLog*.XML 198 | UpgradeLog*.htm 199 | 200 | # SQL Server files 201 | *.mdf 202 | *.ldf 203 | 204 | # Business Intelligence projects 205 | *.rdl.data 206 | *.bim.layout 207 | *.bim_*.settings 208 | 209 | # Microsoft Fakes 210 | FakesAssemblies/ 211 | 212 | # GhostDoc plugin setting file 213 | *.GhostDoc.xml 214 | 215 | # Node.js Tools for Visual Studio 216 | .ntvs_analysis.dat 217 | 218 | # Visual Studio 6 build log 219 | *.plg 220 | 221 | # Visual Studio 6 workspace options file 222 | *.opt 223 | 224 | # Visual Studio LightSwitch build output 225 | **/*.HTMLClient/GeneratedArtifacts 226 | **/*.DesktopClient/GeneratedArtifacts 227 | **/*.DesktopClient/ModelManifest.xml 228 | **/*.Server/GeneratedArtifacts 229 | **/*.Server/ModelManifest.xml 230 | _Pvt_Extensions 231 | 232 | # Paket dependency manager 233 | .paket/paket.exe 234 | 235 | # FAKE - F# Make 236 | .fake/ 237 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 SteamDB 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a simple program that finds the Steam installation on disk, reads `appinfo.vdf` and `packageinfo.vdf` files and dumps appid/subid and their tokens. 2 | 3 | This is mostly intended as an example on how to read these files. 4 | 5 | ## appinfo.vdf 6 | ``` 7 | uint32 - MAGIC: 29 44 56 07 8 | uint32 - UNIVERSE: 1 9 | int64 - Offset to string table from start of the file 10 | ---- repeated app sections ---- 11 | uint32 - AppID 12 | uint32 - size // until end of binary_vdf 13 | uint32 - infoState // mostly 2, sometimes 1 (may indicate prerelease or no info) 14 | uint32 - lastUpdated 15 | uint64 - picsToken 16 | 20bytes - SHA1 // of text appinfo vdf, as seen in CMsgClientPICSProductInfoResponse.AppInfo.sha 17 | uint32 - changeNumber 18 | 20bytes - SHA1 // of binary_vdf 19 | variable - binary_vdf 20 | ---- end of section ---- 21 | uint32 - EOF: 0 22 | 23 | ---- offset to the string table ---- 24 | uint32 - Count of strings 25 | null-term strings[count] 26 | ``` 27 | 28 | ## appinfo.vdf (before june 2024) 29 | ``` 30 | uint32 - MAGIC: 28 44 56 07 31 | uint32 - UNIVERSE: 1 32 | ---- repeated app sections ---- 33 | uint32 - AppID 34 | uint32 - size // until end of binary_vdf 35 | uint32 - infoState // mostly 2, sometimes 1 (may indicate prerelease or no info) 36 | uint32 - lastUpdated 37 | uint64 - picsToken 38 | 20bytes - SHA1 // of text appinfo vdf, as seen in CMsgClientPICSProductInfoResponse.AppInfo.sha 39 | uint32 - changeNumber 40 | 20bytes - SHA1 // of binary_vdf, added in December 2022 41 | variable - binary_vdf 42 | ---- end of section --------- 43 | uint32 - EOF: 0 44 | ``` 45 | 46 | ## appinfo.vdf (before december 2022) 47 | ``` 48 | uint32 - MAGIC: 27 44 56 07 49 | uint32 - UNIVERSE: 1 50 | ---- repeated app sections ---- 51 | uint32 - AppID 52 | uint32 - size 53 | uint32 - infoState 54 | uint32 - lastUpdated 55 | uint64 - picsToken 56 | 20bytes - SHA1 57 | uint32 - changeNumber 58 | variable - binary_vdf 59 | ---- end of section --------- 60 | uint32 - EOF: 0 61 | ``` 62 | 63 | ## packageinfo.vdf 64 | ``` 65 | uint32 - MAGIC: 28 55 56 06 66 | uint32 - UNIVERSE: 1 67 | ---- repeated package sections ---- 68 | uint32 - PackageID 69 | 20bytes - SHA1 70 | uint32 - changeNumber 71 | uint64 - picsToken // added in April 2020 72 | variable - binary_vdf 73 | ---- end of section --------- 74 | uint32 - EOF: 0xFFFFFFFF 75 | ``` 76 | 77 | ## packageinfo.vdf (before april 2020) 78 | ``` 79 | uint32 - MAGIC: 27 55 56 06 80 | uint32 - UNIVERSE: 1 81 | ---- repeated package sections ---- 82 | uint32 - PackageID 83 | 20bytes - SHA1 84 | uint32 - changeNumber 85 | variable - binary_vdf 86 | ---- end of section --------- 87 | uint32 - EOF: 0xFFFFFFFF 88 | ``` 89 | -------------------------------------------------------------------------------- /SteamAppInfo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.35013.160 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamAppInfoParser", "SteamAppInfoParser\SteamAppInfoParser.csproj", "{6B285D2E-0613-434D-86B5-A51CEA7D4445}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ValveKeyValue", "..\..\ValveResourceFormat\ValveKeyValue\ValveKeyValue\ValveKeyValue\ValveKeyValue.csproj", "{DA073F8F-2816-4F11-983E-8C0A18F290BB}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {6B285D2E-0613-434D-86B5-A51CEA7D4445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {6B285D2E-0613-434D-86B5-A51CEA7D4445}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {6B285D2E-0613-434D-86B5-A51CEA7D4445}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {6B285D2E-0613-434D-86B5-A51CEA7D4445}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {DA073F8F-2816-4F11-983E-8C0A18F290BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {DA073F8F-2816-4F11-983E-8C0A18F290BB}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {DA073F8F-2816-4F11-983E-8C0A18F290BB}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {DA073F8F-2816-4F11-983E-8C0A18F290BB}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {E22471A6-1221-414F-A190-24F1CCE1DDCB} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /SteamAppInfoParser/App.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | using ValveKeyValue; 4 | 5 | namespace SteamAppInfoParser 6 | { 7 | public class App 8 | { 9 | public uint AppID { get; set; } 10 | 11 | public uint InfoState { get; set; } 12 | 13 | public DateTime LastUpdated { get; set; } 14 | 15 | public ulong Token { get; set; } 16 | 17 | public ReadOnlyCollection Hash { get; set; } 18 | public ReadOnlyCollection BinaryDataHash { get; set; } 19 | 20 | public uint ChangeNumber { get; set; } 21 | 22 | public KVObject Data { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SteamAppInfoParser/AppInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Buffers; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.IO; 6 | using System.Text; 7 | using ValveKeyValue; 8 | 9 | namespace SteamAppInfoParser 10 | { 11 | class AppInfo 12 | { 13 | private const uint Magic29 = 0x07_56_44_29; 14 | private const uint Magic28 = 0x07_56_44_28; 15 | private const uint Magic = 0x07_56_44_27; 16 | 17 | public EUniverse Universe { get; set; } 18 | 19 | public List Apps { get; set; } = []; 20 | 21 | /// 22 | /// Opens and reads the given filename. 23 | /// 24 | /// The file to open and read. 25 | public void Read(string filename) 26 | { 27 | using var fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 28 | Read(fs); 29 | } 30 | 31 | /// 32 | /// Reads the given . 33 | /// 34 | /// The input to read from. 35 | public void Read(Stream input) 36 | { 37 | using var reader = new BinaryReader(input); 38 | var magic = reader.ReadUInt32(); 39 | 40 | if (magic != Magic && magic != Magic28 && magic != Magic29) 41 | { 42 | throw new InvalidDataException($"Unknown magic header: {magic:X}"); 43 | } 44 | 45 | Universe = (EUniverse)reader.ReadUInt32(); 46 | 47 | var options = new KVSerializerOptions(); 48 | 49 | if (magic == Magic29) 50 | { 51 | var stringTableOffset = reader.ReadInt64(); 52 | var offset = reader.BaseStream.Position; 53 | reader.BaseStream.Position = stringTableOffset; 54 | var stringCount = reader.ReadUInt32(); 55 | var stringPool = new string[stringCount]; 56 | 57 | for (var i = 0; i < stringCount; i++) 58 | { 59 | stringPool[i] = ReadNullTermUtf8String(reader.BaseStream); 60 | } 61 | 62 | reader.BaseStream.Position = offset; 63 | 64 | options.StringTable = new(stringPool); 65 | } 66 | 67 | var deserializer = KVSerializer.Create(KVSerializationFormat.KeyValues1Binary); 68 | 69 | do 70 | { 71 | var appid = reader.ReadUInt32(); 72 | 73 | if (appid == 0) 74 | { 75 | break; 76 | } 77 | 78 | var size = reader.ReadUInt32(); // size until end of Data 79 | var end = reader.BaseStream.Position + size; 80 | 81 | var app = new App 82 | { 83 | AppID = appid, 84 | InfoState = reader.ReadUInt32(), 85 | LastUpdated = DateTimeFromUnixTime(reader.ReadUInt32()), 86 | Token = reader.ReadUInt64(), 87 | Hash = new ReadOnlyCollection(reader.ReadBytes(20)), 88 | ChangeNumber = reader.ReadUInt32(), 89 | }; 90 | 91 | if (magic == Magic28 || magic == Magic29) 92 | { 93 | app.BinaryDataHash = new ReadOnlyCollection(reader.ReadBytes(20)); 94 | } 95 | 96 | app.Data = deserializer.Deserialize(input, options); 97 | 98 | if (reader.BaseStream.Position != end) 99 | { 100 | throw new InvalidDataException(); 101 | } 102 | 103 | Apps.Add(app); 104 | } 105 | while (true); 106 | } 107 | 108 | private static DateTime DateTimeFromUnixTime(uint unixTime) 109 | { 110 | return new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unixTime); 111 | } 112 | 113 | private static string ReadNullTermUtf8String(Stream stream) 114 | { 115 | var buffer = ArrayPool.Shared.Rent(32); 116 | 117 | try 118 | { 119 | var position = 0; 120 | 121 | do 122 | { 123 | var b = stream.ReadByte(); 124 | 125 | if (b <= 0) // null byte or stream ended 126 | { 127 | break; 128 | } 129 | 130 | if (position >= buffer.Length) 131 | { 132 | var newBuffer = ArrayPool.Shared.Rent(buffer.Length * 2); 133 | Buffer.BlockCopy(buffer, 0, newBuffer, 0, buffer.Length); 134 | ArrayPool.Shared.Return(buffer); 135 | buffer = newBuffer; 136 | } 137 | 138 | buffer[position++] = (byte)b; 139 | } 140 | while (true); 141 | 142 | return Encoding.UTF8.GetString(buffer[..position]); 143 | } 144 | finally 145 | { 146 | ArrayPool.Shared.Return(buffer); 147 | } 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /SteamAppInfoParser/EUniverse.cs: -------------------------------------------------------------------------------- 1 | namespace SteamAppInfoParser 2 | { 3 | public enum EUniverse 4 | { 5 | Invalid = 0, 6 | Public = 1, 7 | Beta = 2, 8 | Internal = 3, 9 | Dev = 4, 10 | Max = 5, 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SteamAppInfoParser/Package.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using ValveKeyValue; 3 | 4 | namespace SteamAppInfoParser 5 | { 6 | public class Package 7 | { 8 | public uint SubID { get; set; } 9 | 10 | public ReadOnlyCollection Hash { get; set; } 11 | 12 | public uint ChangeNumber { get; set; } 13 | 14 | public ulong Token { get; set; } 15 | 16 | public KVObject Data { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SteamAppInfoParser/PackageInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.IO; 5 | using ValveKeyValue; 6 | 7 | namespace SteamAppInfoParser 8 | { 9 | class PackageInfo 10 | { 11 | private const uint Magic = 0x06_56_55_28; 12 | private const uint Magic27 = 0x06_56_55_27; 13 | 14 | public EUniverse Universe { get; set; } 15 | 16 | public List Packages { get; set; } = []; 17 | 18 | /// 19 | /// Opens and reads the given filename. 20 | /// 21 | /// The file to open and read. 22 | public void Read(string filename) 23 | { 24 | using var fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 25 | Read(fs); 26 | } 27 | 28 | /// 29 | /// Reads the given . 30 | /// 31 | /// The input to read from. 32 | public void Read(Stream input) 33 | { 34 | using var reader = new BinaryReader(input); 35 | var magic = reader.ReadUInt32(); 36 | 37 | if (magic != Magic && magic != Magic27) 38 | { 39 | throw new InvalidDataException($"Unknown magic header: {magic:X}"); 40 | } 41 | 42 | Universe = (EUniverse)reader.ReadUInt32(); 43 | 44 | var deserializer = KVSerializer.Create(KVSerializationFormat.KeyValues1Binary); 45 | 46 | do 47 | { 48 | var subid = reader.ReadUInt32(); 49 | 50 | if (subid == 0xFFFFFFFF) 51 | { 52 | break; 53 | } 54 | 55 | var package = new Package 56 | { 57 | SubID = subid, 58 | Hash = new ReadOnlyCollection(reader.ReadBytes(20)), 59 | ChangeNumber = reader.ReadUInt32(), 60 | }; 61 | 62 | if (magic != Magic27) 63 | { 64 | package.Token = reader.ReadUInt64(); 65 | } 66 | 67 | package.Data = deserializer.Deserialize(input); 68 | 69 | Packages.Add(package); 70 | } 71 | while (true); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /SteamAppInfoParser/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using Microsoft.Win32; 6 | 7 | namespace SteamAppInfoParser 8 | { 9 | class Program 10 | { 11 | static int Main() 12 | { 13 | var steamLocation = GetSteamPath(); 14 | 15 | if (steamLocation == null) 16 | { 17 | Console.Error.WriteLine("Can not find Steam"); 18 | return 1; 19 | } 20 | 21 | PrintPackageInfo(steamLocation); 22 | Console.WriteLine(); 23 | PrintAppInfo(steamLocation); 24 | 25 | return 0; 26 | } 27 | 28 | private static void PrintAppInfo(string steamLocation) 29 | { 30 | var appInfo = new AppInfo(); 31 | appInfo.Read(Path.Join(steamLocation, "appcache", "appinfo.vdf")); 32 | 33 | Console.WriteLine($"{appInfo.Apps.Count} apps"); 34 | 35 | foreach (var app in appInfo.Apps) 36 | { 37 | if (app.Token > 0) 38 | { 39 | Console.WriteLine($"App: {app.AppID} - Token: {app.Token} - {app.Data["common"]["name"]}"); 40 | } 41 | } 42 | } 43 | 44 | private static void PrintPackageInfo(string steamLocation) 45 | { 46 | var packageInfo = new PackageInfo(); 47 | packageInfo.Read(Path.Join(steamLocation, "appcache", "packageinfo.vdf")); 48 | 49 | Console.WriteLine($"{packageInfo.Packages.Count} packages"); 50 | 51 | foreach (var package in packageInfo.Packages) 52 | { 53 | if (package.Token > 0) 54 | { 55 | Console.WriteLine($"Package: {package.SubID} - Token: {package.Token}"); 56 | } 57 | } 58 | } 59 | 60 | private static string GetSteamPath() 61 | { 62 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) 63 | { 64 | var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Valve\\Steam") ?? 65 | RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64) 66 | .OpenSubKey("SOFTWARE\\Valve\\Steam"); 67 | 68 | if (key != null && key.GetValue("SteamPath") is string steamPath) 69 | { 70 | return steamPath; 71 | } 72 | } 73 | else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) 74 | { 75 | var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); 76 | var paths = new[] { ".steam", ".steam/steam", ".steam/root", ".local/share/Steam" }; 77 | 78 | return paths 79 | .Select(path => Path.Join(home, path)) 80 | .FirstOrDefault(steamPath => Directory.Exists(Path.Join(steamPath, "appcache"))); 81 | } 82 | else if (OperatingSystem.IsMacOS()) 83 | { 84 | var home = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); 85 | return Path.Join(home, "Steam"); 86 | } 87 | 88 | throw new PlatformNotSupportedException(); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /SteamAppInfoParser/SteamAppInfoParser.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | --------------------------------------------------------------------------------