So basically I was thinking of an undo-redo system (I've heard enough of memmento pattern and command pattern and I'm just gonna REEEEEEEEEE) where you'd make an object of this UndoRedo class inside any class that required a UR system and then every function that can be undone would start by generating a string of code that would undo the action (taking into account things like parameters passed to the function and any other related info) and push it to the undo stack of the URobject, which would handle the 2 stacks appropriately and have functions for undoing and redoing that just pop the code and eval it
Then I found this SO post about how to Eval in c# but it's useless because it's sandboxed and I need the Eval-ed code to communicate with the rest of my code and stuff.
Aucun commentaire:
Enregistrer un commentaire