public void Remove() { parent.RefreshDatabase(); SQLite.deleteFromDatabase(this); IntPtr afcClient; AFC.AFCError returnCode = AFC.afc_client_start_service(Device.handle, out afcClient, "iOSLib"); if (returnCode != AFC.AFCError.AFC_E_SUCCESS || afcClient == IntPtr.Zero) { return; } returnCode = AFC.afc_remove_path(afcClient, getNameWithPath()); if (AFC.afc_remove_path(afcClient, @"/PhotoData/Photos.sqlite-shm") != AFC.AFCError.AFC_E_SUCCESS || AFC.afc_remove_path(afcClient, @"/PhotoData/Photos.sqlite-wal") != AFC.AFCError.AFC_E_SUCCESS) { AFC.afc_client_free(afcClient); return; } if (AFC.afc_remove_path(afcClient, @"/PhotoData/Photos.sqlite") != AFC.AFCError.AFC_E_SUCCESS) { AFC.afc_client_free(afcClient); return; } AFC.copyToDevice(afcClient, parent.tempFolder + @"\Photos.sqlite", @"/PhotoData/Photos.sqlite"); AFC.afc_client_free(afcClient); }
public void RemovePhotos(List <Photo> photoList) { IEnumerable photoLists = photoList.GroupBy(x => x.Device.Udid).Select(x => x.ToList()); foreach (List <Photo> currPhotoList in photoLists) { iDevice currDevice = currPhotoList[0].Device; IntPtr afcClient; AFC.AFCError returnCode = AFC.afc_client_start_service(currDevice.handle, out afcClient, "iOSLib"); if (returnCode != AFC.AFCError.AFC_E_SUCCESS || afcClient == IntPtr.Zero) { continue; } currPhotoList[0].parent.RefreshDatabase(); if (AFC.afc_remove_path(afcClient, @"/PhotoData/Photos.sqlite-shm") != AFC.AFCError.AFC_E_SUCCESS || AFC.afc_remove_path(afcClient, @"/PhotoData/Photos.sqlite-wal") != AFC.AFCError.AFC_E_SUCCESS) { AFC.afc_client_free(afcClient); continue; } if (AFC.afc_remove_path(afcClient, @"/PhotoData/Photos.sqlite") != AFC.AFCError.AFC_E_SUCCESS) { AFC.afc_client_free(afcClient); continue; } foreach (Photo currPhoto in currPhotoList) { SQLite.deleteFromDatabase(currPhoto); returnCode = AFC.afc_remove_path(afcClient, currPhoto.getNameWithPath()); } AFC.copyToDevice(afcClient, currPhotoList[0].parent.tempFolder + @"\Photos.sqlite", @"/PhotoData/Photos.sqlite"); AFC.afc_client_free(afcClient); } }