Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS2 - Read file header info #322

Open
ndorigatti opened this issue Oct 17, 2024 · 2 comments
Open

CS2 - Read file header info #322

ndorigatti opened this issue Oct 17, 2024 · 2 comments

Comments

@ndorigatti
Copy link

Hello,
I'm opening a new issue related to CS2 replays. I take as reference the issue #321 where i've put the replay file.

Taking as a reference the project https://github.com/LaihoE/demoparser
I'm trying to get the header of this file in the same way is possible in the python project.

As a reference, in python is just:

header = parser.parse_header()
  print("** Map is: " + header["map_name"])
  print("** GUID is:" + header["demo_version_guid"])
  print("****** Last Tick Parsed ******")

I tryed to do in clarity the following:

     @OnMessage
    public void onMessage(Context ctx, GeneratedMessage message) {
        if (isHeader(message)) {
            logger.debug(message.toString());
            final Demo.CDemoFileHeader headers = (Demo.CDemoFileHeader) message;
            logger.info("********");
            logger.info("map name: {}", headers.getMapName());
            logger.info("Guid: {}", headers.getDemoVersionGuid());
            logger.info("Server start tick: {}", headers.getServerStartTick());
        }
//        log.info("{}", event.toString());
    }

And it works, but this way is an event "listener", is it possible to retrieve it programmatically on need?
Given
Demo.CDemoFileInfo info = Clarity.infoForFile(demofile);

the infoForFile does not retrieve it and i can't find any other way...

@spheenik
Copy link
Member

@OnMessage(Demo.CDemoFilerHeader.class) does the trick.

@spheenik
Copy link
Member

Regarding file info: It's not in there. It's a Dota-thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants