This commit is contained in:
Sardelka
2022-08-06 10:49:55 +08:00
parent 742e7ea998
commit 9aae315e11
16 changed files with 24 additions and 25 deletions

View File

@ -10,7 +10,7 @@ namespace RageCoop.Core
internal class ChatMessage : Packet
{
public override PacketType Type { get { return PacketType.ChatMessage; } }
public override PacketType Type => PacketType.ChatMessage;
private Func<string, byte[]> crypt;
private Func<byte[], byte[]> decrypt;
public ChatMessage(Func<string, byte[]> crypter)

View File

@ -9,7 +9,7 @@ namespace RageCoop.Core
internal class CustomEvent : Packet
{
public override PacketType Type { get { return (_queued ? PacketType.CustomEventQueued : PacketType.CustomEvent); } }
public override PacketType Type => (_queued ? PacketType.CustomEventQueued : PacketType.CustomEvent);
public CustomEvent(Func<byte,BitReader,object> onResolve = null,bool queued=false)
{
_resolve= onResolve;

View File

@ -18,7 +18,7 @@ namespace RageCoop.Core
{
internal class FileTransferRequest : Packet
{
public override PacketType Type { get { return PacketType.FileTransferRequest; } }
public override PacketType Type => PacketType.FileTransferRequest;
public int ID { get; set; }
public string Name { get; set; }
@ -61,7 +61,7 @@ namespace RageCoop.Core
internal class FileTransferResponse : Packet
{
public override PacketType Type { get { return PacketType.FileTransferResponse; } }
public override PacketType Type => PacketType.FileTransferResponse;
public int ID { get; set; }
public FileResponse Response { get; set; }
public override byte[] Serialize()
@ -88,7 +88,7 @@ namespace RageCoop.Core
internal class FileTransferChunk : Packet
{
public override PacketType Type { get { return PacketType.FileTransferChunk; } }
public override PacketType Type => PacketType.FileTransferChunk;
public int ID { get; set; }
public byte[] FileChunk { get; set; }
@ -122,7 +122,7 @@ namespace RageCoop.Core
internal class FileTransferComplete : Packet
{
public override PacketType Type { get { return PacketType.FileTransferComplete; } }
public override PacketType Type => PacketType.FileTransferComplete;
public int ID { get; set; }
public override byte[] Serialize()
@ -148,7 +148,7 @@ namespace RageCoop.Core
internal class AllResourcesSent : Packet
{
public override PacketType Type { get { return PacketType.AllResourcesSent; } }
public override PacketType Type => PacketType.AllResourcesSent;
public override byte[] Serialize()
{
return new byte[0];

View File

@ -8,7 +8,7 @@ namespace RageCoop.Core
{
internal class PingPong : Packet
{
public override PacketType Type { get { return PacketType.PingPong; } }
public override PacketType Type => PacketType.PingPong;
public override byte[] Serialize()
{
return new byte[0];

View File

@ -141,7 +141,6 @@ namespace RageCoop.Core
byte[] Serialize();
void Deserialize(byte[] data);
void Pack(NetOutgoingMessage message);
}
internal abstract class Packet : IPacket

View File

@ -13,7 +13,7 @@ namespace RageCoop.Core
internal class PedSync : Packet
{
public override PacketType Type { get { return PacketType.PedSync; } }
public override PacketType Type => PacketType.PedSync;
public int ID { get; set; }
public int OwnerID { get; set; }

View File

@ -10,7 +10,7 @@ namespace RageCoop.Core
{
internal class Handshake : Packet
{
public override PacketType Type { get { return PacketType.Handshake; } }
public override PacketType Type => PacketType.Handshake;
public int PedID { get; set; }
public string Username { get; set; }
@ -90,7 +90,7 @@ namespace RageCoop.Core
public class PlayerConnect : Packet
{
public override PacketType Type { get { return PacketType.PlayerConnect; } }
public override PacketType Type => PacketType.PlayerConnect;
public int PedID { get; set; }
public string Username { get; set; }
@ -132,7 +132,7 @@ namespace RageCoop.Core
public class PlayerDisconnect : Packet
{
public override PacketType Type { get { return PacketType.PlayerDisconnect; } }
public override PacketType Type => PacketType.PlayerDisconnect;
public int PedID { get; set; }
public override byte[] Serialize()
@ -156,7 +156,7 @@ namespace RageCoop.Core
}
public class PlayerInfoUpdate : Packet
{
public override PacketType Type { get { return PacketType.PlayerInfoUpdate; } }
public override PacketType Type => PacketType.PlayerInfoUpdate;
/// <summary>
/// Ped ID for this Player
@ -205,7 +205,7 @@ namespace RageCoop.Core
public class PublicKeyResponse : Packet
{
public override PacketType Type { get { return PacketType.PublicKeyResponse; } }
public override PacketType Type => PacketType.PublicKeyResponse;
public byte[] Modulus;
public byte[] Exponent;
@ -235,7 +235,7 @@ namespace RageCoop.Core
public class PublicKeyRequest : Packet
{
public override PacketType Type { get { return PacketType.PublicKeyRequest; } }
public override PacketType Type => PacketType.PublicKeyRequest;
public override byte[] Serialize()
{

View File

@ -10,7 +10,7 @@ namespace RageCoop.Core
{
internal class ProjectileSync : Packet
{
public override PacketType Type { get { return PacketType.ProjectileSync; } }
public override PacketType Type => PacketType.ProjectileSync;
public int ID { get; set; }
public int ShooterID { get; set; }

View File

@ -11,7 +11,7 @@ namespace RageCoop.Core
internal class BulletShot : Packet
{
public override PacketType Type { get { return PacketType.BulletShot; } }
public override PacketType Type => PacketType.BulletShot;
public int OwnerID { get; set; }
public uint WeaponHash { get; set; }

View File

@ -10,7 +10,7 @@ namespace RageCoop.Core
{
internal class EnteredVehicle : Packet
{
public override PacketType Type { get { return PacketType.EnteredVehicle; } }
public override PacketType Type => PacketType.EnteredVehicle;
public int PedID { get; set; }
public int VehicleID { get; set; }

View File

@ -10,7 +10,7 @@ namespace RageCoop.Core
{
internal class EnteringVehicle : Packet
{
public override PacketType Type { get { return PacketType.EnteringVehicle; } }
public override PacketType Type => PacketType.EnteringVehicle;
public int PedID { get; set; }
public int VehicleID { get; set; }

View File

@ -11,7 +11,7 @@ namespace RageCoop.Core
internal class LeaveVehicle : Packet
{
public override PacketType Type { get { return PacketType.LeaveVehicle; } }
public override PacketType Type => PacketType.LeaveVehicle;
public int ID { get; set; }

View File

@ -10,7 +10,7 @@ namespace RageCoop.Core
{
internal class NozzleTransform : Packet
{
public override PacketType Type { get { return PacketType.NozzleTransform; } }
public override PacketType Type => PacketType.NozzleTransform;
public int VehicleID { get; set; }
public bool Hover { get; set; }

View File

@ -11,7 +11,7 @@ namespace RageCoop.Core
internal class OwnerChanged : Packet
{
public override PacketType Type { get { return PacketType.OwnerChanged; } }
public override PacketType Type => PacketType.OwnerChanged;
public int ID { get; set; }
public int NewOwnerID { get; set; }

View File

@ -11,7 +11,7 @@ namespace RageCoop.Core
internal class PedKilled : Packet
{
public override PacketType Type { get { return PacketType.PedKilled; } }
public override PacketType Type => PacketType.PedKilled;
public int VictimID { get; set; }
public override byte[] Serialize()

View File

@ -13,7 +13,7 @@ namespace RageCoop.Core
public class VehicleSync : Packet
{
public override PacketType Type { get { return PacketType.VehicleSync; } }
public override PacketType Type => PacketType.VehicleSync;
public int ID { get; set; }
public int OwnerID { get; set; }