Files
tbd-station-14/Content.Shared/Network/NetMessages/MsgStationEvents.cs
Acruid ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00

42 lines
1.4 KiB
C#

using System.IO;
using Lidgren.Network;
using Robust.Shared.IoC;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
namespace Content.Shared.Network.NetMessages
{
public class MsgStationEvents : NetMessage
{
#region REQUIRED
public const MsgGroups GROUP = MsgGroups.Command;
public const string NAME = nameof(MsgStationEvents);
public MsgStationEvents(INetChannel channel) : base(NAME, GROUP) { }
#endregion
public string[] Events;
public override void ReadFromBuffer(NetIncomingMessage buffer)
{
var serializer = IoCManager.Resolve<IRobustSerializer>();
var length = buffer.ReadVariableInt32();
using var stream = buffer.ReadAlignedMemory(length);
serializer.DeserializeDirect(stream, out Events);
}
public override void WriteToBuffer(NetOutgoingMessage buffer)
{
var serializer = IoCManager.Resolve<IRobustSerializer>();
using (var stream = new MemoryStream())
{
serializer.SerializeDirect(stream, Events);
buffer.WriteVariableInt32((int)stream.Length);
stream.TryGetBuffer(out var segment);
buffer.Write(segment);
}
}
}
}