mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-05 06:00:29 -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
54
server/FSO.Server.Protocol/Electron/Packets/GlobalTuningUpdate.cs
Executable file
54
server/FSO.Server.Protocol/Electron/Packets/GlobalTuningUpdate.cs
Executable file
|
@ -0,0 +1,54 @@
|
|||
using FSO.Common.Model;
|
||||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace FSO.Server.Protocol.Electron.Packets
|
||||
{
|
||||
public class GlobalTuningUpdate : AbstractElectronPacket
|
||||
{
|
||||
public DynamicTuning Tuning;
|
||||
public byte[] ObjectUpgrades;
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
|
||||
var dataLen = input.GetInt32();
|
||||
if (dataLen > 4000000 || dataLen > input.Remaining) throw new Exception("Tuning too long");
|
||||
var data = new byte[dataLen];
|
||||
input.Get(data, 0, dataLen);
|
||||
using (var mem = new MemoryStream(data))
|
||||
{
|
||||
using (var reader = new BinaryReader(mem))
|
||||
{
|
||||
Tuning = new DynamicTuning(reader);
|
||||
}
|
||||
}
|
||||
var upgLen = input.GetInt32();
|
||||
if (upgLen > 10000000 || upgLen > input.Remaining) throw new Exception("Upgrades too long");
|
||||
ObjectUpgrades = new byte[upgLen];
|
||||
input.Get(ObjectUpgrades, 0, upgLen);
|
||||
}
|
||||
|
||||
public override ElectronPacketType GetPacketType()
|
||||
{
|
||||
return ElectronPacketType.GlobalTuningUpdate;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
using (var mem = new MemoryStream())
|
||||
{
|
||||
using (var writer = new BinaryWriter(mem))
|
||||
{
|
||||
Tuning.SerializeInto(writer);
|
||||
var result = mem.ToArray();
|
||||
output.PutInt32(result.Length);
|
||||
output.Put(result, 0, result.Length);
|
||||
}
|
||||
}
|
||||
output.PutInt32(ObjectUpgrades.Length);
|
||||
output.Put(ObjectUpgrades, 0, ObjectUpgrades.Length);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue