using System.Collections.Generic; using System.IO; //ok, why do we have support for this? it's only used by hitlab and only the hitlab test files have them... namespace FSO.Files.HIT { /// /// Represents a TLO file. /// TLO (short for Track Logic according to hitlab.ini) is a format /// used solely for Hitlab. Integers are little-endian. /// public class TLO { private uint m_Count; public List Sections = new List(); /// /// Creates a new tracklogic instance. /// /// The data to create the tracklogic instance from. public TLO(byte[] Filedata) { BinaryReader Reader = new BinaryReader(new MemoryStream(Filedata)); Reader.ReadBytes(4); //Reserved. m_Count = Reader.ReadUInt32(); for (int i = 0; i < m_Count; i++) { TLOSection Section = new TLOSection(); Section.Name = new string(Reader.ReadChars(Reader.ReadInt32())); Section.GroupID1 = Reader.ReadUInt32(); Section.FileID1 = Reader.ReadUInt32(); Section.GroupID2 = Reader.ReadUInt32(); Section.FileID1 = Reader.ReadUInt32(); Section.TypeID = Reader.ReadUInt32(); Section.GroupID3 = Reader.ReadUInt32(); Section.FileID3 = Reader.ReadUInt32(); Sections.Add(Section); } Reader.Close(); } /// /// Creates a new tracklogic instance. /// /// The path to the tracklogic file to read. public TLO(string Filepath) { BinaryReader Reader = new BinaryReader(File.Open(Filepath, FileMode.Open, FileAccess.Read, FileShare.Read)); Reader.ReadBytes(4); //Reserved. m_Count = Reader.ReadUInt32(); for (int i = 0; i < m_Count; i++) { TLOSection Section = new TLOSection(); Section.Name = new string(Reader.ReadChars(Reader.ReadInt32())); Section.GroupID1 = Reader.ReadUInt32(); Section.FileID1 = Reader.ReadUInt32(); Section.GroupID2 = Reader.ReadUInt32(); Section.FileID1 = Reader.ReadUInt32(); Section.TypeID = Reader.ReadUInt32(); Section.GroupID3 = Reader.ReadUInt32(); Section.FileID3 = Reader.ReadUInt32(); Sections.Add(Section); } Reader.Close(); } } /// /// Represents a section in a tracklogic file. /// public class TLOSection { public string Name; public uint GroupID1; public uint FileID1; public uint GroupID2; public uint FileID2; public uint TypeID; public uint GroupID3; public uint FileID3; } }