I wrote a class that takes an object and outputs a .cs file with code that generates that object. Aka an object to class converter.
I'm making this because I'm writing my own custom Windows-forms within monogame, and I want to replicate the experience you get coding with Windows forms/Qt.
My issue is that Monogame's Color does not expose its 'innards', and that I cannot serialize it.
Color test = new Color();
List<string> dependencies = new List<string>();
Debug.WriteLine("Serialation of test color;\n" + CSCreator.CreateFields(test, ref dependencies));
This should output something like
byte R = 55, byte G = 87; byte B = 9; byte A = 98;
But instead it outputs nothing. This is because color.GetType().GetFields() outputs nothing.
Of course I could write an exception for Color, but I'd much rather find a generic way to handle all Monogame objects like this. I'm not sure when this is going to happen with what objects.
Edit: on looking at the source code for color, I saw it uses the
It seems like I have to write a method that will invoke Deconstruct, which will be difficult, as every object has a different set of parameters, but it should be manageable.