initial commit
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Crysome.Common.Network.Packets.Client;
|
||||
|
||||
public class GetDrivesResponsePacket : IPacket
|
||||
{
|
||||
public string[] Drives { get; set; }
|
||||
|
||||
public long RequestId { get; set; }
|
||||
|
||||
public GetDrivesResponsePacket()
|
||||
{
|
||||
}
|
||||
|
||||
public GetDrivesResponsePacket(string[] drives, long requestId = 0L)
|
||||
{
|
||||
Drives = drives;
|
||||
RequestId = requestId;
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write((Drives != null) ? Drives.Length : 0);
|
||||
if (Drives != null)
|
||||
{
|
||||
for (int i = 0; i < Drives.Length; i++)
|
||||
{
|
||||
w.Write(Drives[i] ?? "");
|
||||
}
|
||||
}
|
||||
w.Write(RequestId);
|
||||
}
|
||||
|
||||
public void Read(BinaryReader r)
|
||||
{
|
||||
int num = r.ReadInt32();
|
||||
Drives = new string[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
Drives[i] = r.ReadString();
|
||||
}
|
||||
RequestId = ((r.BaseStream.Position < r.BaseStream.Length) ? r.ReadInt64() : 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user