45 lines
877 B
C#
45 lines
877 B
C#
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);
|
||
|
|
}
|
||
|
|
}
|