public void Load() { rbrcit_ini = new INIFile("RBRCIT.ini"); UseExternalUnzipper = false; PathToExternalUnzipper = rbrcit_ini.GetParameterValue("external_unzipper", "ArchiveHandling"); ExternalUnzipperArguments = rbrcit_ini.GetParameterValue("arguments_extract", "ArchiveHandling"); UseExternalUnzipper = (PathToExternalUnzipper != null) && (File.Exists(PathToExternalUnzipper)); 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" }; UpdateAudio(); UpdateFMOD(); SetProxy(); }
public void DownloadPluginNGP() { DownloadJob dj = new DownloadJob(); dj.path = "."; dj.title = "NGP Plugin"; //dj.URL = rbrcit_ini.GetParameterValue("plugin_physics_url"); dj.URL = carlist_ini.GetParameterValue("plugin_physics_url", "Plugins"); FormDownload fd = new FormDownload(dj, this); fd.FormClosed += FormDownloadClosedNGP; fd.ShowAtCenterParent(mainForm); }
public void DownloadCarListINI() { using (var client = new WebClient()) { client.DownloadFileCompleted += Client_DownloadFileCompleted; if (File.Exists(FILEPATH_CARLIST_INI_TEMP)) { File.Delete(FILEPATH_CARLIST_INI_TEMP); } string url = rbrcit_ini.GetParameterValue("carlist_ini_url", "RBRCIT"); Uri uri = new Uri(url); try { client.DownloadFileAsync(uri, FILEPATH_CARLIST_INI_TEMP); } catch (Exception e) { MessageBox.Show("URL: " + url + "\n\nFile download not successful:\n" + e.Message); if (File.Exists(FILEPATH_CARLIST_INI_TEMP)) { File.Delete(FILEPATH_CARLIST_INI_TEMP); } return; } } }
public static void Load(string languageFilePath) { INIFile ini = new INIFile(languageFilePath); string s; int i = 0; _strings = new Dictionary <int, string>(); do { try { s = ini.GetParameterValue(i.ToString(), "strings"); if (s != null) { _strings.Add(i, s.Replace("\\n", "\n")); } else { break; } } catch { break; } i++; }while (true); }
public void DownloadCarListINI() { using (var client = new WebClient()) { client.DownloadFile(rbrcit_ini.GetParameterValue("carlist_ini_url", "RBRCIT"), "RBRCIT\\carlist\\carList.ini"); } LoadAll(); }
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"); } }
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(); }
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(); }
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(); }
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(); }