コード例 #1
0
ファイル: Program.cs プロジェクト: rickparrish/RMastermind
        // Check to see if all four pegs are black }
        static bool CheckWon()
        {
            for (int i = 0; i < 4; i++)
            {
                if (Lines[CurLine].Peg[i] != 1) return false;
            }

            GameOver = true;
            ChangeMsg("Congratulations, You Win!");
            DrawAnswer();

            // Save the high score
            DateTime EndTime = DateTime.Now;
            TimeSpan TS = EndTime - StartTime;
            using (RMSQLiteConnection DB = new RMSQLiteConnection("HighScores.sqlite", false))
            {
                string SQL = "";
                SQL = "INSERT INTO HighScores (PlayerName, Seconds, RecordDate) VALUES (";
                SQL += DB.AddVarCharParameter(Door.DropInfo.Alias) + ", ";
                SQL += DB.AddIntParameter((int)TS.TotalSeconds) + ", ";
                SQL += DB.AddDateTimeParameter(StartTime) + ") ";
                DB.ExecuteNonQuery(SQL);
            }

            return true;
        }