Ejemplo n.º 1
0
 public void ReadData(string filename)
 {
     using (Stream file = UnicodeStringTable.DecompressFile(filename))
     {
         ReadDataFromFile(file);
     }
 }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
 public override void Read(Stream infile)
 {
     base.Read(infile);
     CarNameStringTable.Add(data.CarId, UnicodeStringTable.Get(data.NameFirstPart), UnicodeStringTable.Get(data.NameSecondPart), data.Year);
 }