Пример #1
0
 private void onRecordImproved([NotNull] LocalRecord oldRecord, [NotNull] LocalRecord record)
 {
     if (RecordImproved != null)
     {
         RecordImproved(this, oldRecord, record);
     }
 }
Пример #2
0
 private void onNewRecord([NotNull] LocalRecord record)
 {
     if (NewRecord != null)
     {
         NewRecord(this, record);
     }
 }
Пример #3
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);
            }
        }