Beispiel #1
0
        public void LoadCurrentCars()
        {
            CurrentCarList.Clear();
            DesiredCarList.Clear();
            string pathToCarsINI = "Cars\\Cars.ini";

            if (!File.Exists(pathToCarsINI))
            {
                MessageBox.Show(pathToCarsINI + " could not be found. Please make sure you start this tool " +
                                "from your RBR installation folder and that there is a Cars.ini file in \\Cars. Exiting.");
                Environment.Exit(-1);
                return;
            }
            INIFile CarsINI = new INIFile(pathToCarsINI);

            foreach (string section in CarsINI.GetSections())
            {
                if (!section.StartsWith("Car"))
                {
                    continue;
                }
                string CarName = CarsINI.GetParameterValue("CarName", section);
                Car    c;
                if (CarName == null)
                {
                    string FileName = CarsINI.GetParameterValue("FileName", section);
                    string carNr    = "";
                    if (FileName.Contains("\\xsara\\"))
                    {
                        carNr = "1";
                    }
                    if (FileName.Contains("\\accent\\"))
                    {
                        carNr = "2";
                    }
                    if (FileName.Contains("\\zr\\"))
                    {
                        carNr = "3";
                    }
                    if (FileName.Contains("\\Lancer_EVO_VII\\"))
                    {
                        carNr = "4";
                    }
                    if (FileName.Contains("\\Peugeot_206\\"))
                    {
                        carNr = "5";
                    }
                    if (FileName.Contains("\\impreza03\\"))
                    {
                        carNr = "6";
                    }
                    if (FileName.Contains("\\Corolla\\"))
                    {
                        carNr = "7";
                    }
                    if (FileName.Contains("\\impreza00\\"))
                    {
                        carNr = "8";
                    }
                    c = AllCars.Find(x => x.nr == carNr);
                }
                else
                {
                    c = AllCars.Find(x => (x.manufacturer + " " + x.name) == CarName);
                    if (c.name == null)
                    {
                        c.name = CarName;
                    }
                }

                //read user settings (hide parts etc.)
                string file = "Cars\\" + c.folder + "\\" + c.iniFile + ".ini";
                if (File.Exists(file))
                {
                    INIFile carini = new INIFile("Cars\\" + c.folder + "\\" + c.iniFile + ".ini");
                    c.userSettings.hideSteeringWheel = carini.GetParameterValueBool("Switch", "i_steeringwheel");
                    c.userSettings.hideWipers        = carini.GetParameterValueBool("Switch", "i_wiper_l") && carini.GetParameterValueBool("Switch", "i_wiper_r");
                    c.userSettings.hideWindShield    = carini.GetParameterValueBool("Switch", "i_window_f");
                }

                CurrentCarList.Add(c);
            }

            //read current engine sounds
            if (UseAudio)
            {
                INIFile AudioCarsINI = new INIFile("Audio\\Cars\\Cars.ini");
                for (int i = 0; i < 8; i++)
                {
                    string sound = AudioCarsINI.GetParameterValue("Car" + i, "CARS");
                    Car    c     = CurrentCarList[i];
                    c.userSettings.engineSound = sound;
                    CurrentCarList[i]          = c;
                }
            }


            //read current FMOD Sound Banks
            if (FMODAvailable)
            {
                for (int i = 0; i < 8; i++)
                {
                    string FMODSoundBank = IniFileHelper.ReadValue("Car" + i.ToString("00"), "bankName", "AudioFMOD\\AudioFMOD.ini");
                    Car    c             = CurrentCarList[i];
                    c.userSettings.FMODSoundBank = FMODSoundBank;
                    CurrentCarList[i]            = c;
                }
            }

            DesiredCarList = new List <Car>(CurrentCarList.ToArray());
            mainForm.UpdateCurrentCars();
        }
Beispiel #2
0
        public void LoadCurrentCars()
        {
            CurrentCarList.Clear();
            DesiredCarList.Clear();
            string pathToCarsINI = "Cars\\Cars.ini";

            if (!File.Exists(pathToCarsINI))
            {
                MessageBox.Show(string.Format(Loc.String(6), pathToCarsINI));
                Environment.Exit(-1);
                return;
            }
            INIFile CarsINI = new INIFile(pathToCarsINI);

            foreach (string section in CarsINI.GetSections())
            {
                string CarName = CarsINI.GetParameterValue("CarName", section);
                Car    c;
                if (CarName == null)
                {
                    string FileName = CarsINI.GetParameterValue("FileName", section);
                    string carNr    = "";
                    if (FileName.Contains("\\xsara\\"))
                    {
                        carNr = "1";
                    }
                    if (FileName.Contains("\\accent\\"))
                    {
                        carNr = "2";
                    }
                    if (FileName.Contains("\\zr\\"))
                    {
                        carNr = "3";
                    }
                    if (FileName.Contains("\\Lancer_EVO_VII\\"))
                    {
                        carNr = "4";
                    }
                    if (FileName.Contains("\\Peugeot_206\\"))
                    {
                        carNr = "5";
                    }
                    if (FileName.Contains("\\impreza03\\"))
                    {
                        carNr = "6";
                    }
                    if (FileName.Contains("\\Corolla\\"))
                    {
                        carNr = "7";
                    }
                    if (FileName.Contains("\\impreza00\\"))
                    {
                        carNr = "8";
                    }
                    c = AllCars.Find(x => x.nr == carNr);
                }
                else
                {
                    c = AllCars.Find(x => (x.manufacturer + " " + x.name) == CarName);
                    if (c.name == null)
                    {
                        c.name = CarName;
                    }
                }

                //read user settings (hide parts etc.)
                string file = "Cars\\" + c.folder + "\\" + c.iniFile + ".ini";
                if (File.Exists(file))
                {
                    INIFile carini = new INIFile("Cars\\" + c.folder + "\\" + c.iniFile + ".ini");
                    c.userSettings.hideSteeringWheel = carini.GetParameterValueBool("Switch", "i_steeringwheel");
                    c.userSettings.hideWipers        = carini.GetParameterValueBool("Switch", "i_wiper_l") && carini.GetParameterValueBool("Switch", "i_wiper_r");
                    c.userSettings.hideWindShield    = carini.GetParameterValueBool("Switch", "i_window_f");
                }

                CurrentCarList.Add(c);
            }

            //read current engine sounds
            if (UseAudio)
            {
                INIFile AudioCarsINI = new INIFile("Audio\\Cars\\Cars.ini");
                for (int i = 0; i < 8; i++)
                {
                    string sound = AudioCarsINI.GetParameterValue("Car" + i, "CARS");
                    Car    c     = CurrentCarList[i];
                    c.userSettings.engineSound = sound;
                    CurrentCarList[i]          = c;
                }
            }

            DesiredCarList = new List <Car>(CurrentCarList.ToArray());
            mainForm.UpdateCurrentCars();
        }
Beispiel #3
0
        public void LoadAllCars()
        {
            if (!File.Exists(FILEPATH_CARLIST_INI))
            {
                MessageBox.Show("carlist.ini cannot be found. RBRCIT will close now.");
                Application.Exit();
                System.Environment.Exit(1);
            }

            carlist_ini = new INIFile(FILEPATH_CARLIST_INI);
            if (File.Exists("RBRCIT\\carListUser.ini"))
            {
                carlistuser_ini = new INIFile("RBRCIT\\carListUser.ini");
            }
            AllCars.Clear();
            ModelsFound  = 0;
            PhysicsFound = 0;
            foreach (string section in carlist_ini.GetSections())
            {
                if (!section.StartsWith("Car_"))
                {
                    continue;
                }
                Car c = new Car();
                c.nr           = section.Substring(4);
                c.name         = carlist_ini.GetParameterValue("name", section);
                c.manufacturer = c.name.Substring(0, c.name.IndexOf(' '));
                c.name         = c.name.Substring(c.name.IndexOf(' ') + 1); //remove the manufacturer in the beginning
                c.physics      = carlist_ini.GetParameterValue("physics", section);
                c.cat          = carlist_ini.GetParameterValue("cat", section);
                c.iniFile      = carlist_ini.GetParameterValue("iniFile", section);
                c.folder       = carlist_ini.GetParameterValue("folder", section);
                c.trans        = carlist_ini.GetParameterValue("trans", section);
                c.link_physics = carlist_ini.GetParameterValue("link_physics", section);
                c.link_model   = carlist_ini.GetParameterValue("link_model", section);
                c.link_banks   = carlist_ini.GetParameterValue("link_banks", section);

                c.year = carlist_ini.GetParameterValue("year", section);
                string power = carlist_ini.GetParameterValue("power", section);
                if (power != null)
                {
                    int.TryParse(power.Substring(0, power.IndexOf("@")), out c.power);
                }
                string weight = carlist_ini.GetParameterValue("weight", section);
                if (weight != null)
                {
                    int.TryParse(weight, out c.weight);
                }

                c.model_exists = Directory.Exists("Cars\\" + c.folder);
                if (c.model_exists)
                {
                    ModelsFound++;
                }
                c.physics_exists = Directory.Exists("RBRCIT\\physics\\" + c.physics);
                if (c.physics_exists)
                {
                    PhysicsFound++;
                }

                c.banks = carlist_ini.GetParameterValue("banks", section);
                if (c.banks != null && c.banks.Contains(","))
                {
                    c.banks = c.banks.Substring(0, c.banks.IndexOf(','));
                }
                c.banks_exist = (c.banks != null) && Directory.Exists("AudioFMOD\\") && Directory.GetFiles("AudioFMOD\\", c.banks + "*").Length > 0;

                //are there user settings? if yes set them. Default Engine sound = subaru!
                c.userSettings.engineSound = "subaru";
                if (carlistuser_ini != null)
                {
                    string sound = carlistuser_ini.GetParameterValue("engineSound", "Car_" + c.nr);
                    if (sound != null)
                    {
                        c.userSettings.engineSound = sound;
                    }
                    string FMODSoundBank = carlistuser_ini.GetParameterValue("FMODSoundBank", "Car_" + c.nr);
                    if (FMODSoundBank != null)
                    {
                        c.userSettings.FMODSoundBank = FMODSoundBank;
                    }
                    c.userSettings.hideSteeringWheel = carlistuser_ini.GetParameterValueBool("hideSteeringWheel", "Car_" + c.nr);
                    c.userSettings.hideWipers        = carlistuser_ini.GetParameterValueBool("hideWipers", "Car_" + c.nr);
                    c.userSettings.hideWindShield    = carlistuser_ini.GetParameterValueBool("hideWindShield", "Car_" + c.nr);
                }

                AllCars.Add(c);
            }
            mainForm.UpdateAllCars();
        }
Beispiel #4
0
        public void LoadAllCars()
        {
            carlist_ini = new INIFile("RBRCIT\\carlist\\carList.ini");
            if (File.Exists("RBRCIT\\carListUser.ini"))
            {
                carlistuser_ini = new INIFile("RBRCIT\\carListUser.ini");
            }
            AllCars.Clear();
            ModelsFound  = 0;
            PhysicsFound = 0;
            foreach (string section in carlist_ini.GetSections())
            {
                if (!section.StartsWith("Car_"))
                {
                    continue;
                }
                Car c = new Car();
                c.nr           = section.Substring(4);
                c.name         = carlist_ini.GetParameterValue("name", section);
                c.manufacturer = c.name.Substring(0, c.name.IndexOf(' '));
                c.name         = c.name.Substring(c.name.IndexOf(' ') + 1); //remove the manufacturer in the beginning
                c.physics      = carlist_ini.GetParameterValue("physics", section);
                c.cat          = carlist_ini.GetParameterValue("cat", section);
                c.iniFile      = carlist_ini.GetParameterValue("iniFile", section);
                c.folder       = carlist_ini.GetParameterValue("folder", section);
                c.trans        = carlist_ini.GetParameterValue("trans", section);
                c.link_physics = carlist_ini.GetParameterValue("link_physics", section);
                c.link_model   = carlist_ini.GetParameterValue("link_model", section);

                c.year = carlist_ini.GetParameterValue("year", section);
                string power = carlist_ini.GetParameterValue("power", section);
                if (power != null)
                {
                    int.TryParse(power.Substring(0, power.IndexOf("@")), out c.power);
                }
                string weight = carlist_ini.GetParameterValue("weight", section);
                if (weight != null)
                {
                    int.TryParse(weight, out c.weight);
                }

                c.model_exists = Directory.Exists("Cars\\" + c.folder);
                if (c.model_exists)
                {
                    ModelsFound++;
                }
                c.physics_exists = Directory.Exists("RBRCIT\\physics\\" + c.physics);
                if (c.physics_exists)
                {
                    PhysicsFound++;
                }

                //are there user settings? if yes set them. Default Engine sound = subaru!
                c.userSettings.engineSound = "subaru";
                if (carlistuser_ini != null)
                {
                    string sound = carlistuser_ini.GetParameterValue("engineSound", "Car_" + c.nr);
                    if (sound != null)
                    {
                        c.userSettings.engineSound = sound;
                    }
                    c.userSettings.hideSteeringWheel = carlistuser_ini.GetParameterValueBool("hideSteeringWheel", "Car_" + c.nr);
                    c.userSettings.hideWipers        = carlistuser_ini.GetParameterValueBool("hideWipers", "Car_" + c.nr);
                    c.userSettings.hideWindShield    = carlistuser_ini.GetParameterValueBool("hideWindShield", "Car_" + c.nr);
                }

                AllCars.Add(c);
            }
            mainForm.UpdateAllCars();
        }