示例#1
0
 public bool Exists(Photo photo)
 {
     return PhotoList.Any(x =>
     x.CreationTime == photo.CreationTime
     && x.FileType == photo.FileType
     && x.MediaType == photo.MediaType
     && x.ModificationTime == photo.ModificationTime
     && x.Size == photo.Size);
 }
示例#2
0
文件: Photo.cs 项目: geiszla/iOSLib
 internal static void serializeXml(Photo photo, string savePath)
 {
     XmlSerializer serializer = new XmlSerializer(photo.GetType());
     XmlWriter xmlWriter = XmlWriter.Create(savePath + @"\" + photo.Name + ".xml");
     serializer.Serialize(xmlWriter, photo);
     xmlWriter.Close();
 }
示例#3
0
        public void Restore(string path)
        {
            Photo photo = new Photo(path);

            IntPtr afcClient;
            ulong fileHandle;
            if (AFC.openPhoto(photo, device.Photos.PhotoList[device.Photos.PhotoList.Count - 1].Path + photo.getName(),
                device, AFC.FileOpenMode.AFC_FOPEN_WRONLY, out afcClient, out fileHandle) != AFC.AFCError.AFC_E_SUCCESS
                || afcClient == IntPtr.Zero || fileHandle == 0)
            {
                return;
            }

            byte[] fileContent = File.ReadAllBytes(photo.getNameWithPath());
            uint bytesWritten;
            AFC.afc_file_write(afcClient, fileHandle, fileContent, Convert.ToUInt32(photo.Size), out bytesWritten);

            AFC.closePhoto(afcClient, fileHandle);
        }