I'm fairly new to C# by the way and need to convert .ddd (digital tachograph output file extension) to .xml.
As a first step I should read the file, so I'm looking at examples. Every source of information I find are using .txt based examples on reading a file. The file type in my example, .ddd, is nowhere near that.
I'm thinking about binary read but not sure about that either. What is the correct way for this?
To perform the conversion you need to know:
Reading binary data from a file is fairly simple - the
BinaryReaderhas all kinds of methods to access the data, especially if the data can be processed in a single forward pass (which seems to be the case). There are tons ofBinaryReaderexamples out there.What's more important is knowledge of what the data means. A single byte, with the value
0x20could mean:32UInt16with an entirely different valueWithout information about what each byte at each position means, you won't get anywhere.
Then with that information, and having read the file into some fitting class(es), the conversion to Xml could be as simple as passing the class to an
XmlSerializer.