Jacob Campbell
Jacob Campbell
CC#
Created by Jacob Campbell on 5/28/2025 in #help
Parsing/Deserializing Structured File’s Bytes
I’m more asking about structure to make sure it is fast and elegant to execute/read/edit
16 replies
CC#
Created by Jacob Campbell on 5/28/2025 in #help
Parsing/Deserializing Structured File’s Bytes
Gotcha, I’ve got a function already that handles the endianness, so if that’s the only thing, I’m probably gonna keep it as is. There’s no like performance benefit is there? I would assume it just goes through and flips the bit order if it needs to?
16 replies
CC#
Created by Jacob Campbell on 5/28/2025 in #help
Parsing/Deserializing Structured File’s Bytes
So my thought was to read the file as a byte array Separate the header from the compressed portion in an object Write a method for decompressing the compressed portion Write a method for searching for the name of each data type in the file and storing it within the object Then writing methods for the decoding of each header/data type and storing that within the object So calling the class with the byte array would save attributes within the object would look something like (Note: the data names are messages in the file) File.hdr File.decompData File.msgTypes File.msgArray Then there would be methods that check to make sure the messages exist in File.msgTypes and then if they exist, convert them over. The structure of each message is a little different, so I’d have to have different methods for each. File.getHdr: converts the header into readable data (data source, version number, collection date, etc) File.getMsg15: checks to make sure Msg15 exists, converts the header into readable data, then converts the data as specified File.getMsg31: checks to make sure Msg31 exists, converts the header into readable data, then converts the data as specified, etc, etc Does that sound like a sensible way to handle it?
16 replies
CC#
Created by Jacob Campbell on 5/28/2025 in #help
Parsing/Deserializing Structured File’s Bytes
I would assume it’s linear, but not entirely sure what you mean by that 😅 The structure of the file is: File Header Compression (everything below is within the compression) Data Header (contains data name and size of data) Data Data Header (contains data name and size of data) Data Etc Etc
16 replies
CC#
Created by Jacob Campbell on 5/28/2025 in #help
Parsing/Deserializing Structured File’s Bytes
Just looked through that, that’s super helpful, thanks!
16 replies
CC#
Created by Jacob Campbell on 5/28/2025 in #help
Parsing/Deserializing Structured File’s Bytes
Is there a benefit to doing that over BitConverter? Because that’s what I’ve been using, and it’s been working fine
16 replies
CC#
Created by Jacob Campbell on 5/28/2025 in #help
Parsing/Deserializing Structured File’s Bytes
And forgive me if I’m using terminology incorrectly, I took one OOP class in college maybe 5 years ago and it was in Python. So I remember the gist of OOP but don’t remember the terminology as well
16 replies