kaitai-io / kaitai_struct

Kaitai Struct: declarative language to generate binary data parsers in C++ / C# / Go / Java / JavaScript / Lua / Nim / Perl / PHP / Python / Ruby
https://kaitai.io
4.04k stars 199 forks source link

C# Serialization #1113

Open adriansuciu09 opened 5 months ago

adriansuciu09 commented 5 months ago

I was wondering if there are any plans to add serialization for C# to be able to generate read-write classes like for Python and Java (source: https://doc.kaitai.io/serialization.html)

generalmimon commented 5 months ago

@zachwolfe should have already done that, but to my knowledge it hasn't been reviewed or integrated to the official testing suite like Java and Python, so I don't have any comprehensive measure of how well it works with different .ksy specs. I believe it should work mostly fine, though.

adriansuciu09 commented 5 months ago

Ok, i tried it using versio. 0.9, since in the documentation it said that version 0.10 is missing the serialization grafik i will try it with your link

adriansuciu09 commented 5 months ago

im testing in a Docker container. i already checkout the serialization branch. here is my dockerfile:

FROM openjdk:11-jre-slim

# Install sbt
WORKDIR /sbt
RUN apt-get update \
&& apt-get install -y wget \
&& wget https://github.com/sbt/sbt/releases/download/v1.5.0/sbt-1.5.0.tgz \
&& tar xzvf sbt-1.5.0.tgz -C /usr/share/ \
&& update-alternatives --install /usr/bin/sbt sbt /usr/share/sbt/bin/sbt 9999

# Install 'kaitai-struct-compiler'
WORKDIR /app
RUN apt-get install -y git \
&& git clone -b serialization https://github.com/filestar/kaitai_struct_compiler.git
WORKDIR /app/kaitai_struct_compiler
RUN sbt --error compilerJVM/stage

ENTRYPOINT ["./jvm/target/universal/stage/bin/kaitai-struct-compiler"]