private void onRecordImproved([NotNull] LocalRecord oldRecord, [NotNull] LocalRecord record) { if (RecordImproved != null) { RecordImproved(this, oldRecord, record); } }
private void onNewRecord([NotNull] LocalRecord record) { if (NewRecord != null) { NewRecord(this, record); } }
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); } }