mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
* WebSocket-based data transfer system * Move resource downloads/uploads to the new transfer system Should drastically increase the permitted practical size * Transfer impl for Lidgren * Async impl for receive stream * Use unbounded channel for Lidgren * Add metrics * More comments * Add serverside stream limit to avoid being a DoS vector * Fix tests * Oops forgot to actually implement sequence channels in NetMessage * Doc comment for NetMessage.SequenceChannel * Release notes
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System;
|
|
using Lidgren.Network;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.Upload;
|
|
|
|
[Obsolete("The engine no longer uses this message")]
|
|
public sealed class NetworkResourceUploadMessage : NetMessage
|
|
{
|
|
public override MsgGroups MsgGroup => MsgGroups.String;
|
|
|
|
public byte[] Data { get; set; } = Array.Empty<byte>();
|
|
public ResPath RelativePath { get; set; } = ResPath.Self;
|
|
|
|
public NetworkResourceUploadMessage()
|
|
{
|
|
}
|
|
|
|
public NetworkResourceUploadMessage(byte[] data, ResPath relativePath)
|
|
{
|
|
Data = data;
|
|
RelativePath = relativePath;
|
|
}
|
|
|
|
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
|
|
{
|
|
var dataLength = buffer.ReadVariableInt32();
|
|
Data = buffer.ReadBytes(dataLength);
|
|
// What is the second argument here?
|
|
RelativePath = new ResPath(buffer.ReadString());
|
|
}
|
|
|
|
public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer)
|
|
{
|
|
buffer.WriteVariableInt32(Data.Length);
|
|
buffer.Write(Data);
|
|
buffer.Write(RelativePath.ToString());
|
|
buffer.Write(ResPath.Separator);
|
|
}
|
|
}
|