예제 #1
0
        private void save([NotNull] LocalRecord record)
        {
            LocalRecord oldRecord = currentRecords.ContainsKey(record.Player.Login) ? currentRecords[record.Player.Login] : null;

            currentRecords[record.Player.Login] = record;

            using (var command = controller.Database.CreateCommand())
            {
                command.CommandText = string.Format("INSERT OR REPLACE INTO `LocalRecords` (`Map`, `Player`, `TimeOrScore`, `CheckpointTimesOrScores`) VALUES {0}", record.toValuesSQL());
                command.ExecuteNonQuery();
            }

            if (oldRecord != null)
            {
                onRecordImproved(oldRecord, record);
            }
            else
            {
                onNewRecord(record);
            }
        }