mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-07 15:10:27 -04:00
Removed NioTSO client and server
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
This commit is contained in:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
58
server/FSO.Server.Protocol/Gluon/Packets/SendCityMail.cs
Executable file
58
server/FSO.Server.Protocol/Gluon/Packets/SendCityMail.cs
Executable file
|
@ -0,0 +1,58 @@
|
|||
using FSO.Common.Serialization;
|
||||
using FSO.Files.Formats.tsodata;
|
||||
using Mina.Core.Buffer;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class SendCityMail : AbstractGluonCallPacket
|
||||
{
|
||||
public List<MessageItem> Items { get; set; }
|
||||
|
||||
public SendCityMail() { }
|
||||
|
||||
public SendCityMail(List<MessageItem> items) {
|
||||
Items = items;
|
||||
}
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
base.Deserialize(input, context);
|
||||
var itemCount = input.GetInt32();
|
||||
var dataSize = input.GetInt32();
|
||||
var data = input.GetSlice(dataSize).GetBytes();
|
||||
using (var mem = new MemoryStream(data)) {
|
||||
Items = new List<MessageItem>();
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
var message = new MessageItem();
|
||||
message.Read(mem);
|
||||
Items.Add(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
base.Serialize(output, context);
|
||||
byte[] data = null;
|
||||
using (var mem = new MemoryStream())
|
||||
{
|
||||
foreach (var item in Items)
|
||||
{
|
||||
item.Save(mem);
|
||||
}
|
||||
data = mem.ToArray();
|
||||
}
|
||||
output.PutInt32(Items.Count);
|
||||
output.PutInt32(data.Length);
|
||||
output.Put(data);
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.CitySendMail;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue