Interface ICommandCodec
- Namespace
- TDMaker.Core
- Assembly
- TDMaker.Core.dll
Optional persistence for custom commands. Type IDs 1024 and above belong to applications.
public interface ICommandCodec
Examples
log.WriteTo(stream, new StanceCommandCodec());
Methods
GetTypeId(ICommand)
Returns a stable application-defined ID, or zero for an unsupported command.
int GetTypeId(ICommand command)
Parameters
commandICommand
Returns
ReadPayload(int, BinaryReader)
Reads one payload or throws for an unknown or invalid command.
ICommand ReadPayload(int typeId, BinaryReader reader)
Parameters
typeIdintreaderBinaryReader
Returns
WritePayload(BinaryWriter, ICommand)
Writes a custom immutable command payload. Called only outside fixed ticks.
void WritePayload(BinaryWriter writer, ICommand command)
Parameters
writerBinaryWritercommandICommand