Changeset 152
- Timestamp:
- 03/08/07 18:25:04 (2 years ago)
- Files:
-
- dmp/trunk/Bridge/Bridge.cs (modified) (1 diff)
- dmp/trunk/daap-sharp/BridgeDatabase.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dmp/trunk/Bridge/Bridge.cs
r151 r152 296 296 297 297 /// <summary> 298 /// Disconnects from the given server 299 /// </summary> 300 /// <param name="libraryId">The library ID to disconnect from</param> 301 /// <returns></returns> 302 public bool RemoveServerConnection(int libraryId) { 303 if (this.clientList.ContainsKey(libraryId)) { 304 Client oldClient = this.clientList[libraryId]; 305 oldClient.Logout(); 306 this.clientList.Remove(libraryId); 307 this.db.RemoveServer(libraryId); 308 DataTable newTable = this.getAvailableSongsInCollection(); 309 this.ServerRemoved(this, new ServerStatusEventArgs(oldClient.Name, false)); 310 this.SongListChanged(this, new SongListChangedEventArgs(newTable)); 311 return true; 312 } 313 else { 314 return false; 315 } 316 } 317 318 /// <summary> 319 /// Disconnects from the given server 320 /// </summary> 321 /// <param name="zeroconfName">The serivce found with ZeroConf to disconnect from</param> 322 /// <returns>True if it worked, false otherwise</returns> 323 public bool RemoveServerConnection(string zeroconfName) { 324 if (this.serverNameToIdList.ContainsKey(zeroconfName)) { 325 int libraryId = this.serverNameToIdList[zeroconfName]; 326 bool result = this.RemoveServerConnection(libraryId); 327 return result; 328 } 329 else { 330 return false; 331 } 332 } 333 334 /// <summary> 298 335 /// Runs when ZeroConf finds a new server. Adds the server if it's been seen before 299 336 /// </summary> dmp/trunk/daap-sharp/BridgeDatabase.cs
r136 r152 463 463 return true; 464 464 } 465 466 /// <summary> 467 /// Removes the given server and all songs from it from the database. 468 /// </summary> 469 /// <param name="libraryId">The library ID of the server to remove</param> 470 public void RemoveServer(int libraryId) { 471 string songCommandString = "DELETE FROM songs WHERE libraryId = @libraryId"; 472 SQLiteCommand songCommand = new SQLiteCommand(songCommandString, this.databaseConnection); 473 songCommand.Parameters.Add("libraryId", DbType.Int32).Value = libraryId; 474 475 string libraryCommandString = "DELETE FROM libraries WHERE id = @id"; 476 SQLiteCommand libraryCommand = new SQLiteCommand(libraryCommandString, this.databaseConnection); 477 libraryCommand.Parameters.Add("id", DbType.Int32).Value = libraryId; 478 479 this.databaseConnection.Open(); 480 songCommand.ExecuteNonQuery(); 481 libraryCommand.ExecuteNonQuery(); 482 this.databaseConnection.Close(); 483 } 465 484 466 485 public void removeSongs(List<int> deletedIds)
