Some stuff for the upcoming change
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
|
||||
namespace RageCoop.Core
|
||||
{
|
||||
@ -21,20 +20,17 @@ namespace RageCoop.Core
|
||||
internal class ConnectionRequest : Packet
|
||||
{
|
||||
public int TargetID { get; set; }
|
||||
public IPEndPoint InternalEndPoint { get; set; }
|
||||
public override PacketType Type => PacketType.ConnectionRequest;
|
||||
public override byte[] Serialize()
|
||||
{
|
||||
var data=new List<byte>(10);
|
||||
data.AddInt(TargetID);
|
||||
data.AddString(InternalEndPoint.ToString());
|
||||
return data.ToArray();
|
||||
}
|
||||
public override void Deserialize(byte[] array)
|
||||
{
|
||||
var reader=new BitReader(array);
|
||||
TargetID = reader.ReadInt32();
|
||||
InternalEndPoint=CoreUtils.StringToEndPoint(reader.ReadString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Lidgren.Network;
|
||||
using System.Net;
|
||||
|
||||
namespace RageCoop.Core
|
||||
{
|
||||
@ -32,6 +32,7 @@ namespace RageCoop.Core
|
||||
/// </summary>
|
||||
public byte[] PasswordEncrypted { get; set; }
|
||||
|
||||
public IPEndPoint InternalEndPoint { get; set; }
|
||||
public override byte[] Serialize()
|
||||
{
|
||||
|
||||
@ -50,6 +51,8 @@ namespace RageCoop.Core
|
||||
byteArray.AddRange(BitConverter.GetBytes(modVersionBytes.Length));
|
||||
byteArray.AddRange(modVersionBytes);
|
||||
|
||||
byteArray.AddString(InternalEndPoint.ToString());
|
||||
|
||||
// Write AesKeyCrypted
|
||||
byteArray.AddArray(AesKeyCrypted);
|
||||
|
||||
@ -78,6 +81,8 @@ namespace RageCoop.Core
|
||||
// Read ModVersion
|
||||
ModVersion = reader.ReadString();
|
||||
|
||||
InternalEndPoint=CoreUtils.StringToEndPoint(reader.ReadString());
|
||||
|
||||
AesKeyCrypted=reader.ReadByteArray();
|
||||
|
||||
AesIVCrypted=reader.ReadByteArray();
|
||||
|
Reference in New Issue
Block a user