/// <summary>
        /// Sets The Game Key in the registry
        /// </summary>
        /// <param name="Bf2">The Battlefield 2 key to be setted</param>
        /// <param name="Bf2_Sf">The Battlefield 2 Special Forces key to be setted</param>
        /// <param name="Error">if any error occurs this boolean become "true" for error and "false" for not</param>
        /// <param name="OS_isX64">The type of OS, True to x64 and False to x86 system</param>
        public static void SetKey(string Bf2, string Bf2_Sf, out bool Error, bool OS_isX64)
        {
            Error = false;
            const string Prefix = "x9392";
            RegistryKey  EA_Games;

            try
            {
                LogFile("Trying Set CD-KEY....", "Set CD-KEy:");
                //EA_CORE = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Electronic Arts\EA CORE", true);
                if (OS_isX64)
                {
                    EA_Games = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Electronic Arts\EA Games", true);    // X64
                }
                else
                {
                    EA_Games = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Electronic Arts\EA Games", true);    // X86
                }
                RegistryKey BF2_ergc   = EA_Games.OpenSubKey(@"Battlefield 2\ergc", true);
                RegistryKey BF2SF_ergc = EA_Games.OpenSubKey(@"Battlefield 2 Special Forces\ergc", true);

                BF2_ergc.SetValue("", Prefix + Bf2);
                BF2SF_ergc.SetValue("", Prefix + Bf2_Sf);
                LogFile("Done", "Set CD-KEy:");
                //CreateReg.Program();
            }
            catch (Exception e)
            {
                Error = true;
                if (e is NullReferenceException)
                {
                    MessageBox.Show("CD-KEY Error: Game registry probably does not exist.\nTry Install New BF2 Registry ",
                                    "Unable to change CD-KEY", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    LogFile(e.Message, "CD-KEY Error:");
                }
                else
                {
                    MessageBox.Show("CD-KEY Error: Error description in log file...", "Unable to change CD-KEY", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    LogFile(e.Message, "CD-KEY Error:");
                }
            }
        }
        /// <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);
            }
        }