Example #1
0
        public void Load()
        {
            rbrcit_ini = new INIFile("RBRCIT.ini");

            AllCars        = new List <Car>();
            CurrentCarList = new List <Car>();
            DesiredCarList = new List <Car>();
            SavedCarLists  = new List <string>();

            PhysicsFolders = new string[] { "c_xsara", "h_accent", "mg_zr", "m_lancer", "p_206", "s_i2003", "t_coroll", "s_i2000" };

            BackupFiles = new string[] {
                "physics.rbz",
                "Cars/Cars.ini",
                "Audio/Cars/Cars.ini"
            };

            UseAudio = Directory.Exists("Audio") && !File.Exists("audio.dat");

            SetProxy();
        }
Example #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            try
            {
                RBRcitIni = new INIFile("RBRCIT.ini");
                string languageFilePath = RBRcitIni.GetParameterValue("languageFile", "RBRCIT");
                Loc.Load(languageFilePath);

                Form1 f = new Form1();
                Application.Run(f);
                //Application.Run(new Form1());
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Exception");
            }
        }
Example #3
0
        private void WriteCarsINI()
        {
            FileInfo fi = new FileInfo("Cars\\cars.ini");

            fi.IsReadOnly = false;
            INIFile carsINI = new INIFile("Cars\\cars.ini");

            for (int i = 0; i < 8; i++)
            {
                if (DesiredCarList[i].Equals(CurrentCarList[i]))
                {
                    continue;
                }
                Car    c       = DesiredCarList[i];
                string section = "Car0" + i;
                carsINI.SetParameter("FileName", string.Format("Cars\\{0}\\{1}.sgc", c.folder, c.iniFile), section);
                carsINI.SetParameter("IniFile", string.Format("Cars\\{0}\\{1}.ini", c.folder, c.iniFile), section);
                carsINI.SetParameter("ShaderFile", string.Format("Cars\\{0}\\{1}_shaders.ini", c.folder, c.iniFile), section);
                carsINI.SetParameter("ShaderSettings", string.Format("Cars\\{0}\\{1}_shader_settings", c.folder, c.iniFile), section);
                carsINI.SetParameter("TexturePath", string.Format("Cars\\{0}\\Textures", c.folder), section);
                carsINI.SetParameter("CarName", c.manufacturer + " " + c.name, section);
            }
            carsINI.Save();
        }
Example #4
0
        private void WriteCarListUserINI()
        {
            //copy back to Cars
            foreach (Car d in DesiredCarList)
            {
                int i = AllCars.FindIndex(x => x.nr == d.nr);
                if (i == -1)
                {
                    continue;
                }
                AllCars[i] = d;
            }
            //write carListUser.ini for all cars in carList.ini
            INIFile carListUserINI = new INIFile();

            foreach (Car c in AllCars)
            {
                carListUserINI.SetParameter("engineSound", c.userSettings.engineSound, "Car_" + c.nr);
                carListUserINI.SetParameter("hideSteeringWheel", c.userSettings.hideSteeringWheel.ToString(), "Car_" + c.nr);
                carListUserINI.SetParameter("hideWipers", c.userSettings.hideWipers.ToString(), "Car_" + c.nr);
                carListUserINI.SetParameter("hideWindShield", c.userSettings.hideWindShield.ToString(), "Car_" + c.nr);
            }
            carListUserINI.SaveAs("RBRCIT\\carListUser.ini");
        }
Example #5
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();
        }
Example #6
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();
        }
Example #7
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();
        }
Example #8
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();
        }