47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using TeaBox.ObjectModel.Transactions;
|
|
using System.IO;
|
|
using JD.Application.Actions;
|
|
using JD.Application.Model.UndoRedo;
|
|
using JD.Audio.Annotations;
|
|
using JD.Audio.Sound;
|
|
using JD.Remoting;
|
|
|
|
namespace TempoBlaster.Model
|
|
{
|
|
public class TrackUndoer : Undoer<Wave>
|
|
{
|
|
public TrackUndoer(Wave model, CommandStack commandStack)
|
|
: base(model, commandStack)
|
|
{
|
|
}
|
|
|
|
public TrackUndoer(Wave model, CommandStack commandStack, IModerator moderator)
|
|
: base(model, commandStack, moderator)
|
|
{
|
|
}
|
|
|
|
protected override void SaveState(Wave model, Stream stream)
|
|
{
|
|
Deserialize(model, stream);
|
|
}
|
|
|
|
protected override void RestoreState(Wave model, Stream stream)
|
|
{
|
|
Serialize(model, stream);
|
|
}
|
|
|
|
public void Deserialize(Wave wave, Stream stream)
|
|
{
|
|
Blob blob = new Blob(stream);
|
|
|
|
blob.Push(new LuaAnnotations(wave).SaveToText());
|
|
}
|
|
|
|
public void Serialize(Wave wave, Stream stream)
|
|
{
|
|
Blob blob = new Blob(stream, true);
|
|
|
|
new LuaAnnotations(wave).LoadFromText(blob.ExtractString());
|
|
}
|
|
}
|
|
}
|