/// <summary>
        /// Creates a new <see cref="MobileBackupClientHandle"/> from a <see cref="IntPtr"/>.
        /// </summary>
        /// <param name="unsafeHandle">
        /// The underlying <see cref="IntPtr"/>
        /// </param>
        /// <param name="ownsHandle">
        /// <see langword="true"/> to reliably release the handle during the finalization phase; <see langword="false"/> to prevent reliable release (not recommended).
        /// </param>
        /// <returns>
        /// </returns>
        public static MobileBackupClientHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle)
        {
            MobileBackupClientHandle safeHandle = new MobileBackupClientHandle(ownsHandle);

            safeHandle.SetHandle(unsafeHandle);
            return(safeHandle);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Receive a confirmation from the device that it successfully received
        /// a restore file.
        /// </summary>
        /// <param name="client">
        /// The connected MobileBackup client to use.
        /// </param>
        /// <param name="result">
        /// Pointer to a plist_t that will be set to the received plist
        /// for further processing. The caller has to free it using plist_free().
        /// Note that it will be set to NULL if the operation itself fails due to
        /// a communication or plist error.
        /// If this parameter is NULL, it will be ignored.
        /// </param>
        /// <returns>
        /// MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
        /// client is invalid, MOBILEBACKUP_E_REPLY_NOT_OK if the expected
        /// 'BackupMessageRestoreFileReceived' message could not be received,
        /// MOBILEBACKUP_E_PLIST_ERROR if the received message is not a valid backup
        /// message plist, or MOBILEBACKUP_E_MUX_ERROR if a communication error
        /// occurs.
        /// </returns>
        public virtual MobileBackupError mobilebackup_receive_restore_file_received(MobileBackupClientHandle client, out PlistHandle result)
        {
            MobileBackupError returnValue;

            returnValue = MobileBackupNativeMethods.mobilebackup_receive_restore_file_received(client, out result);
            result.Api  = this.Parent;
            return(returnValue);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Polls the device for mobilebackup data.
        /// </summary>
        /// <param name="client">
        /// The mobilebackup client
        /// </param>
        /// <param name="plist">
        /// A pointer to the location where the plist should be stored
        /// </param>
        /// <returns>
        /// an error code
        /// </returns>
        public virtual MobileBackupError mobilebackup_receive(MobileBackupClientHandle client, out PlistHandle plist)
        {
            MobileBackupError returnValue;

            returnValue = MobileBackupNativeMethods.mobilebackup_receive(client, out plist);
            plist.Api   = this.Parent;
            return(returnValue);
        }
 public static extern MobileBackupError mobilebackup_client_start_service(iDeviceHandle device, out MobileBackupClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string label);
Exemplo n.º 5
0
 /// <summary>
 /// Request that a backup should be restored to the connected device.
 /// </summary>
 /// <param name="client">
 /// The connected MobileBackup client to use.
 /// </param>
 /// <param name="backup_manifest">
 /// The backup manifest, a plist_t of type PLIST_DICT
 /// containing the backup state to be restored.
 /// </param>
 /// <param name="flags">
 /// Flags to send with the request. Currently this is a combination
 /// of the following mobilebackup_flags_t:
 /// MB_RESTORE_NOTIFY_SPRINGBOARD - let SpringBoard show a 'Restore' screen
 /// MB_RESTORE_PRESERVE_SETTINGS - do not overwrite any settings
 /// MB_RESTORE_PRESERVE_CAMERA_ROLL - preserve the photos of the camera roll
 /// </param>
 /// <param name="proto_version">
 /// A string denoting the version of the backup protocol
 /// to use. Latest known version is "1.6". Ideally this value should be
 /// extracted from the given manifest plist.
 /// </param>
 /// <returns>
 /// MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
 /// one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
 /// backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
 /// if a communication error occurs, or MOBILEBACKUP_E_REPLY_NOT_OK
 /// if the device did not accept the request.
 /// </returns>
 public virtual MobileBackupError mobilebackup_request_restore(MobileBackupClientHandle client, PlistHandle backupManifest, MobileBackupFlags flags, string protoVersion)
 {
     return(MobileBackupNativeMethods.mobilebackup_request_restore(client, backupManifest, flags, protoVersion));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Sends a confirmation to the device that a backup file has been received.
 /// </summary>
 /// <param name="client">
 /// The connected MobileBackup client to use.
 /// </param>
 /// <returns>
 /// MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
 /// client is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication error
 /// occurs.
 /// </returns>
 public virtual MobileBackupError mobilebackup_send_backup_file_received(MobileBackupClientHandle client)
 {
     return(MobileBackupNativeMethods.mobilebackup_send_backup_file_received(client));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Request a backup from the connected device.
 /// </summary>
 /// <param name="client">
 /// The connected MobileBackup client to use.
 /// </param>
 /// <param name="backup_manifest">
 /// The backup manifest, a plist_t of type PLIST_DICT
 /// containing the backup state of the last backup. For a first-time backup
 /// set this parameter to NULL.
 /// </param>
 /// <param name="base_path">
 /// The base path on the device to use for the backup
 /// operation, usually "/".
 /// </param>
 /// <param name="proto_version">
 /// A string denoting the version of the backup protocol
 /// to use. Latest known version is "1.6"
 /// </param>
 /// <returns>
 /// MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
 /// one of the parameters is invalid, MOBILEBACKUP_E_PLIST_ERROR if
 /// backup_manifest is not of type PLIST_DICT, MOBILEBACKUP_E_MUX_ERROR
 /// if a communication error occurs, MOBILEBACKUP_E_REPLY_NOT_OK
 /// </returns>
 public virtual MobileBackupError mobilebackup_request_backup(MobileBackupClientHandle client, PlistHandle backupManifest, string basePath, string protoVersion)
 {
     return(MobileBackupNativeMethods.mobilebackup_request_backup(client, backupManifest, basePath, protoVersion));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Sends mobilebackup data to the device
 /// </summary>
 /// <param name="client">
 /// The mobilebackup client
 /// </param>
 /// <param name="plist">
 /// The location of the plist to send
 /// </param>
 /// <returns>
 /// an error code
 /// </returns>
 /// <remarks>
 /// This function is low-level and should only be used if you need to send
 /// a new type of message.
 /// </remarks>
 public virtual MobileBackupError mobilebackup_send(MobileBackupClientHandle client, PlistHandle plist)
 {
     return(MobileBackupNativeMethods.mobilebackup_send(client, plist));
 }
 public static extern MobileBackupError mobilebackup_receive(MobileBackupClientHandle client, out PlistHandle plist);
Exemplo n.º 10
0
 /// <summary>
 /// Tells the device that the restore process is complete and waits for the
 /// device to close the connection. After that, the device should reboot.
 /// </summary>
 /// <param name="client">
 /// The connected MobileBackup client to use.
 /// </param>
 /// <returns>
 /// MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
 /// client is invalid, MOBILEBACKUP_E_PLIST_ERROR if the received disconnect
 /// message plist is invalid, or MOBILEBACKUP_E_MUX_ERROR if a communication
 /// error occurs.
 /// </returns>
 public virtual MobileBackupError mobilebackup_send_restore_complete(MobileBackupClientHandle client)
 {
     return(MobileBackupNativeMethods.mobilebackup_send_restore_complete(client));
 }
Exemplo n.º 11
0
        /// <summary>
        /// Connects to the mobilebackup service on the specified device.
        /// </summary>
        /// <param name="device">
        /// The device to connect to.
        /// </param>
        /// <param name="service">
        /// The service descriptor returned by lockdownd_start_service.
        /// </param>
        /// <param name="client">
        /// Pointer that will be set to a newly allocated
        /// mobilebackup_client_t upon successful return.
        /// </param>
        /// <returns>
        /// MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID ARG if one
        /// or more parameters are invalid, or DEVICE_LINK_SERVICE_E_BAD_VERSION if
        /// the mobilebackup version on the device is newer.
        /// </returns>
        public virtual MobileBackupError mobilebackup_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out MobileBackupClientHandle client)
        {
            MobileBackupError returnValue;

            returnValue = MobileBackupNativeMethods.mobilebackup_client_new(device, service, out client);
            client.Api  = this.Parent;
            return(returnValue);
        }
 public static extern MobileBackupError mobilebackup_send_error(MobileBackupClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string reason);
 public static extern MobileBackupError mobilebackup_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out MobileBackupClientHandle client);
 public static extern MobileBackupError mobilebackup_send_restore_complete(MobileBackupClientHandle client);
 public static extern MobileBackupError mobilebackup_receive_restore_application_received(MobileBackupClientHandle client, out PlistHandle result);
 public static extern MobileBackupError mobilebackup_request_restore(MobileBackupClientHandle client, PlistHandle backupManifest, MobileBackupFlags flags, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string protoVersion);
 public static extern MobileBackupError mobilebackup_send_backup_file_received(MobileBackupClientHandle client);
 public static extern MobileBackupError mobilebackup_send(MobileBackupClientHandle client, PlistHandle plist);
Exemplo n.º 19
0
 /// <summary>
 /// Sends a backup error message to the device.
 /// </summary>
 /// <param name="client">
 /// The connected MobileBackup client to use.
 /// </param>
 /// <param name="reason">
 /// A string describing the reason for the error message.
 /// </param>
 /// <returns>
 /// MOBILEBACKUP_E_SUCCESS on success, MOBILEBACKUP_E_INVALID_ARG if
 /// one of the parameters is invalid, or MOBILEBACKUP_E_MUX_ERROR if a
 /// communication error occurs.
 /// </returns>
 public virtual MobileBackupError mobilebackup_send_error(MobileBackupClientHandle client, string reason)
 {
     return(MobileBackupNativeMethods.mobilebackup_send_error(client, reason));
 }
 /// <summary>
 /// Creates a new <see cref="MobileBackupClientHandle"/> from a <see cref="IntPtr"/>.
 /// </summary>
 /// <param name="unsafeHandle">
 /// The underlying <see cref="IntPtr"/>
 /// </param>
 /// <returns>
 /// </returns>
 public static MobileBackupClientHandle DangerousCreate(System.IntPtr unsafeHandle)
 {
     return(MobileBackupClientHandle.DangerousCreate(unsafeHandle, true));
 }
Exemplo n.º 21
0
        /// <summary>
        /// Starts a new mobilebackup service on the specified device and connects to it.
        /// </summary>
        /// <param name="device">
        /// The device to connect to.
        /// </param>
        /// <param name="client">
        /// Pointer that will point to a newly allocated
        /// mobilebackup_client_t upon successful return. Must be freed using
        /// mobilebackup_client_free() after use.
        /// </param>
        /// <param name="label">
        /// The label to use for communication. Usually the program name.
        /// Pass NULL to disable sending the label in requests to lockdownd.
        /// </param>
        /// <returns>
        /// MOBILEBACKUP_E_SUCCESS on success, or an MOBILEBACKUP_E_* error
        /// code otherwise.
        /// </returns>
        public virtual MobileBackupError mobilebackup_client_start_service(iDeviceHandle device, out MobileBackupClientHandle client, string label)
        {
            MobileBackupError returnValue;

            returnValue = MobileBackupNativeMethods.mobilebackup_client_start_service(device, out client, label);
            client.Api  = this.Parent;
            return(returnValue);
        }
 public object MarshalNativeToManaged(System.IntPtr nativeData)
 {
     return(MobileBackupClientHandle.DangerousCreate(nativeData, false));
 }