public override void undo() { ImageDefinition def = LegacyEditorData.instance.currentImageDef; //Revert the property to it's previous value PropertyInfo prop = def.GetType().GetProperty(propertyToModify); prop.SetValue(def, propertyToModifyPreviousValue); }
public override void execute() { ImageDefinition def = LegacyEditorData.instance.currentImageDef; //Get the previous value of the property, then change it PropertyInfo prop = def.GetType().GetProperty(propertyToModify); propertyToModifyPreviousValue = prop.GetValue(def); object valueToSet = propertyToModifyNextValue; prop.SetValue(def, valueToSet); }
private string GetProperty(ImageDefinition def) { PropertyInfo prop = def.GetType().GetProperty(propertyName); return(prop.GetValue(def).ToString()); }