Skip to content

VDF (Valve Data File) converter for PowerShell

License

Notifications You must be signed in to change notification settings

constup/vdf-converter-powershell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VDF (Valve Data File) converter for PowerShell

Support this tool

Ko-fi

Description

A basic VDF (Valve Data File) converter for PowerShell. Contains functions which you can use in your own PowerShell scripts to convert contents of VDF files to other formats. Outputs PSObject.

How to use

The file vdf-converter.ps1 has a function:

  • ConvertTo-PSObject - returns the contents of a VDF file as a PSObject

Method 1: Copy a function

You can simply copy the function you need from vdf-converter.ps1 into your own script and use it.

Note

Other utilities in this repository may depend on each other. If you want to simply copy them to your script, keep in mind that you’ll need to resolve these dependencies. If you don’t want to resolve dependencies yourself, use Method 3 listed below.

Method 2: Copy the source file

Copy the vdf-converter.ps1 file and attach it to your script with:

. (Join-Path $PSScriptRoot ./vdf-converter.ps1)

Method 3: Copy the entire suite

To use this whole suite and all of its features, copy the src directory in your PowerShell project, for example, to vdf-converter-powershell directory (relative to where your script is). You can then include whichever source file you need with (example):

. (Join-Path $PSScriptRoot ./vdf-converter-powershell/config-files.ps1)

Use

You can then use it with:

$vdfPSObject = ConvertTo-PSObject -vdfContent $pathToYourVdfFile

Other features

This repository contains other useful features. Here is the list of files and functions:

  • config-files.ps1 - utilities for various Steam configuration files.

    • Get-LibraryFoldersVdf - find and return raw contents of Steam’s libraryfolders.vdf file, or $null if it’s not found. Pass this raw contents to a converter function to get a desired data structure.

  • registry.ps1 - utilities for Steam registry entries.

    • Find-SteamDirectory - finds and returns your Steam installation directory, or returns $null if not found.

Testing

Pester 5.6 is used for unit tests in this project. Please note that Windows is shipped with much older version of Pester. For installation instructions follow the official guide.

To run the whole test suite (all available tests) with code coverage, use the pester.ps1 script:

pwsh .\pester.ps1

Otherwise, you can run individual tests in terminal by following the instructions in Pester quick start guide.

Testing conventions

  • All tests are located in the tests directory or its subdirectories.

  • All test files are following the naming convention *.Tests.ps1.

  • Coverage report is available at ./coverage/coverage.xml (when you run the full test suite, of course);

Support

If you like this tool or find it useful, consider buying me a nice cup of coffee. Coffee fuels open source.

Ko-fi

License

Mozilla Public License 2.0 (also available on Mozilla’s website at: MPL 2.0)