/// <summary>
        /// Creates a new <see cref="RestoreClientHandle"/> 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 RestoreClientHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle)
        {
            RestoreClientHandle safeHandle = new RestoreClientHandle(ownsHandle);

            safeHandle.SetHandle(unsafeHandle);
            return(safeHandle);
        }
Exemple #2
0
        /// <summary>
        /// Retrieves a value from information plist specified by a key.
        /// </summary>
        /// <param name="client">
        /// An initialized restored client.
        /// </param>
        /// <param name="key">
        /// The key name to request or NULL to query for all keys
        /// </param>
        /// <param name="value">
        /// A plist node representing the result value node
        /// </param>
        /// <returns>
        /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG when client is NULL, RESTORE_E_PLIST_ERROR if value for key can't be found
        /// </returns>
        public virtual RestoreError restored_get_value(RestoreClientHandle client, string key, out PlistHandle value)
        {
            RestoreError returnValue;

            returnValue = RestoreNativeMethods.restored_get_value(client, key, out value);
            value.Api   = this.Parent;
            return(returnValue);
        }
Exemple #3
0
        /// <summary>
        /// Receives a plist from restored.
        /// </summary>
        /// <param name="client">
        /// The restored client
        /// </param>
        /// <param name="plist">
        /// The plist to store the received data
        /// </param>
        /// <returns>
        /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG when client or
        /// plist is NULL
        /// </returns>
        public virtual RestoreError restored_receive(RestoreClientHandle client, out PlistHandle plist)
        {
            RestoreError returnValue;

            returnValue = RestoreNativeMethods.restored_receive(client, out plist);
            plist.Api   = this.Parent;
            return(returnValue);
        }
Exemple #4
0
        /// <summary>
        /// Creates a new restored client for the device.
        /// </summary>
        /// <param name="device">
        /// The device to create a restored client for
        /// </param>
        /// <param name="client">
        /// The pointer to the location of the new restored_client
        /// </param>
        /// <param name="label">
        /// The label to use for communication. Usually the program name.
        /// </param>
        /// <returns>
        /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG when client is NULL
        /// </returns>
        public virtual RestoreError restored_client_new(iDeviceHandle device, out RestoreClientHandle client, string label)
        {
            RestoreError returnValue;

            returnValue = RestoreNativeMethods.restored_client_new(device, out client, label);
            client.Api  = this.Parent;
            return(returnValue);
        }
        public static RestoreError restored_query_type(RestoreClientHandle client, out string type, ref ulong version)
        {
            System.Runtime.InteropServices.ICustomMarshaler typeMarshaler = NativeStringMarshaler.GetInstance(null);
            System.IntPtr typeNative  = System.IntPtr.Zero;
            RestoreError  returnValue = RestoreNativeMethods.restored_query_type(client, out typeNative, ref version);

            type = ((string)typeMarshaler.MarshalNativeToManaged(typeNative));
            typeMarshaler.CleanUpNativeData(typeNative);
            return(returnValue);
        }
Exemple #6
0
 /// <summary>
 /// Sets the label to send for requests to restored.
 /// </summary>
 /// <param name="client">
 /// The restore client
 /// </param>
 /// <param name="label">
 /// The label to set or NULL to disable sending a label
 /// </param>
 public virtual void restored_client_set_label(RestoreClientHandle client, string label)
 {
     RestoreNativeMethods.restored_client_set_label(client, label);
 }
 public static RestoreClientHandle DangerousCreate(System.IntPtr unsafeHandle)
 {
     return(RestoreClientHandle.DangerousCreate(unsafeHandle, true));
 }
Exemple #8
0
 /// <summary>
 /// Requests to start a restore and retrieve it's port on success.
 /// </summary>
 /// <param name="client">
 /// The restored client
 /// </param>
 /// <param name="options">
 /// PLIST_DICT with options for the restore process or NULL
 /// </param>
 /// <param name="version">
 /// the restore protocol version, see restored_query_type()
 /// </param>
 /// <returns>
 /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG if a parameter
 /// is NULL, RESTORE_E_START_RESTORE_FAILED if the request fails
 /// </returns>
 public virtual RestoreError restored_start_restore(RestoreClientHandle client, PlistHandle options, ulong version)
 {
     return(RestoreNativeMethods.restored_start_restore(client, options, version));
 }
Exemple #9
0
 /// <summary>
 /// Requests device to reboot.
 /// </summary>
 /// <param name="client">
 /// The restored client
 /// </param>
 /// <returns>
 /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG if a parameter
 /// is NULL
 /// </returns>
 public virtual RestoreError restored_reboot(RestoreClientHandle client)
 {
     return(RestoreNativeMethods.restored_reboot(client));
 }
Exemple #10
0
 public static extern RestoreError restored_goodbye(RestoreClientHandle client);
Exemple #11
0
 /// <summary>
 /// Sends the Goodbye request to restored signaling the end of communication.
 /// </summary>
 /// <param name="client">
 /// The restore client
 /// </param>
 /// <returns>
 /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG when client is NULL,
 /// RESTORE_E_PLIST_ERROR if the device did not acknowledge the request
 /// </returns>
 public virtual RestoreError restored_goodbye(RestoreClientHandle client)
 {
     return(RestoreNativeMethods.restored_goodbye(client));
 }
Exemple #12
0
 public static extern RestoreError restored_start_restore(RestoreClientHandle client, PlistHandle options, ulong version);
Exemple #13
0
 /// <summary>
 /// Sends a plist to restored.
 /// </summary>
 /// <param name="client">
 /// The restored client
 /// </param>
 /// <param name="plist">
 /// The plist to send
 /// </param>
 /// <returns>
 /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG when client or
 /// plist is NULL
 /// </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 RestoreError restored_send(RestoreClientHandle client, PlistHandle plist)
 {
     return(RestoreNativeMethods.restored_send(client, plist));
 }
Exemple #14
0
 /// <summary>
 /// Query the type of the service daemon. Depending on whether the device is
 /// queried in normal mode or restore mode, different types will be returned.
 /// </summary>
 /// <param name="client">
 /// The restored client
 /// </param>
 /// <param name="type">
 /// The type returned by the service daemon. Pass NULL to ignore.
 /// </param>
 /// <param name="version">
 /// The restore protocol version. Pass NULL to ignore.
 /// </param>
 /// <returns>
 /// RESTORE_E_SUCCESS on success, RESTORE_E_INVALID_ARG when client is NULL
 /// </returns>
 public virtual RestoreError restored_query_type(RestoreClientHandle client, out string type, ref ulong version)
 {
     return(RestoreNativeMethods.restored_query_type(client, out type, ref version));
 }
Exemple #15
0
 public static extern RestoreError restored_receive(RestoreClientHandle client, out PlistHandle plist);
Exemple #16
0
 public static extern RestoreError restored_reboot(RestoreClientHandle client);
Exemple #17
0
 public static extern RestoreError restored_query_value(RestoreClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string key, out PlistHandle value);
Exemple #18
0
 public static extern RestoreError restored_query_type(RestoreClientHandle client, out System.IntPtr type, ref ulong version);
Exemple #19
0
 public static extern RestoreError restored_client_new(iDeviceHandle device, out RestoreClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string label);
Exemple #20
0
 public static extern void restored_client_set_label(RestoreClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string label);
 public object MarshalNativeToManaged(System.IntPtr nativeData)
 {
     return(RestoreClientHandle.DangerousCreate(nativeData, false));
 }
Exemple #22
0
 public static extern RestoreError restored_send(RestoreClientHandle client, PlistHandle plist);