public SettingsDB selectSettings() { List <SettingsDB> settingsDBList = GameTools._sqLiteDbManager.selectSettingsTable(); SettingsDB settingsDB = null; if (settingsDBList != null && settingsDBList.Count == 1) { settingsDB = settingsDBList.FirstOrDefault(); } return(settingsDB); }
public bool InsertSettingsInfo(SettingsDB settingsInfoDB) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(_folderPathString, NAME_DB_STRING))) { connection.Insert(settingsInfoDB); return(true); } } catch (SQLiteException ex) { Log.Info("SQLiteEx", ex.Message); return(false); } }
public bool UpdateSettings(SettingsDB settingsDB) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(_folderPathString, NAME_DB_STRING))) { connection.Query <SettingsDB>("UPDATE SettingsDB set DeviceMac=?, DeviceName=?, DeviceAvatarId=?", settingsDB.DeviceMac, settingsDB.DeviceName, settingsDB.DeviceAvatarId); return(true); } } catch (SQLiteException ex) { Log.Info("SQLiteEx", ex.Message); return(false); } }
private void InitSettings() { List <SettingsDB> listSettingsDB = selectSettingsTable(); SettingsDB settingsDB = new SettingsDB(); BluetoothAdapter bluetoothAdapter = BluetoothAdapter.DefaultAdapter; if (listSettingsDB == null || (listSettingsDB != null && listSettingsDB.Count == 0)) { settingsDB.DeviceAvatarId = I_DEFAULT_AVATAR_ID; if (bluetoothAdapter != null) { settingsDB.DeviceName = bluetoothAdapter.Name; settingsDB.DeviceMac = bluetoothAdapter.Address; } InsertSettingsInfo(settingsDB); } }