2

Closed

Allow serializing to user provided stream

description

I was wanting to be able to serialize the KML directly to any stream (so when I'm returning KML from a web api call, I don't have to write it out to memory first, I could write just to the response stream directly).

I've implemented my quick and dirty take on the code here: https://github.com/dfaivre/SharpKml. If there is any interest to include this functionality in the project, I'd be more than happy to clean it up (my default resharper settings mangled the formatting, so I'd need to roll that back). I'm not sure how to contribute patches on CodePlex, so I'd need some guidance.

Great library -- so glad it exists, thanks for all your work!
Closed Jan 3, 2016 at 8:07 PM by samcragg

comments

samcragg wrote Dec 31, 2015 at 9:30 AM

Thanks for that, looks like a simple but useful change (the SharpKml.Engine.KmlFile could make use of the overload as well).

I might take the opportunity to add some async support for the stream operations, however, it does mean dropping .NET 4 support (which should be OK, as Microsoft will drop support for it on the 12th Jan 2016)

I'll do an oldschool copy/paste of the method and update this issue when it's done.

Thanks again for contributing!

wrote Dec 31, 2015 at 9:30 AM

wrote Jan 3, 2016 at 8:07 PM

Resolved with changeset 44516: Added the ability to serialize to a Stream.

samcragg wrote Jan 3, 2016 at 8:08 PM

I've checked in the changes to the source code, however, I need to update the NuGet package when I get a bit more free time.

dfaivre wrote Jan 5, 2016 at 7:54 PM

Glad you could use the code -- let me know if you run into any issues. Thanks again for the project!