mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-22 15:24:56 -04:00
Added FSO.Files for use with the API server
Don't ask me. FreeSO is the prime example of dependency hell.
This commit is contained in:
parent
4b5e584eeb
commit
8fec258215
104 changed files with 14653 additions and 163 deletions
91
server/tso.files/Formats/tsodata/BulletinItem.cs
Executable file
91
server/tso.files/Formats/tsodata/BulletinItem.cs
Executable file
|
@ -0,0 +1,91 @@
|
|||
using FSO.Files.Utils;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace FSO.Files.Formats.tsodata
|
||||
{
|
||||
public class BulletinItem
|
||||
{
|
||||
public static int CURRENT_VERSION = 1;
|
||||
public int Version = CURRENT_VERSION;
|
||||
public uint ID;
|
||||
public uint NhoodID;
|
||||
public uint SenderID;
|
||||
|
||||
public string Subject;
|
||||
public string Body;
|
||||
public string SenderName;
|
||||
|
||||
public long Time;
|
||||
|
||||
public BulletinType Type;
|
||||
public BulletinFlags Flags;
|
||||
|
||||
public uint LotID; //optional: for lot advertisements.
|
||||
|
||||
public BulletinItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BulletinItem(Stream stream)
|
||||
{
|
||||
Read(stream);
|
||||
}
|
||||
|
||||
public void Save(Stream stream)
|
||||
{
|
||||
using (var writer = IoWriter.FromStream(stream))
|
||||
{
|
||||
writer.WriteCString("FSOB", 4);
|
||||
writer.WriteInt32(Version);
|
||||
writer.WriteUInt32(ID);
|
||||
writer.WriteUInt32(NhoodID);
|
||||
writer.WriteUInt32(SenderID);
|
||||
|
||||
writer.WriteLongPascalString(Subject);
|
||||
writer.WriteLongPascalString(Body);
|
||||
writer.WriteLongPascalString(SenderName);
|
||||
writer.WriteInt64(Time);
|
||||
writer.WriteInt32((int)Type);
|
||||
writer.WriteInt32((int)Flags);
|
||||
|
||||
writer.WriteUInt32(LotID);
|
||||
}
|
||||
}
|
||||
|
||||
public void Read(Stream stream)
|
||||
{
|
||||
using (var reader = IoBuffer.FromStream(stream))
|
||||
{
|
||||
var magic = reader.ReadCString(4);
|
||||
Version = reader.ReadInt32();
|
||||
ID = reader.ReadUInt32();
|
||||
NhoodID = reader.ReadUInt32();
|
||||
SenderID = reader.ReadUInt32();
|
||||
|
||||
Subject = reader.ReadLongPascalString();
|
||||
Body = reader.ReadLongPascalString();
|
||||
SenderName = reader.ReadLongPascalString();
|
||||
Time = reader.ReadInt64();
|
||||
Type = (BulletinType)reader.ReadInt32();
|
||||
Flags = (BulletinFlags)reader.ReadInt32();
|
||||
|
||||
LotID = reader.ReadUInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum BulletinType
|
||||
{
|
||||
Mayor = 0,
|
||||
System = 1,
|
||||
Community = 2,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum BulletinFlags
|
||||
{
|
||||
PromotedByMayor = 1
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue