using System; using System.Collections; using System.Collections.Generic; using System.IO; using Microsoft.SqlServer.Server; namespace BITKit.CommandPattern { public interface ICommand { void Execute(); void Undo(); } public interface ICommandService { ICommand[] Commands { get; } event Action OnExecute; event Action OnClear; event Action OnUndo; event Action OnRelease; void Execute(ICommand command); void Undo(); void Undo(int count); void Redo(); void Trace(ICommand command); void Clear(); void Rebuild(); void Release(); } public sealed class CommandSequence:List,Microsoft.SqlServer.Server.IBinarySerialize { public void Read(BinaryReader r) { Clear(); var count = r.ReadInt32(); for (var i = 0; i ()); } } public void Write(BinaryWriter w) { w.Write(Count); foreach (var x in this) { BITBinary.Write(w,x); } } } }