mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-16 11:06:44 -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
36
server/tso.files/Formats/IFF/Chunks/FSOV.cs
Executable file
36
server/tso.files/Formats/IFF/Chunks/FSOV.cs
Executable file
|
@ -0,0 +1,36 @@
|
|||
using FSO.Files.Utils;
|
||||
using System.IO;
|
||||
|
||||
namespace FSO.Files.Formats.IFF.Chunks
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple container for FSOV data within an iff. If this exists, normal TS1 iff loading is subverted.
|
||||
/// </summary>
|
||||
public class FSOV : IffChunk
|
||||
{
|
||||
public static int CURRENT_VERSION = 1;
|
||||
public int Version = CURRENT_VERSION;
|
||||
public byte[] Data;
|
||||
|
||||
public override void Read(IffFile iff, Stream stream)
|
||||
{
|
||||
using (var io = IoBuffer.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
|
||||
{
|
||||
Version = io.ReadInt32();
|
||||
var length = io.ReadInt32();
|
||||
Data = io.ReadBytes(length);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Write(IffFile iff, Stream stream)
|
||||
{
|
||||
using (var io = IoWriter.FromStream(stream, ByteOrder.LITTLE_ENDIAN))
|
||||
{
|
||||
io.WriteInt32(Version);
|
||||
io.WriteInt32(Data.Length);
|
||||
io.WriteBytes(Data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue