SteamRE / SteamKit

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
GNU Lesser General Public License v2.1
2.51k stars 481 forks source link

got EOF or empty keyname While Reading csgo_english.txt (KeyValues) #258

Open Alamer99 opened 8 years ago

Alamer99 commented 8 years ago

Heres My Code: static void Main(string[] args) { KeyValue csgo_english = new KeyValue(); csgo_english.ReadFileAsText(@"C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\resource\csgo_english.txt"); }

It Ends Up With An Error

System.Exception was unhandled HResult=-2146233088 Message=RecursiveLoadFromBuffer: got EOF or empty keyname Source=SteamKit2 StackTrace: at SteamKit2.KeyValue.RecursiveLoadFromBuffer(KVTextReader kvr) at SteamKit2.KeyValue.RecursiveLoadFromBuffer(KVTextReader kvr) at SteamKit2.KVTextReader..ctor(KeyValue kv, Stream input) at SteamKit2.KeyValue.ReadAsText(Stream input) at SteamKit2.KeyValue.ReadFileAsText(String filename) at Parse_CSGO_Language_File.Program.Main(String[] args) in c:\users------\documents\visual studio 2015\Projects\Parse CSGO Language File\Parse CSGO Language File\Program.cs:line 16 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

Netshroud commented 8 years ago

This is a known issue with how we handle conditionals - see #232.

Alamer99 commented 8 years ago

I Dont Want To Sound Like a Stupid But

Have You Ever Checked Valve's KeyValues.h And KeyValues.cpp

I Know Its C++ But Maybe You Could Find Something

Netshroud commented 8 years ago

Yes. This code is almost a 1:1 port of that.

Interestingly, it's conditional handling is virtually hardcoded, and looks to be somewhat out of date with the latest conditional options (e.g. $PS3).

Alamer99 commented 8 years ago

in my opinion hardcoded conditional is better you dont expect someone to be using SteamKit2 on Xbox/PS3 Right?

Netshroud commented 8 years ago

No, but somebody using SteamKit might want to extract Xbox/PS3 data, or even Linux data when running on Windows, etc.

Alamer99 commented 8 years ago

good point however (not a c++ expert :P) i noticed by reading valve's keyvalues they hardcoded it as _WIN32 so if we change it to _PS3 or _X360 that means it will extract the data we want right? if that works then maybe you can do it that way, make it hardcoded but the user can select which one he wants? (again i'm not a c++ expert that's just what came into my mind :) )

xPaw commented 3 years ago

For anyone looking, this is supported in https://github.com/SteamDatabase/ValveKeyValue

yaakov-h commented 3 years ago

And poorly in https://github.com/SteamRE/SteamKit/pull/684 😅