예제 #1
0
파일: Photos.cs 프로젝트: yang123vc/iOSLib
        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);
                }
            }
        }
예제 #2
0
파일: Photos.cs 프로젝트: exaphaser/iOSLib
        public Photos(iDevice currDevice)
        {
            device = currDevice;

            tempFolder = iOSLib.TempFolder + @"\" + currDevice.Udid;
            if (!Directory.Exists(tempFolder))
            {
                Directory.CreateDirectory(tempFolder);
            }
        }
예제 #3
0
파일: Photos.cs 프로젝트: yang123vc/iOSLib
        internal Photos(iDevice currDevice)
        {
            device = currDevice;

            tempFolder = iOSLib.TempFolder + @"\" + currDevice.Udid;
            if (!Directory.Exists(tempFolder))
            {
                Directory.CreateDirectory(tempFolder);
            }
        }
예제 #4
0
파일: Photo.cs 프로젝트: geiszla/iOSLib
        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;
        }
예제 #5
0
파일: Photos.cs 프로젝트: yang123vc/iOSLib
        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);
            }
        }
예제 #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;
        }