Esempio n. 1
0
 protected override IEnumerable <KeyValuePair <int, ExploreRecordInfo> > OnSynchronizeWithDatabase(
     SQLiteConnection db,
     IEnumerable <int> range)
 {
     if (range == null)
     {
         foreach (Row row in db.ExecuteTableQuery(Queries.GetExploreRecordInfos, true))
         {
             ExploreRecordInfo o = ExploreRecordsCache.GetExploreRecordInfoFromRow(row);
             yield return(new KeyValuePair <int, ExploreRecordInfo>(ExploreRecordsCache.GetRecordKey(o), o));
         }
     }
     else
     {
         foreach (int key in range)
         {
             int systemID = ExploreRecordsCache.GetSystemFromKey(key);
             int playerID = ExploreRecordsCache.GetPlayerFromKey(key);
             foreach (Row row in db.ExecuteTableQuery(string.Format(Queries.GetExploreRecordInfo, (object)systemID.ToSQLiteValue(), (object)playerID.ToSQLiteValue()), true))
             {
                 ExploreRecordInfo o = ExploreRecordsCache.GetExploreRecordInfoFromRow(row);
                 yield return(new KeyValuePair <int, ExploreRecordInfo>(key, o));
             }
         }
     }
 }
Esempio n. 2
0
 protected override void OnUpdate(SQLiteConnection db, int key, ExploreRecordInfo value)
 {
     db.ExecuteTableQuery(string.Format(Queries.UpdateExploreRecord, (object)value.SystemId, (object)value.PlayerId, (object)value.LastTurnExplored, (object)value.Visible, (object)value.Explored), true);
     this.Sync(ExploreRecordsCache.GetRecordKey(value));
 }
Esempio n. 3
0
 protected override int OnInsert(SQLiteConnection db, int?key, ExploreRecordInfo value)
 {
     db.ExecuteIntegerQuery(string.Format(Queries.UpdateExploreRecord, (object)value.SystemId.ToSQLiteValue(), (object)value.PlayerId.ToSQLiteValue(), (object)value.LastTurnExplored.ToSQLiteValue(), (object)value.Visible.ToString(), (object)value.Explored.ToString()));
     return(ExploreRecordsCache.GetRecordKey(value));
 }