/// <summary> /// Undos a transaction without changing the undo stack. /// This method can cause inconsistencies in the undo system and should be used with care. /// </summary> public void UndoTransactionNoPush(Transaction.Transaction transaction) { switch (transaction) { case WireTransaction wt: Wires.RevertTransaction(wt); break; case GateTransaction gt: Gates.RevertTransaction(gt); break; case BundledTransaction bt: { foreach (var bundled in bt.BundledTransactions) { UndoTransactionNoPush(bundled); } break; } default: throw new Exception($"Unknown transaction type! {transaction.GetType()}"); } }
/// <summary> /// Undos a transaction without changing the undo stack. /// This method can cause inconsistencies in the undo system and should be used with care. /// </summary> public void UndoTransactionNoPush(Transaction.Transaction transaction) { switch (transaction) { case WireTransaction wt: Wires.RevertTransaction(wt); // Update the subnets, but in reverse UpdateSubnets(wt.Deleted, wt.Created); break; case GateTransaction gt: Gates.RevertTransaction(gt); if (gt.ConnectionPointWireEdits != null) { Wires.RevertTransaction(gt.ConnectionPointWireEdits); } // FIXME: Clean this up, this is just so that we can get something simulating this.RemoveComponent(gt.Gate); // Update the subnets, but in reverse UpdateSubnets( gt.ConnectionPointWireEdits?.DeletedWires ?? new List <Wire>(), gt.ConnectionPointWireEdits?.CreatedWires ?? new List <Wire>()); break; case BundledTransaction bt: { foreach (var bundled in bt.BundledTransactions) { UndoTransactionNoPush(bundled); } break; } default: throw new Exception($"Unknown transaction type! {transaction.GetType()}"); } }