Git Product home page Git Product logo

Comments (19)

Bluscream avatar Bluscream commented on June 10, 2024 1

Oh WOW, i gave it the filepath, not its contents 🤦

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

Looks like the issue is caused by the platform conditionals. Vdf.NET has intentionally not supported them so far. I'll try to work on it.

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

Thanks

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

@Bluscream In the off chance that you're blocked on this, you could use a regex to strip the source data of conditionals and then parse that. It would come at the cost of some performance, but probably not unusable.

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

Uhh, is that really needed?

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

It won't be needed once proper support for conditionals is added to the library. If you need something that works until then, using a regex is an option.

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

Ill just wait, thank you ^^

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

Now i've got the same error when reading the gameinfo.txt of the sourcemod "Too Many Crates!"

image

gameinfo.txt
"GameInfo"
{
		// This is what shows up in the 'Third Party Games' area of the Steam games list.
	game		"Too Many Crates!"
	type 		singleplayer_only
	developer	"AwesomePossumGames"		
        developer_url	"http://classes.dma.ucla.edu/Fall07/161A/projects/kyle/portfolio/index.html"
	icon		"materials/icon"

	FileSystem
	{
		SteamAppId				215		// GCF for Source SDK Base
		ToolsAppId				211		// Tools will load this (ie: source SDK caches) to get things like materials\debug, materials\editor, etc.
		
		//
		// The code that loads this file automatically does a few things here:
		//
		// 1. For each "Game" search path, it adds a "GameBin" path, in <dir>\bin
		// 2. For each "Game" search path, it adds another "Game" path in front of it with _<langage> at the end.
		//    For example: c:\hl2\cstrike on a french machine would get a c:\hl2\cstrike_french path added to it.
		// 3. For the first "Game" search path, it adds a search path called "MOD".
		// 4. For the first "Game" search path, it adds a search path called "DEFAULT_WRITE_PATH".
		//

		//
		// Search paths are relative to the base directory, which is where hl2.exe is found.
		//
		// |gameinfo_path| points at the directory where gameinfo.txt is.
		// We always want to mount that directory relative to gameinfo.txt, so
		// people can mount stuff in c:\mymod, and the main game resources are in
		// someplace like c:\program files\valve\steam\steamapps\half-life 2.
		//
		SearchPaths
		{
			Game				|gameinfo_path|.
			Game				hl2
		}
	}
}

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

"Incomplete data" is a vague error, couldn't you show at which line/column the parser shits itself?

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

"Incomplete data" is a vague error, couldn't you show at which line/column the parser shits itself?

That would be a pretty neat feature, thanks for the suggestion. Do you mind creating a separate issue for it?

Now i've got the same error when reading the gameinfo.txt of the sourcemod "Too Many Crates!"

The file you posted seems to be missing a lot of double-quotes. Is that accurate?

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

That's what the mod ships by default. I tried a bunch of different gameinfo.txt files from different games and mods and they all throw the same error

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

even the ones officially from HL2 use that format

image

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

I just tested with the gameinfo.txt file you provided and it seems to parse correctly. The code I used to test:

dynamic res = VdfConvert.Deserialize(File.ReadAllText("gameinfo.txt"));
Console.WriteLine(res.Value.FileSystem.SearchPaths.Game);

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

https://github.com/Bluscream/GMod-Mount-Manager/blob/master/Classes/GameInfo.cs#L46

this is my code

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

I just tested with the gameinfo.txt file you provided and it seems to parse correctly.

maybe it has to do with the line endings or encoding?

image

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

maybe it has to do with the line endings or encoding?

No way for me to tell unless you send me the raw file. Line endings can vary from line to line so your screenshot is insufficient. However, the parser already supports all line-endings so that's unlikely to be the issue.

from gameloop.vdf.

Bluscream avatar Bluscream commented on June 10, 2024

gameinfo.txt

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

Just tried running with your file. Deserialization succeeds as expected. Try creating a new project and running:

dynamic res = VdfConvert.Deserialize(File.ReadAllText("gameinfo.txt"));
Console.WriteLine(res.Value.FileSystem.SearchPaths.Game);

from gameloop.vdf.

shravan2x avatar shravan2x commented on June 10, 2024

Support added in eb8b8b8 .

from gameloop.vdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.