Code Monkey home page Code Monkey logo

Comments (5)

DrMcCoy avatar DrMcCoy commented on September 23, 2024

@clone2727 had a better idea: introduce a CachedSeekableReadStream (or whatever it should be called) that basically reads into a dynamic memory area, so that it can provide true seeking.

Of course, that's the more complex solution that would be a bit more work than the quick fix I proposed above. Not sure I can give it adequate focus at the moment.

Btw, what exactly is your use-case? What temporary files are you generating and reading and why? Can you guide me through an full example run of what you're doing, so that I can understand what you need?

from xoreos-tools.

DrMcCoy avatar DrMcCoy commented on September 23, 2024

Oh, right, explicitly tagging @lachjames to make sure you actually see this :P

from xoreos-tools.

lachjames avatar lachjames commented on September 23, 2024

Thanks for creating this issue and tagging me in it 👍

Probably the main use case would be reading/editing/writing files (GFF obviously being the main target, but the container structures like RIM and MOD would be useful too (although probably beyond the scope of this issue as it would require more than redirecting stdin).

The text-reading ones (I guess the ones which convert from xml to a given format) are probably fine as you describe them (though admittedly I never thought to try using stdin for them as I assumed it wouldn't work). The ability to take a binary stream and pass it straight through stdin in the same fashion would be fantastic too.

A full example of the workflow I'm imagining would be as follows (for a KOTOR dialog editor):

  • Read the .dlg file using gff2xml
  • Modify the xml using the UI of the tool
  • Save a .dlg file using xml2gff (or perhaps modify a RIM/MOD/ERF file to include it, but again that's beyond the scope of this issue - I might open another issue in relation to this).

Currently, the above workflow involves writing a gff file to disk (if reading it from a RIM/MOD/ERF) to read it with gff2xml, then writing the xml file to disk for xml2gff (though as you say, this is already not necessary).

I think any solution which allows a binary stream to be used as input would be fine. To be honest, the implementation details you discuss are a bit beyond my experience with reading/writing streams so I'll just say that I'm sure you'll make a fine judgement on the method which would be preferable :)

from xoreos-tools.

DrMcCoy avatar DrMcCoy commented on September 23, 2024

Okay, if you want to read GFFs from stdin, that already makes the easy approach moot, because you need proper seeking in GFFs.

That means the cached approach is the way to go. I can't promise when I'll get to that, though.

from xoreos-tools.

lachjames avatar lachjames commented on September 23, 2024

There's no rush at all on this; it's just a suggestion that would make the tool much more efficient when integrating it in our own code via subprocesses. As always, let me know if there's anything I can do to help out :)

from xoreos-tools.

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.