mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-05 14:10:32 -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
69
server/FSO.Server.Protocol/Electron/Packets/MailResponse.cs
Executable file
69
server/FSO.Server.Protocol/Electron/Packets/MailResponse.cs
Executable file
|
@ -0,0 +1,69 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
using FSO.Files.Formats.tsodata;
|
||||
using System.IO;
|
||||
|
||||
namespace FSO.Server.Protocol.Electron.Packets
|
||||
{
|
||||
public class MailResponse : AbstractElectronPacket
|
||||
{
|
||||
public MailResponseType Type;
|
||||
public MessageItem[] Messages = new MessageItem[0];
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
Type = input.GetEnum<MailResponseType>();
|
||||
var numMessages = input.GetInt32();
|
||||
Messages = new MessageItem[numMessages];
|
||||
for (int j = 0; j < numMessages; j++)
|
||||
{
|
||||
var length = input.GetInt32();
|
||||
var dat = new byte[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
dat[i] = input.Get();
|
||||
}
|
||||
|
||||
using (var str = new MemoryStream(dat))
|
||||
{
|
||||
Messages[j] = new MessageItem(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override ElectronPacketType GetPacketType()
|
||||
{
|
||||
return ElectronPacketType.MailResponse;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutEnum(Type);
|
||||
output.PutInt32(Messages.Length);
|
||||
foreach (var msg in Messages)
|
||||
{
|
||||
byte[] dat;
|
||||
using (var str = new MemoryStream())
|
||||
{
|
||||
msg.Save(str);
|
||||
dat = str.ToArray();
|
||||
}
|
||||
output.PutInt32(dat.Length);
|
||||
foreach (var b in dat)
|
||||
output.Put(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum MailResponseType
|
||||
{
|
||||
POLL_RESPONSE,
|
||||
NEW_MAIL,
|
||||
SEND_IGNORING_YOU,
|
||||
SEND_IGNORING_THEM,
|
||||
SEND_THROTTLED,
|
||||
SEND_THROTTLED_DAILY,
|
||||
SEND_FAILED,
|
||||
SEND_SUCCESS //returns the message you sent, with its db id
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue