DriverGame/DriverGame/DriverGame.cs
/// <summary>
/// Save all the high score information to the registry
/// </summary>
Save all the high score information to the registry
Save all the high score information to the registry
public void SaveHighScores()
        {
            Microsoft.Win32.RegistryKey key =
                Microsoft.Win32.Registry.LocalMachine.CreateSubKey(
                "Software\\MDXBoox\\Dodger");
            try
            {
                for (int i = 0; i < highScores.Length; i++)
                {
                    key.SetValue(string.Format("Player{0}", i), highScores[i].Name);
                    key.SetValue(string.Format("Score{0}", i), highScores[i].Score);
                }
                key.SetValue("PlayerName", defaultHighScoreName);
            }
            finally
            {
                if (key != null)
                {
                    key.Close(); 
                }
            }
        }
public void SaveHighScores ( ) { Microsoft . Win32 . RegistryKey key = Microsoft . Win32 . Registry . LocalMachine . CreateSubKey ( " \\ \\ " ) ; try { for ( int i = 0 ; i < highScores . Length ; i ++ ) { key . SetValue ( string . Format ( " " , i ) , highScores [ i ] . Name ) ; key . SetValue ( string . Format ( " " , i ) , highScores [ i ] . Score ) ; } key . SetValue ( " " , defaultHighScoreName ) ; } finally { if ( key != null ) { key . Close ( ) ; } } }
Save all the high score information to the registry
Save all the high score information to the registry
// Make sure to close the key