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 SavePhotos(List <Photo> photoList, string savePath) { if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } 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; if (AFC.afc_client_start_service(device.handle, out afcClient, "iOSLib") != AFC.AFCError.AFC_E_SUCCESS || afcClient == IntPtr.Zero) { return; } foreach (Photo currPhoto in currPhotoList) { AFC.copyToDisk(afcClient, currPhoto.getNameWithPath(), savePath + @"\" + currPhoto.getName()); Photo.serializeXml(currPhoto, savePath); } } }
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); }