예제 #1
0
        public SettingsDB selectSettings()
        {
            List <SettingsDB> settingsDBList = GameTools._sqLiteDbManager.selectSettingsTable();
            SettingsDB        settingsDB     = null;

            if (settingsDBList != null &&
                settingsDBList.Count == 1)
            {
                settingsDB = settingsDBList.FirstOrDefault();
            }

            return(settingsDB);
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }