mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-22 01:12:24 +00:00
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
53 lines
1.5 KiB
C#
Executable file
53 lines
1.5 KiB
C#
Executable file
using System.Collections.Generic;
|
|
using Mina.Core.Buffer;
|
|
|
|
namespace FSO.Common.Serialization.Primitives
|
|
{
|
|
|
|
public class cTSOProperty : IoBufferSerializable, IoBufferDeserializable
|
|
{
|
|
public uint StructType;
|
|
public List<cTSOPropertyField> StructFields;
|
|
|
|
public void Serialize(IoBuffer output, ISerializationContext context)
|
|
{
|
|
output.PutUInt32(0x89739A79);
|
|
output.PutUInt32(StructType);
|
|
output.PutUInt32((uint)StructFields.Count);
|
|
|
|
foreach (var item in StructFields)
|
|
{
|
|
output.PutUInt32(item.StructFieldID);
|
|
context.ModelSerializer.Serialize(output, item.Value, context, true);
|
|
}
|
|
}
|
|
|
|
public void Deserialize(IoBuffer input, ISerializationContext context)
|
|
{
|
|
//Unknown
|
|
input.GetUInt32();
|
|
StructType = input.GetUInt32();
|
|
|
|
StructFields = new List<cTSOPropertyField>();
|
|
|
|
var numFields = input.GetUInt32();
|
|
for(int i=0; i < numFields; i++){
|
|
var fieldId = input.GetUInt32();
|
|
var typeId = input.GetUInt32();
|
|
var value = context.ModelSerializer.Deserialize(typeId, input, context);
|
|
|
|
StructFields.Add(new cTSOPropertyField
|
|
{
|
|
StructFieldID = fieldId,
|
|
Value = value
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
public class cTSOPropertyField
|
|
{
|
|
public uint StructFieldID;
|
|
public object Value;
|
|
}
|
|
}
|