/// <summary> /// Creates a new Game Registry /// </summary> /// <param name="GameDir">The Game directory path that needs to be informed</param> /// <param name="GameExe">The Game directory with the path of executable file </param> /// <param name="OS_isX64">The type of OS, True to x64 and False to x86 system</param> public static void NewGame(string GameDir, string GameExe, bool OS_isX64) { string execption = null; RegistryKey EA, EA_CORE, EA_Games; try { if (OS_isX64) { EA = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\WOW6432Node\Electronic Arts"); // X64 } else { EA = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Electronic Arts"); // X86 } LogFile("Trying To Create Registry", "Create Reg:"); EA_CORE = EA.CreateSubKey("EA CORE"); EA_Games = EA.CreateSubKey("EA Games"); #region EA CORE RegistryKey BF2_2006 = EA_CORE.CreateSubKey("INSTALLED GAMES").CreateSubKey("EAGAMES").CreateSubKey("BF2-2006"); #region BF2-2006 RegistryKey BF2_EPE1 = BF2_2006.CreateSubKey("ONLINE_CONTENT").CreateSubKey("BF2-EP1"); BF2_EPE1.SetValue("DisplayName", "Battlefield 2 Special Forces", RegistryValueKind.String); BF2_EPE1.SetValue("GameLauncherParameters", "+menu 1 +fullscreen 1 +modPath mods/xpack +ignoreAsserts 1", RegistryValueKind.String); BF2_EPE1.SetValue("GameLauncherPath", GameDir + "\\" + GameExe, RegistryValueKind.String); BF2_EPE1.SetValue("Version", "1.50", RegistryValueKind.String); RegistryKey Online_Map_Content = BF2_2006.CreateSubKey("ONLINE_MAP_CONTENT"); #region Online_map_content RegistryKey BF2AF = Online_Map_Content.CreateSubKey("BF2AF"); BF2AF.SetValue("DisplayName", "Battlefield 2: Armored Fury Booster Pack", RegistryValueKind.String); BF2AF.SetValue("GameLauncherParameters", "+menu 1 +fullscreen 1", RegistryValueKind.String); BF2AF.SetValue("GameLauncherPath", GameDir + "\\" + GameExe, RegistryValueKind.String); BF2AF.SetValue("Version", "1.50", RegistryValueKind.String); RegistryKey BF2EF = Online_Map_Content.CreateSubKey("BF2EF"); BF2EF.SetValue("DisplayName", "Battlefield 2: Euro Force Booster Pack", RegistryValueKind.String); BF2EF.SetValue("GameLauncherParameters", "+menu 1 +fullscreen 1", RegistryValueKind.String); BF2EF.SetValue("GameLauncherPath", GameDir + "\\" + GameExe, RegistryValueKind.String); BF2EF.SetValue("Version", "1.50", RegistryValueKind.String); #endregion #endregion #endregion #region EA_Games RegistryKey Battlefiled2 = EA_Games.CreateSubKey("Battlefield 2"); Battlefiled2.SetValue("InstallDir", GameDir, RegistryValueKind.String); // Moficar o Game Path Battlefiled2.SetValue("Language", "English", RegistryValueKind.String); Battlefiled2.SetValue("Locale", "en_US", RegistryValueKind.String); Battlefiled2.SetValue("MemberName", "user", RegistryValueKind.String); Battlefiled2.SetValue("Version", "1.50", RegistryValueKind.String); RegistryKey ergc = Battlefiled2.CreateSubKey("ergc"); ergc.SetValue("", "WAIT_FOR_KEY", RegistryValueKind.String); RegistryKey wdc = Battlefiled2.CreateSubKey("wdc"); wdc.SetValue("", "true", RegistryValueKind.String); RegistryKey Battlefiled2_SF = EA_Games.CreateSubKey("Battlefield 2 Special Forces"); Battlefiled2_SF.SetValue("InstallDir", GameDir, RegistryValueKind.String); // Modificar o Game Path Battlefiled2_SF.SetValue("Language", "English", RegistryValueKind.String); Battlefiled2_SF.SetValue("Locale", "en_US", RegistryValueKind.String); Battlefiled2_SF.SetValue("Version", "1.50", RegistryValueKind.String); RegistryKey ergc_SF = Battlefiled2_SF.CreateSubKey("ergc"); ergc_SF.SetValue("", "WAIT_FOR_KEY", RegistryValueKind.String); RegistryKey wdc_Sf = Battlefiled2_SF.CreateSubKey("wdc"); wdc_Sf.SetValue("", "true", RegistryValueKind.String); #endregion } catch (Exception e) { execption = e.Message; MessageBox.Show("Create Registry Error: Error description in log file...", "Create Registry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); LogFile(e.Message, "Create Registry Error:"); } if (execption == null) { LogFile("Done", "Create Reg:"); MessageBox.Show("The Battlefield Registry was successfully created!", "All Done!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }