0

Problem

I have a large file that was serialized using BinaryFormatter that I need to create a class for, so that I can serialize similar files.

What I have tried

I came across this answer that explains how to do this manually.

However, the file I have is over 500kB, so this would take a very long time by hand.

Question

Is there a way to automatically get the structure(s) described within the file?

Tyler
  • 85
  • 8
  • 1
    You need to use the same classes that were used to serialize. Do you have the original classes? It also may need to be done with same Net/Core version that was used to serialize. – jdweng Aug 02 '23 at 20:17
  • I do not have the original classes. I started working through using the [answer](https://stackoverflow.com/a/30176566/17263281) that I mentioned and was able to get a bit of it loaded. But looking at my progress it will likely take weeks to get through the whole file. – Tyler Aug 03 '23 at 11:36
  • See following : https://github.com/bbowyersmyth/BinaryFormatDataStructure – jdweng Aug 03 '23 at 12:13
  • That has helped a lot. However, I am seeing some variables that have forward slashes (`/`) within the variable name (e.g. `Item5/B`). This is obviously not possible in C#, and I am having difficulty finding what that could represent. – Tyler Aug 03 '23 at 14:51
  • I used xml serializer and got following `Item5_x002F_B` – jdweng Aug 03 '23 at 17:23
  • I tried naming a property `Item5_x002F_B`, but it just put `Item5_x002F_B` into the file when serializing using `BinaryFormatter`. How do I get it to serialize as `Item5/B` instead? – Tyler Aug 03 '23 at 17:30
  • Don't know. Maybe `/` – jdweng Aug 03 '23 at 18:46
  • How would that allow me to serialize the variable name with a `/` in it? I feel like I am missing something here. – Tyler Aug 03 '23 at 19:54

0 Answers0