split ReplayRecorderConnection out into its own file
This commit is contained in:
@@ -71,51 +71,4 @@ namespace OpenRA.Network
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
||||
class ReplayRecorderConnection : IConnection
|
||||
{
|
||||
IConnection inner;
|
||||
BinaryWriter writer;
|
||||
|
||||
public ReplayRecorderConnection( IConnection inner, FileStream replayFile )
|
||||
{
|
||||
this.inner = inner;
|
||||
this.writer = new BinaryWriter( replayFile );
|
||||
}
|
||||
|
||||
public int LocalClientId { get { return inner.LocalClientId; } }
|
||||
public ConnectionState ConnectionState { get { return inner.ConnectionState; } }
|
||||
|
||||
public void Send( int frame, List<byte[]> orders ) { inner.Send( frame, orders ); }
|
||||
public void SendImmediate( List<byte[]> orders ) { inner.SendImmediate( orders ); }
|
||||
public void SendSync( int frame, byte[] syncData ) { inner.SendSync( frame, syncData ); }
|
||||
|
||||
public void Receive( Action<int, byte[]> packetFn )
|
||||
{
|
||||
inner.Receive( ( client, data ) =>
|
||||
{
|
||||
writer.Write( client );
|
||||
writer.Write( data.Length );
|
||||
writer.Write( data );
|
||||
packetFn( client, data );
|
||||
} );
|
||||
}
|
||||
|
||||
bool disposed;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if( disposed )
|
||||
return;
|
||||
|
||||
writer.Close();
|
||||
inner.Dispose();
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
~ReplayRecorderConnection()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user