private void UpdateRuntimeStates(IStorage storage, RuntimeStates runtimeStates) { DataHeader header = new DataHeader(); header.Deserialize(storage); runtimeStates.Deserialize(storage); }
internal void RecordRuntimeStatesForUndo(RuntimeStates runtimeStates) { if (actionCount < 0) throw new InvalidOperationException("BeginGroup() is not called"); if (runtimeStates == null) throw new ArgumentNullException("runtimeStates"); this.RecordRuntimeStates(this.undoStorage, runtimeStates, UserAction.RuntimeStates); this.actionCount++; }
private void RecordRuntimeStates(IStorage storage, RuntimeStates runtimeStates, UserAction userAction) { DataHeader header = new DataHeader(); long initialPosition = storage.GetPosition(); //Record states storage.Seek(header.HeaderSize, SeekOrigin.Current); long initialPositionForData = storage.GetPosition(); runtimeStates.Serialize(storage); long currentPositionforData = storage.GetPosition(); header.DataSize = currentPositionforData - initialPositionForData; storage.Seek(-(header.HeaderSize + header.DataSize), SeekOrigin.Current); header.Serialize(storage); storage.Seek(header.DataSize, SeekOrigin.Current); this.RecordFlag(storage, initialPosition, userAction); }
public void TestRecordRuntimeStatesForUndo00() { GraphController graphController = new GraphController(null); UndoRedoRecorder urr = new UndoRedoRecorder(graphController); RuntimeStates runtimeStates = new RuntimeStates(); Assert.Throws<InvalidOperationException>(() => { urr.RecordRuntimeStatesForUndo(runtimeStates); }); }