/// <summary> /// Reads a .frt file and parses it into a RouteSet. /// </summary> /// <param name="inputPath">File to read.</param> /// <returns>The parsed routeset.</returns> public static RouteSet ReadRouteSet(string inputPath) { using (var reader = new BinaryReader(new FileStream(inputPath, FileMode.Open), getEncoding())) { Action <int> skipBytes = numberOfBytes => SkipBytes(reader, numberOfBytes); var readFunctions = new ReadFunctions(reader.ReadSingle, reader.ReadUInt16, reader.ReadUInt32, reader.ReadInt32, reader.ReadBytes, skipBytes); return(Read(readFunctions)); } }
public static BdatCollection ReadBdats(byte[][] files) { var tables = new BdatCollection(); foreach (byte[] file in files) { ReadBdat(file, tables); } ReadFunctions.SetReferences(tables); return(tables); }
public static BdatCollection DeserializeTables(BdatTables files) { var tables = new BdatCollection(); foreach (BdatTable table in files.Tables) { ReadTable(table, tables); } ReadFunctions.SetReferences(tables); return(tables); }
public static BdatCollection DeserializeTables(BdatTables files, IProgressReport progress = null) { progress?.LogMessage("Deserializing BDAT tables"); progress?.SetTotal(files.Tables.Length); var tables = new BdatCollection(); foreach (BdatTable table in files.Tables) { ReadTable(table, tables); progress?.ReportAdd(1); } ReadFunctions.SetReferences(tables); return(tables); }
private static uint[] GetUintNames(string frtPath) { RouteSet frtRoutes; uint[] routeNames = new uint[0]; if (File.Exists(frtPath)) { using (var reader = new BinaryReader(new FileStream(frtPath, FileMode.Open), getEncoding())) { Action <int> skipBytes = numberOfBytes => SkipBytes(reader, numberOfBytes); var readFunctions = new ReadFunctions(reader.ReadSingle, reader.ReadUInt16, reader.ReadUInt32, reader.ReadInt32, reader.ReadBytes, skipBytes); frtRoutes = Read(readFunctions); } IEnumerable <uint> routes = from route in frtRoutes.Routes select route.Name; routeNames = routes.ToArray(); } return(routeNames); }