public void RefreshDatabase() { 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; } string photoDataPath = @"/PhotoData/Photos.sqlite"; if (AFC.copyToDisk(afcClient, photoDataPath, tempFolder + @"\Photos.sqlite") != AFC.AFCError.AFC_E_SUCCESS) { AFC.afc_client_free(afcClient); return; } AFC.copyToDisk(afcClient, photoDataPath + "-wal", tempFolder + @"\Photos.sqlite-wal"); AFC.copyToDisk(afcClient, photoDataPath + "-shm", tempFolder + @"\Photos.sqlite-shm"); AFC.afc_client_free(afcClient); Count = SQLite.countPhotos(tempFolder + @"\Photos.sqlite"); }
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 Save(string savePath) { 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; } if (AFC.copyToDisk(afcClient, getNameWithPath(), savePath + @"\" + getName()) != AFC.AFCError.AFC_E_SUCCESS) { AFC.afc_client_free(afcClient); return; } AFC.afc_client_free(afcClient); serializeXml(this, savePath); }
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); } }