Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        public Photos(iDevice currDevice)
        {
            device = currDevice;

            tempFolder = iOSLib.TempFolder + @"\" + currDevice.Udid;
            if (!Directory.Exists(tempFolder))
            {
                Directory.CreateDirectory(tempFolder);
            }
        }
Exemplo n.º 3
0
        internal Photos(iDevice currDevice)
        {
            device = currDevice;

            tempFolder = iOSLib.TempFolder + @"\" + currDevice.Udid;
            if (!Directory.Exists(tempFolder))
            {
                Directory.CreateDirectory(tempFolder);
            }
        }
Exemplo n.º 4
0
        internal Photo(Photos parent, int id, int additionalId, string name, string extension, string mediaType, string fileType, iDevice device, string path, int size,
            double creationTimeSeconds, DateTime creationTime, double modificationTimeSeconds, DateTime modificationTime, List<Album> albumList)
        {
            this.parent = parent;
            Device = device;

            Id = id;
            this.additionalId = additionalId;
            Name = name;
            Extension = extension;
            MediaType = mediaType;
            FileType = fileType;

            Path = path;
            Size = size;
            this.creationTimeSeconds = creationTimeSeconds;
            CreationTime = creationTime;
            this.modificationTimeSeconds = modificationTimeSeconds;
            ModificationTime = modificationTime;

            AlbumList = albumList;
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
        internal Photo(Photos parent, int id, int additionalId, string name, string extension, string mediaType, string fileType, iDevice device, string path, int size,
                       double creationTimeSeconds, DateTime creationTime, double modificationTimeSeconds, DateTime modificationTime, List <Album> albumList)
        {
            this.parent = parent;
            Device      = device;

            Id = id;
            this.additionalId = additionalId;
            Name      = name;
            Extension = extension;
            MediaType = mediaType;
            FileType  = fileType;

            Path = path;
            Size = size;
            this.creationTimeSeconds     = creationTimeSeconds;
            CreationTime                 = creationTime;
            this.modificationTimeSeconds = modificationTimeSeconds;
            ModificationTime             = modificationTime;

            AlbumList = albumList;
        }