Skip to content

Commit

Permalink
Merge pull request #470 from AndrisBorbas/catch-vdf
Browse files Browse the repository at this point in the history
Catch vdf errors
  • Loading branch information
Iridium-IO authored Jan 24, 2025
2 parents f000abe + 8754aae commit d173720
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions CompactGUI/Helper.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ Module Helper
If Not parentfolder?.Name = "steamapps" Then Return Nothing

For Each fl In parentfolder.EnumerateFiles("*.acf").Where(Function(f) f.Length > 0)
Dim vConv = VdfConvert.Deserialize(File.ReadAllText(fl.FullName))
If vConv.Value.Item("installdir").ToString = workingDir.Name Then
Dim appID = CInt(vConv.Value.Item("appid").ToString)
Dim sName = vConv.Value.Item("name").ToString
Dim sInstallDir = vConv.Value.Item("installdir").ToString
Return (appID, sName, sInstallDir)
'TODO: Maybe add check to see when game was last updated?
End If
Try
Dim vConv = VdfConvert.Deserialize(File.ReadAllText(fl.FullName))
If vConv.Value.Item("installdir").ToString = workingDir.Name Then
Dim appID = CInt(vConv.Value.Item("appid").ToString)
Dim sName = vConv.Value.Item("name").ToString
Dim sInstallDir = vConv.Value.Item("installdir").ToString
Return (appID, sName, sInstallDir)
'TODO: Maybe add check to see when game was last updated?
End If
Catch
Debug.WriteLine($"VDF file unsupported: {fl.FullName}")
End Try
Next

Return Nothing
Expand Down

0 comments on commit d173720

Please sign in to comment.