public virtual async Task <byte[]> ExportAsync(SourceDemo demo) { var buf = new SourceBufferWriter(); await demo.WriteHeader(buf).ConfigureAwait(false); await demo.WriteMessagesAsync(buf).ConfigureAwait(false); return(buf.Data); }
public virtual async Task WriteMessagesAsync(SourceBufferWriter buf) { foreach (var message in Messages) { buf.Write(message.Code); buf.Write(message.Tick); if (message.Slot.HasValue) { buf.Write(message.Slot.Value); } await message.Write(buf, this).ConfigureAwait(false); } }
public virtual Task WriteHeader(SourceBufferWriter buf) { buf.Write(HeaderId); buf.Write(Protocol); buf.Write(NetworkProtocol); buf.WriteString(ServerName.AsSpan(), 260); buf.WriteString(ClientName.AsSpan(), 260); buf.WriteString(MapName.AsSpan(), 260); buf.WriteString(GameDirectory.AsSpan(), 260); buf.Write(PlaybackTime); buf.Write(PlaybackTicks); buf.Write(PlaybackFrames); buf.Write(SignOnLength); return(Task.CompletedTask); }