private Datagram ProcessLogin(Datagram requestDatagram) { Datagram result = Datagram.GetResponse(requestDatagram); result.FullDatagram = new byte[] { 0xAA, 0xBB, 0x00, 0x10, 0xA0, 0x03, 0x00, 0x0C, 0x05, 0x10, 0x08, 0x09, 0x0A, 0x00, 0x00, 0x00 }; return result; }
private Datagram ProcessHeartbeat(Datagram requestDatagram) { Datagram result = Datagram.GetResponse(requestDatagram); result.FullDatagram = new byte[] { 0xAA, 0xBB, 0x00, 0x08, 0xA0, 0x01, 0x00, 0x00 }; return result; }
private Datagram ProcessCurrency(Datagram requestDatagram) { Datagram result = Datagram.GetResponse(requestDatagram); result.FullDatagram = new byte[] { 0xAA, 0xBB, 0x00, 0x09, 0xA0, 0x0A, 0x00, 0x00, 0x00 }; return result; }
private Datagram ProcessBlacklistQuery(Datagram requestDatagram) { Datagram result = Datagram.GetResponse(requestDatagram); result.FullDatagram = new byte[] { 0xAA, 0xBB, 0x00, 0x0D, 0xA0, 0x05, 0x0C, 0x05, 0x02, 0x00, 0x64, 0x00, 0x00 }; return result; }
private Datagram ProcessBlacklistDownload(Datagram requestDatagram) { Datagram result = Datagram.GetResponse(requestDatagram); result.FullDatagram = new byte[] { 0xAA, 0xBB, 0x00, 0x1A, 0xA0, 0x06, 0x00, 0x00, 0x64, 0x07, 0xD5, (byte)'H', (byte)'D', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', 0x00, 0x00, 0x00 }; return result; }
public static Datagram GetResponse(Datagram request) { if (request.CommandCode.SequenceEqual(HeartbeatRequest.FixCommandCode) && request.FullDatagram.Length == HeartbeatRequest.Length) { return new HeartbeatResponse(); } if (request.CommandCode.SequenceEqual(HeartbeatResponse.FixCommandCode) && request.FullDatagram.Length == HeartbeatResponse.Length) { return new HeartbeatRequest(); } if (request.CommandCode.SequenceEqual(LoginRequest.FixCommandCode) && request.FullDatagram.Length == LoginRequest.Length) { return new LoginResponse(); } if (request.CommandCode.SequenceEqual(LoginResponse.FixCommandCode) && request.FullDatagram.Length == LoginResponse.Length) { return new CurrencyRequest(); } if (request.CommandCode.SequenceEqual(BlacklistQueryRequest.FixCommandCode) && request.FullDatagram.Length == BlacklistQueryRequest.Length) { return new BlacklistQueryRequest(); } if (request.CommandCode.SequenceEqual(BlacklistQueryResponse.FixCommandCode) && request.FullDatagram.Length == BlacklistQueryResponse.Length) { return new BlacklistQueryRequest(); } if (request.CommandCode.SequenceEqual(BlacklistDownloadRequest.FixCommandCode) && request.FullDatagram.Length == BlacklistDownloadRequest.Length) { return new BlacklistDownloadRequest(); } if (request.CommandCode.SequenceEqual(BlacklistDownloadResponse.FixCommandCode) && request.FullDatagram.Length == BlacklistDownloadResponse.Length) { return new BlacklistDownloadResponse(); } if (request.CommandCode.SequenceEqual(CurrencyRequest.FixCommandCode) && request.FullDatagram.Length == CurrencyRequest.Length) { return new CurrencyResponse(); } if (request.CommandCode.SequenceEqual(CurrencyResponse.FixCommandCode) && request.FullDatagram.Length == CurrencyResponse.Length) { return new CurrencyRequest(); } return null; }