Exemple #1
0
 internal void DoSnapshot(UndoSnapshot snapshot)
 {
     if (snapshot.unmanagedData != null)
     {
         var stream = new MemoryStream(snapshot.unmanagedData, false);
         reader = new BinaryReader(stream);
     }
     else
     {
         reader = null;
     }
     managed = snapshot.managedReferences;
     refId   = 0;
 }
Exemple #2
0
        internal UndoSnapshot Build()
        {
            byte[] buffer = null;
            if (stream.Position > 0)
            {
                buffer = new byte[stream.Position];
                Array.Copy(stream.GetBuffer(), buffer, stream.Position);
            }
            var result = new UndoSnapshot(currentTarget, managedRefs.Count > 0 ? managedRefs.ToArray() : null, buffer);

            stream.Position = 0;
            managedRefs.Clear();
            currentTarget = null;
            return(result);
        }
Exemple #3
0
 public void RevertToUndoSnapshot(ModelObject target, UndoSnapshot snapshot)
 {
     snapshotReader.DoSnapshot(snapshot);
     ReadUndo(target, snapshotReader);
 }