예제 #1
0
 private void UpdateRuntimeStates(IStorage storage, RuntimeStates runtimeStates)
 {
     DataHeader header = new DataHeader();
     header.Deserialize(storage);
     runtimeStates.Deserialize(storage);
 }
예제 #2
0
        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++;
        }
예제 #3
0
        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);
        }
예제 #4
0
        public void TestRecordRuntimeStatesForUndo00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);
            RuntimeStates runtimeStates = new RuntimeStates();

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.RecordRuntimeStatesForUndo(runtimeStates);
            });
        }