static void BuildFile() { var languageDirectories = Directory.GetDirectories("Strings"); foreach (string languageDirectory in languageDirectories) { LanguagePrefix = languageDirectory.Split('\\')[1]; Console.WriteLine($"Building language '{LanguagePrefix}'..."); StringTable.Import(); CarNameStringTable.Import(); GTModeData CarData = new GTModeData(); CarData.ImportData(); Directory.CreateDirectory("Output"); CarData.WriteData(Path.Combine("Output", $"{GetDataFilePrefix()}gtmode_data.dat")); GTModeRace RaceData = new GTModeRace(); RaceData.ImportData(); RaceData.WriteData(Path.Combine("Output", $"{GetDataFilePrefix()}gtmode_race.dat")); StringTable.Write(Path.Combine("Output", $"{LanguagePrefix}_unistrdb.dat")); StringTable.Reset(); CarNameStringTable.Reset(); } }
private static void BuildGTModeFile() { var languageDirectories = Directory.GetDirectories("Strings"); foreach (string languageDirectory in languageDirectories) { LanguagePrefix = languageDirectory.Split('\\')[1]; Console.WriteLine($"Building language '{LanguagePrefix}'..."); UnicodeStringTable.Import(); CarNameStringTable.Import(); string overridePath = Path.Combine("_Overrides", LanguagePrefix); DataFile.OverridePath = Directory.Exists(overridePath) ? overridePath : null; var carData = new GTModeData(); carData.ImportData(); Directory.CreateDirectory("Output"); carData.WriteData(Path.Combine("Output", $"{GetDataFilePrefix()}gtmode_data.dat")); GTModeRace raceData = new GTModeRace(); raceData.ImportData(); raceData.WriteData(Path.Combine("Output", $"{GetDataFilePrefix()}gtmode_race.dat")); UnicodeStringTable.Write(Path.Combine("Output", $"{LanguagePrefix}_unistrdb.dat")); UnicodeStringTable.Reset(); CarNameStringTable.Reset(); } }
public static void Main(string[] args) { if (args.Length != 1) { if (Directory.Exists(nameof(CarArcadeRacing))) { BuildArcadeFile(); } else if (Directory.Exists(nameof(CarLicense))) { BuildLicenseFile(); } else { BuildGTModeFile(); } return; } string filename = Path.GetFileName(args[0]); string extension = Path.GetExtension(filename); bool favourCompressed = false; if (extension == ".gz") { string innerFilename = Path.GetFileNameWithoutExtension(filename); extension = Path.GetExtension(innerFilename); favourCompressed = true; } if (extension != ".dat") { return; } SetLanguagePrefix(filename); if (filename.Contains("license_data")) { UnicodeStringTable.LoadFromArray(LicenseStrings.Strings); DumpDataFile <LicenseData>("license_data.dat", favourCompressed); UnicodeStringTable.CreateLanguageDirectory(); // hack to be able to detect the language prefix when rebuilding } else if (filename.Contains("arcade_data")) { UnicodeStringTable.LoadFromArray(ArcadeStrings.Strings); DumpDataFile <ArcadeData>("arcade_data.dat", favourCompressed); UnicodeStringTable.CreateLanguageDirectory(); } else { UnicodeStringTable.Read(GetCorrectFilename($"{LanguagePrefix}_unistrdb.dat", favourCompressed)); DumpDataFile <GTModeData>("gtmode_data.dat", favourCompressed); DumpDataFile <GTModeRace>("gtmode_race.dat", favourCompressed); UnicodeStringTable.Export(); CarNameStringTable.Export(); } }
static void SplitArcadeFile(string filename) { StringTable.Read("eng_unistrdb.dat"); ArcadeData ArcadeData = new ArcadeData(); ArcadeData.ReadData(filename); ArcadeData.DumpData(); StringTable.Export(); CarNameStringTable.Export(); }
static void SplitLicenseFile(string filename) { StringTable.Read("eng_unistrdb.dat"); LicenseData LicenseData = new LicenseData(); LicenseData.ReadData(filename); LicenseData.DumpData(); StringTable.Export(); CarNameStringTable.Export(); }
public override void Import(string filename) { base.Import(filename); CarName carName = CarNameStringTable.Get(data.CarId); CarData carData = data; carData.NameFirstPart = UnicodeStringTable.Add(carName.NameFirstPart); carData.NameSecondPart = UnicodeStringTable.Add(carName.NameSecondPart); carData.Year = carName.Year; data = carData; }
static void SplitFile() { StringTable.Read($"{LanguagePrefix}_unistrdb.dat"); GTModeData CarData = new GTModeData(); CarData.ReadData($"{GetDataFilePrefix()}gtmode_data.dat"); CarData.DumpData(); GTModeRace RaceData = new GTModeRace(); RaceData.ReadData($"{GetDataFilePrefix()}gtmode_race.dat"); RaceData.DumpData(); StringTable.Export(); CarNameStringTable.Export(); }
public override void Read(Stream infile) { base.Read(infile); CarNameStringTable.Add(data.CarId, UnicodeStringTable.Get(data.NameFirstPart), UnicodeStringTable.Get(data.NameSecondPart), data.Year); }
public override void Read(FileStream infile) { base.Read(infile); CarNameStringTable.Add(Data.CarId, StringTable.Get(Data.NameFirstPart), StringTable.Get(Data.NameSecondPart), Data.Year); }